ForceCreateDirChildren

Struct ForceCreateDirChildren 

Source
pub struct ForceCreateDirChildren<T, F = NoFilter, P: PathType + ?Sized = Path>
where F: Filter<P>,
{ /* private fields */ }
Expand description

A wrapper around DirChildren that forces the creation of the directory, even if there are no children to write.

Implementations§

Source§

impl<T, F, P> ForceCreateDirChildren<T, F, P>
where F: Filter<P>, P: PathType + ?Sized,

Source

pub fn new(children: DirChildren<T, F, P>) -> Self

Creates a new ForceCreateDirChildren with the specified children.

§Examples
use dir_structure::dir_children::{ForceCreateDirChildren, DirChildren};
use dir_structure::NoFilter;

let force_create = ForceCreateDirChildren::new(DirChildren::<String, NoFilter>::new());

assert_eq!(force_create.len(), 0);
Source

pub fn with_children_from_iter<I>(iter: I) -> Self
where I: IntoIterator<Item = DirChild<T, P>>,

Creates a new ForceCreateDirChildren from an iterator of DirChilds.

§Examples
use dir_structure::dir_children::{ForceCreateDirChildren, DirChild, DirChildren};
use dir_structure::NoFilter;

let children = vec![
    DirChild::new("file1.txt", "content1".to_owned()),
    DirChild::new("file2.txt", "content2".to_owned()),
];
let force_create = ForceCreateDirChildren::<_, NoFilter>::with_children_from_iter(children);

assert_eq!(force_create.len(), 2);

Methods from Deref<Target = DirChildren<T, F, P>>§

Source

pub fn len(&self) -> usize

Returns the number of children.

§Examples
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};

let d = DirChildren::<String, dir_structure::NoFilter>::new();
assert_eq!(d.len(), 0);

let d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
    ],
);
assert_eq!(d.len(), 2);
Source

pub fn is_empty(&self) -> bool

Returns true if there are no children.

§Examples
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};

let d = DirChildren::<String, dir_structure::NoFilter>::new();
assert!(d.is_empty());

let d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
    ],
);
assert!(!d.is_empty());
Source

pub fn get(&self, index: usize) -> Option<&DirChild<T, P>>

Gets the child at the specified index.

§Examples
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};

let d = DirChildren::<String, dir_structure::NoFilter>::new();
assert_eq!(d.get(0), None);
assert_eq!(d.get(1), None);
assert_eq!(d.get(100), None);

let d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
    ],
);
assert_eq!(d.get(0), Some(&DirChild::new("file1.txt", "file1".to_owned())));
assert_eq!(d.get(1), Some(&DirChild::new("file2.txt", "file2".to_owned())));
assert_eq!(d.get(2), None);
assert_eq!(d.get(100), None);
Source

pub fn get_mut(&mut self, index: usize) -> Option<&mut DirChild<T, P>>

Gets a mutable reference to the child at the specified index. This is a mutable version of get.

§Examples
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};

let mut d = DirChildren::<String, dir_structure::NoFilter>::new();
assert_eq!(d.get_mut(0), None);
assert_eq!(d.get_mut(1), None);
assert_eq!(d.get_mut(100), None);

let mut d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
    ],
);
assert_eq!(d.get_mut(0), Some(&mut DirChild::new("file1.txt", "file1".to_owned())));
assert_eq!(d.get_mut(1), Some(&mut DirChild::new("file2.txt", "file2".to_owned())));
assert_eq!(d.get_mut(2), None);
assert_eq!(d.get_mut(100), None);
Source

pub fn get_name( &self, name: impl AsRef<P::PathSegmentRef>, ) -> Option<&DirChild<T, P>>

Gets the child with the specified “file” name (last segment of path).

§Examples
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};

let d = DirChildren::<String, dir_structure::NoFilter>::new();
assert_eq!(d.get_name(""), None);
assert_eq!(d.get_name("any_name"), None);
assert_eq!(d.get_name("aaaa"), None);

