#[non_exhaustive]pub enum FileTreeMutation {
CreateDirectory {
parent: FileTreeNodeId,
uri: FileUri,
},
CreateEntry {
parent: FileTreeNodeId,
node_id: FileTreeNodeId,
uri: FileUri,
kind: FileKind,
},
Move {
node_id: FileTreeNodeId,
from: FileUri,
to: FileUri,
},
Remove {
node_id: FileTreeNodeId,
uri: FileUri,
recursive: bool,
},
}Expand description
Provider mutation executed serially on the filesystem worker.
URIs are provider-neutral identifiers. recursive is forwarded without
reinterpretation, and CreateEntry accepts any [FileKind] at the type
level although the worker supports only file and directory creation.
§Examples
use ailloli_ui_fs::{FileKind, FileMetadata, FileTreeStore, FileUri};
use ailloli_ui_fs_runtime::FileTreeMutation;
let store = FileTreeStore::new(FileUri::parse("file:///")?, FileMetadata::new(FileKind::Directory))?;
let mutation = FileTreeMutation::Remove {
node_id: store.root(),
uri: FileUri::parse("file:///")?,
recursive: true,
};
assert_eq!(mutation.target_node_id(), store.root());Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
CreateDirectory
Creates a directory and later inserts the attested result under parent.
Fields
parent: FileTreeNodeIdExisting store node that receives the new child.
uri: FileUriExact provider URI to create.
CreateEntry
Creates a file or directory with an identity reserved by the UI store.
Fields
parent: FileTreeNodeIdExisting store node that receives the new child.
node_id: FileTreeNodeIdStore-local ID reserved before enqueueing the operation.
uri: FileUriExact provider URI to create.
kind: FileKindEntry kind; only [FileKind::File] and [FileKind::Directory] work.
Move
Moves an existing entry and preserves its store-local node ID.
Fields
node_id: FileTreeNodeIdExisting store-local ID to update after provider attestation.
from: FileUriExact current provider URI.
to: FileUriExact destination provider URI.
Remove
Removes an existing entry after provider confirmation.
Implementations§
Source§impl FileTreeMutation
Accessors for store ownership and optional reserved identity.
impl FileTreeMutation
Accessors for store ownership and optional reserved identity.
Sourcepub const fn target_node_id(&self) -> FileTreeNodeId
pub const fn target_node_id(&self) -> FileTreeNodeId
Returns the node serialized against other active mutations.
Create operations target their parent; move/remove operations target the affected node.
§Examples
use ailloli_ui_fs::{FileKind, FileMetadata, FileTreeStore, FileUri};
use ailloli_ui_fs_runtime::FileTreeMutation;
let store = FileTreeStore::new(FileUri::parse("file:///")?, FileMetadata::new(FileKind::Directory))?;
let mutation = FileTreeMutation::CreateDirectory { parent: store.root(), uri: FileUri::parse("file:///new")? };
assert_eq!(mutation.target_node_id(), store.root());Sourcepub const fn reserved_node_id(&self) -> Option<FileTreeNodeId>
pub const fn reserved_node_id(&self) -> Option<FileTreeNodeId>
Returns the preallocated ID only for FileTreeMutation::CreateEntry.
§Examples
use ailloli_ui_fs::{FileKind, FileMetadata, FileTreeStore, FileUri};
use ailloli_ui_fs_runtime::FileTreeMutation;
let mut store = FileTreeStore::new(FileUri::parse("file:///")?, FileMetadata::new(FileKind::Directory))?;
let reserved = store.reserve_node_id()?;
let mutation = FileTreeMutation::CreateEntry { parent: store.root(), node_id: reserved, uri: FileUri::parse("file:///new.txt")?, kind: FileKind::File };
assert_eq!(mutation.reserved_node_id(), Some(reserved));Trait Implementations§
Source§impl Clone for FileTreeMutation
impl Clone for FileTreeMutation
Source§fn clone(&self) -> FileTreeMutation
fn clone(&self) -> FileTreeMutation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FileTreeMutation
impl Debug for FileTreeMutation
Source§impl PartialEq for FileTreeMutation
impl PartialEq for FileTreeMutation
impl Eq for FileTreeMutation
impl StructuralPartialEq for FileTreeMutation
Auto Trait Implementations§
impl Freeze for FileTreeMutation
impl RefUnwindSafe for FileTreeMutation
impl Send for FileTreeMutation
impl Sync for FileTreeMutation
impl Unpin for FileTreeMutation
impl UnwindSafe for FileTreeMutation
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
impl<A> IntoClickAction<A> for Awhere
A: Clone + 'static,
§fn into_click_action(self) -> ClickAction<A>
fn into_click_action(self) -> ClickAction<A>
Implements the into_click_action helper used by this module.