let d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
    ],
);
assert_eq!(d.get_name("file1.txt"), Some(&DirChild::new("file1.txt", "file1".to_owned())));
assert_eq!(d.get_name("file2.txt"), Some(&DirChild::new("file2.txt", "file2".to_owned())));
assert_eq!(d.get_name("any_name"), None);
assert_eq!(d.get_name("aaaa"), None);
Source

pub fn get_name_mut( &mut self, name: impl AsRef<P::PathSegmentRef>, ) -> Option<&mut DirChild<T, P>>

Gets the child with the specified “file” name (last segment of path). This is a mutable version of get_name.

§Examples
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};

let mut d = DirChildren::<String, dir_structure::NoFilter>::new();
assert_eq!(d.get_name_mut(""), None);
assert_eq!(d.get_name_mut("any_name"), None);
assert_eq!(d.get_name_mut("aaaa"), None);

let mut d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
    ],
);
assert_eq!(d.get_name_mut("file1.txt"), Some(&mut DirChild::new("file1.txt", "file1".to_owned())));
assert_eq!(d.get_name_mut("file2.txt"), Some(&mut DirChild::new("file2.txt", "file2".to_owned())));
assert_eq!(d.get_name_mut("any_name"), None);
assert_eq!(d.get_name_mut("aaaa"), None);
Source

pub fn get_value_by_name( &self, name: impl AsRef<P::PathSegmentRef>, ) -> Option<&T>

Gets the value of the child with the specified “file” name (last segment of path).

§Examples
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};

let d = DirChildren::<String, dir_structure::NoFilter>::new();
assert_eq!(d.get_value_by_name(""), None);
assert_eq!(d.get_value_by_name("any_name"), None);
assert_eq!(d.get_value_by_name("aaaa"), None);

let d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
    ],
);
assert_eq!(d.get_value_by_name("file1.txt"), Some(&"file1".to_owned()));
assert_eq!(d.get_value_by_name("file2.txt"), Some(&"file2".to_owned()));
assert_eq!(d.get_value_by_name("any_name"), None);
assert_eq!(d.get_value_by_name("aaaa"), None);
Source

pub fn get_value_by_name_mut( &mut self, name: impl AsRef<P::PathSegmentRef>, ) -> Option<&mut T>

Gets the value of the child with the specified “file” name (last segment of path). This is a mutable version of get_value_by_name.

§Examples
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};

let mut d = DirChildren::<String, dir_structure::NoFilter>::new();
assert_eq!(d.get_value_by_name_mut(""), None);
assert_eq!(d.get_value_by_name_mut("any_name"), None);
assert_eq!(d.get_value_by_name_mut("aaaa"), None);

let mut d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
    ],
);
assert_eq!(d.get_value_by_name_mut("file1.txt"), Some(&mut "file1".to_owned()));
assert_eq!(d.get_value_by_name_mut("file2.txt"), Some(&mut "file2".to_owned()));
assert_eq!(d.get_value_by_name_mut("any_name"), None);
assert_eq!(d.get_value_by_name_mut("aaaa"), None);
Source

pub fn iter(&self) -> DirChildrenIter<'_, T, P>

Returns an iterator over the children.

§Examples
use std::path::{Path, PathBuf};
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};

let d = DirChildren::<String, dir_structure::NoFilter>::new();
let mut i = d.iter();
assert_eq!(i.next(), None);

let d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
    ],
);
let mut i = d.iter();
assert_eq!(i.next(), Some(&DirChild::new("file1.txt", "file1".to_owned())));
assert_eq!(i.next(), Some(&DirChild::new("file2.txt", "file2".to_owned())));
assert_eq!(i.next(), None);
Source

pub fn iter_mut(&mut self) -> DirChildrenIterMut<'_, T, P>

Returns a mutable iterator over the children.

§Examples
use std::path::{Path, PathBuf};
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};

let mut d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
    ],
);
let mut i = d.iter_mut();
assert_eq!(i.next(), Some(&mut DirChild::new("file1.txt", "file1".to_owned())));
assert_eq!(i.next(), Some(&mut DirChild::new("file2.txt", "file2".to_owned())));
assert_eq!(i.next(), None);

Modifying the children is also possible:

use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};

let mut d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
    ],
);
d.iter_mut().for_each(|child| *child.value_mut() = "modified".to_owned());
let mut i = d.iter();
assert_eq!(i.next(), Some(&DirChild::new("file1.txt", "modified".to_owned())));
assert_eq!(i.next(), Some(&DirChild::new("file2.txt", "modified".to_owned())));
assert_eq!(i.next(), None);
Source

pub fn push(&mut self, file_name: impl Into<P::PathSegmentOwned>, value: T)

Pushes a new child to the end of the children list.

This method takes a file name and a value, and creates a new DirChild with the given file name and value, then pushes it to the end of the children list.

§Examples
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};
let mut d = DirChildren::<String, dir_structure::NoFilter>::new();

d.push("file1.txt", "file1".to_owned());

let mut i = d.iter();
assert_eq!(i.next(), Some(&DirChild::new("file1.txt", "file1".to_owned())));
assert_eq!(i.next(), None);

d.push("file2.txt", "file2".to_owned());

let mut i = d.iter();
assert_eq!(i.next(), Some(&DirChild::new("file1.txt", "file1".to_owned())));
assert_eq!(i.next(), Some(&DirChild::new("file2.txt", "file2".to_owned())));
assert_eq!(i.next(), None);
Source

pub fn retain(&mut self, f: impl FnMut(&DirChild<T, P>) -> bool)

Retains only the children specified by the predicate.

The predicate is a closure that takes a reference to a DirChild<T> and returns true if the child should be kept, or false if it should be removed.

§Examples
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};
let mut d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
    ],
);
d.retain(|child| child.file_name() != "file1.txt");
let mut i = d.iter();
assert_eq!(i.next(), Some(&DirChild::new("file2.txt", "file2".to_owned())));
assert_eq!(i.next(), None);
Source

pub fn drain( &mut self, range: impl RangeBounds<usize>, ) -> DirChildrenDrain<'_, T, P>

Drains the children in the specified range, returning an iterator over the removed children. The range is specified using the standard Rust range syntax.

§Examples
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};
let mut d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
        DirChild::new("file3.txt", "file3".to_owned()),
    ],
);
let drained: Vec<_> = d.drain(0..1).collect();
assert_eq!(drained, vec![DirChild::new("file1.txt", "file1".to_owned())]);
let mut i = d.iter();
assert_eq!(i.next(), Some(&DirChild::new("file2.txt", "file2".to_owned())));
assert_eq!(i.next(), Some(&DirChild::new("file3.txt", "file3".to_owned())));
assert_eq!(i.next(), None);
Source

pub fn extract_if<'a, Fi>( &'a mut self, range: impl RangeBounds<usize>, filter: Fi, ) -> DirChildrenExtractIf<'a, T, P, Fi>
where Fi: FnMut(&mut DirChild<T, P>) -> bool,

Extracts the children in the specified range that satisfy the given predicate, returning an iterator over the removed children.

The range is specified using the standard Rust range syntax. The predicate is a closure that takes a mutable reference to a DirChild<T> and returns true if the child should be removed, or false if it should be kept.

§Examples
use dir_structure::{traits::sync::{DirStructure, DirStructureItem}, dir_children::{DirChildren, DirChild}};
let mut d = DirChildren::<String, dir_structure::NoFilter>::with_children_from_iter(
    vec![
        DirChild::new("file1.txt", "file1".to_owned()),
        DirChild::new("file2.txt", "file2".to_owned()),
        DirChild::new("file3.txt", "file3".to_owned()),
        DirChild::new("file4.txt", "file4".to_owned()),
    ],
);
let extracted: Vec<_> = d.extract_if(1..3, |child| child.file_name() == "file2.txt").collect();
assert_eq!(extracted, vec![DirChild::new("file2.txt", "file2".to_owned())]);

let mut i = d.iter();
assert_eq!(i.next(), Some(&DirChild::new("file1.txt", "file1".to_owned())));
assert_eq!(i.next(), Some(&DirChild::new("file3.txt", "file3".to_owned())));
assert_eq!(i.next(), Some(&DirChild::new("file4.txt", "file4".to_owned())));
assert_eq!(i.next(), None);

Trait Implementations§

Source§

impl<T, F, P: PathType + ?Sized> AsMut<DirChildren<T, F, P>> for ForceCreateDirChildren<T, F, P>
where F: Filter<P>,

Source§

fn as_mut(&mut self) -> &mut DirChildren<T, F, P>

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T, F, P: PathType + ?Sized> AsRef<DirChildren<T, F, P>> for ForceCreateDirChildren<T, F, P>
where F: Filter<P>,

Source§

fn as_ref(&self) -> &DirChildren<T, F, P>

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T, F, P: PathType + ?Sized> AssertEq for ForceCreateDirChildren<T, F, P>
where F: Filter<P>, for<'__trivial> DirChildren<T, F, P>: AssertEq<DirChildren<T, F, P>> + Debug,

Source§

fn assert_eq( &self, other: &Self, path: &mut AssertPath, init_left: &impl Display, init_right: &impl Display, )

Asserts that self is equal to other, panicking if they are not equal. Read more
Source§

impl<T: Clone, F, P: Clone + PathType + ?Sized> Clone for ForceCreateDirChildren<T, F, P>
where F: Filter<P> + Clone,

Source§

fn clone(&self) -> ForceCreateDirChildren<T, F, P>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T, F, P: PathType + ?Sized> Debug for ForceCreateDirChildren<T, F, P>
where F: Filter<P>, T: Debug, <P as PathType>::PathSegmentOwned: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T, F, P: PathType + ?Sized> Deref for ForceCreateDirChildren<T, F, P>
where F: Filter<P>,

Source§

type Target = DirChildren<T, F, P>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<T, F, P: PathType + ?Sized> DerefMut for ForceCreateDirChildren<T, F, P>
where F: Filter<P>,

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<T, F, P: PathType + ?Sized> DynamicHasField for ForceCreateDirChildren<T, F, P>
where F: Filter<P>,

Available on crate feature resolve-path only.
Source§

type Inner = T

The type of the field.
Source§

fn resolve_path<Pt: OwnedPathType>(p: Pt, name: &str) -> Pt

How to resolve the path for the field, from the path of Self, given the name passed into the resolve_path! macro.
Source§

impl<T, F, P: PathType + ?Sized> From<DirChildren<T, F, P>> for ForceCreateDirChildren<T, F, P>
where F: Filter<P>,

Source§

fn from(children: DirChildren<T, F, P>) -> Self

Converts to this type from the input type.
Source§

impl<T, F, P: PathType + ?Sized> From<ForceCreateDirChildren<T, F, P>> for DirChildren<T, F, P>
where F: Filter<P>,

Source§

fn from(force_create: ForceCreateDirChildren<T, F, P>) -> Self

Converts to this type from the input type.
Source§

impl<T, F, P: PathType + ?Sized> FromIterator<DirChild<T, P>> for ForceCreateDirChildren<T, F, P>
where F: Filter<P>,

Source§

fn from_iter<I: IntoIterator<Item = DirChild<T, P>>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T: PartialEq, F, P: PartialEq + PathType + ?Sized> PartialEq for ForceCreateDirChildren<T, F, P>
where F: Filter<P> + PartialEq,

Source§

fn eq(&self, other: &ForceCreateDirChildren<T, F, P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T, F, Vfs: Vfs<'a>> ReadFrom<'a, Vfs> for ForceCreateDirChildren<T, F, Vfs::Path>
where T: ReadFrom<'a, Vfs>, F: Filter<Vfs::Path> + 'a,

Source§

fn read_from(path: &Vfs::Path, vfs: Pin<&'a Vfs>) -> VfsResult<Self, Vfs>
where Self: Sized,

Reads the structure from the specified path, which can be either a file or a directory.
Source§

impl<'a, T, F, Vfs: VfsAsync + 'a> ReadFromAsync<'a, Vfs> for ForceCreateDirChildren<T, F, Vfs::Path>
where T: ReadFromAsync<'a, Vfs> + Send + Sync + 'static, F: Filter<Vfs::Path> + Send + Sync + 'static, T::Future: Future<Output = VfsResult<T, Vfs>> + Unpin + 'static,

Available on crate feature async only.
Source§

type Future = ForceCreateDirChildrenReadAsyncFuture<'a, T, F, Vfs>

The future type returned by the async read function.
Source§

fn read_from_async( path: <<Vfs as VfsCore>::Path as PathType>::OwnedPath, vfs: Pin<&'a Vfs>, ) -> Self::Future

Asynchronously reads the structure from the specified path, which can be either a file or a directory.
Source§

impl<'a, T, F, Vfs: WriteSupportingVfs<'a>> WriteTo<'a, Vfs> for ForceCreateDirChildren<T, F, Vfs::Path>
where T: WriteTo<'a, Vfs>, F: Filter<Vfs::Path>,

Source§

fn write_to(&self, path: &Vfs::Path, vfs: Pin<&'a Vfs>) -> VfsResult<(), Vfs>

Writes the structure to the specified path.
Source§

impl<'a, T, F, Vfs: WriteSupportingVfsAsync + 'static> WriteToAsync<'a, Vfs> for ForceCreateDirChildren<T, F, Vfs::Path>
where T: WriteToAsync<'a, Vfs> + Send + Sync + 'static, F: Filter<Vfs::Path> + Send + Sync + 'static, T::Future: Future<Output = VfsResult<(), Vfs>> + Unpin + 'a,

Available on crate feature async only.
Source§

type Future = Pin<Box<dyn Future<Output = Result<(), Error<<<Vfs as VfsCore>::Path as PathType>::OwnedPath>>> + Send + 'a>>

The future type returned by the async write function.
Source§

fn write_to_async( self, path: <<Vfs as VfsCore>::Path as PathType>::OwnedPath, vfs: Pin<&'a Vfs>, ) -> Self::Future

Asynchronously writes the structure to the specified path.
Source§

impl<T: Eq, F, P: Eq + PathType + ?Sized> Eq for ForceCreateDirChildren<T, F, P>
where F: Filter<P> + Eq,

Source§

impl<T, F, P: PathType + ?Sized> StructuralPartialEq for ForceCreateDirChildren<T, F, P>
where F: Filter<P>,

Auto Trait Implementations§

§

impl<T, F, P> Freeze for ForceCreateDirChildren<T, F, P>
where P: ?Sized,

§

impl<T, F, P> RefUnwindSafe for ForceCreateDirChildren<T, F, P>

§

impl<T, F, P> Send for ForceCreateDirChildren<T, F, P>
where F: Send, T: Send, P: ?Sized,

§

impl<T, F, P> Sync for ForceCreateDirChildren<T, F, P>
where F: Sync, T: Sync, P: ?Sized,

§

impl<T, F, P> Unpin for ForceCreateDirChildren<T, F, P>
where F: Unpin, P: Unpin + ?Sized, <P as PathType>::PathSegmentOwned: Unpin, T: Unpin,

§

impl<T, F, P> UnwindSafe for ForceCreateDirChildren<T, F, P>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DirStructureItem for T

Source§

fn read(path: impl AsRef<<FsVfs as VfsCore>::Path>) -> VfsResult<Self, FsVfs>
where Self: ReadFrom<'static, FsVfs> + Sized,

Uses the ReadFrom implementation to read the structure from disk, from the specified path.
Source§

fn write<'a, 'vfs: 'a>( &'a self, path: impl AsRef<<FsVfs as VfsCore>::Path>, ) -> VfsResult<(), FsVfs>
where Self: WriteTo<'vfs, FsVfs>,

Uses the WriteTo implementation to write the structure to disk at the specified path.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,