DirChildren

Struct DirChildren 

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

A directory structure where we don’t know the names of the folders at compile-time, and as such we cannot use the derive macro.

Instead we know that all the entries in the directory are folders, and that they all have the same structure inside (defined by the T type parameter), or they are all files (which can be read with DirChildren<String> for example).

In either case, ReadFrom::read_from must be able to read all the entries in the directory.

The WriteTo implementation will directly write the children to the directory it is passed, with no regards to the path stored in self_path.

Fields§

§children: Vec<DirChild<T, P>>

The children of the root directory.

Implementations§

Source§

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

Source

pub fn new() -> Self

Creates an empty DirChildren, with no children.

§Examples
use std::path::PathBuf;
use dir_structure::{dir_children::DirChildren, NoFilter};

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

pub fn with_children_from_iter( children: impl IntoIterator<Item = DirChild<T, P>>, ) -> Self

Creates a DirChildren with the given path and children.

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

let d = DirChildren::<String, 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 map<U, MapF, F2, P2>(self, f: MapF) -> DirChildren<U, F2, P2>
where MapF: FnMut(DirChild<T, P>) -> DirChild<U, P2>, F2: Filter<P2>, P2: PathType + ?Sized,

Maps the children of this DirChildren to a new type.

This is useful for converting the children to a different type, for example, if you want to convert the children to a different type of DirStructureItem.

This is a convenience method that allows you to use the map method on the children of this DirChildren.

§Examples
use std::path::Path;
use std::pin::Pin;
use dir_structure::{dir_children::{DirChildren, DirChild}, prelude::*};

#[derive(Debug, PartialEq, Eq)]
struct NewType(String);

let dir = DirChildren::<_, 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 dir = dir.map::<_, _, dir_structure::NoFilter, Path>(|child| child.map_value(NewType));
assert_eq!(
    dir,
    DirChildren::with_children_from_iter(
        vec![
            DirChild::new("file1.txt", NewType("file1".to_owned())),
            DirChild::new("file2.txt", NewType("file2".to_owned())),
            DirChild::new("file3.txt", NewType("file3".to_owned())),
        ],
    )
);
Source

pub fn map_filter<NewF>(self) -> DirChildren<T, NewF, P>
where NewF: Filter<P>,

Maps the filter type. The children remain unchanged.

This is useful if you are trying to pass a DirChildren<T, F1> to a function requiring a DirChildren<T, F2>, where F1 and F2 are two distinct types implementing Filter.

§Examples
use std::path::Path;
use dir_structure::traits::vfs::PathType;
use dir_structure::dir_children::{Filter, DirChildren};

struct NewFilter;

impl<P: PathType + ?Sized> Filter<P> for NewFilter {
    fn allows(_path: &P) -> bool {
        true
    }
}

let d = DirChildren::<String, dir_structure::NoFilter>::new();
let d2: DirChildren<String, NewFilter> = d.map_filter::<NewFilter>();
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: Filter<P>, P: PathType + ?Sized> AssertEq for DirChildren<T, F, P>
where for<'__trivial> Vec<DirChild<T, P>>: AssertEq<Vec<DirChild<T, 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, P: PathType + ?Sized, F: Filter<P>> Clone for DirChildren<T, F, P>
where T: Clone,

Source§

fn clone(&self) -> Self

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, P: PathType + ?Sized, F: Filter<P>> Debug for DirChildren<T, F, P>

Source§

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

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

impl<T, P: PathType + ?Sized, F: Filter<P>> Default for DirChildren<T, F, P>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<T, F, P: PathType + ?Sized> DynamicHasField for DirChildren<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, P: PathType + ?Sized, F> Extend<DirChild<T, P>> for DirChildren<T, F, P>
where F: Filter<P>,

Source§

fn extend<I: IntoIterator<Item = DirChild<T, P>>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
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, P: PathType + ?Sized, F> From<Vec<DirChild<T, P>>> for DirChildren<T, F, P>
where F: Filter<P>,

Source§

fn from(children: Vec<DirChild<T, P>>) -> Self

Converts to this type from the input type.
Source§

impl<T, P: PathType + ?Sized, F> FromIterator<DirChild<T, P>> for DirChildren<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<'a, T, F, P: PathType + ?Sized> IntoIterator for &'a DirChildren<T, F, P>
where F: Filter<P>,

Source§

type Item = &'a DirChild<T, P>

The type of the elements being iterated over.
Source§

type IntoIter = DirChildrenIter<'a, T, P>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T, F, P: PathType + ?Sized> IntoIterator for &'a mut DirChildren<T, F, P>
where F: Filter<P>,

Source§

type Item = &'a mut DirChild<T, P>

The type of the elements being iterated over.
Source§

type IntoIter = DirChildrenIterMut<'a, T, P>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

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

Source§

type Item = DirChild<T, P>

The type of the elements being iterated over.
Source§

type IntoIter = DirChildrenIntoIter<T, P>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

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

Source§

fn eq(&self, other: &DirChildren<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, P: PathType + ?Sized + 'a, F, Vfs: Vfs<'a, Path = P>> ReadFrom<'a, Vfs> for DirChildren<T, F, P>
where T: ReadFrom<'a, Vfs>, F: 'a + Filter<P>,

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 DirChildren<T, F, Vfs::Path>
where T: ReadFromAsync<'a, Vfs> + Send + 'static, F: Filter<Vfs::Path> + Send + 'static, T::Future: Future<Output = VfsResult<T, Vfs>> + Unpin + 'static,

Available on crate feature async only.
Source§

type Future = DirChildrenReadAsyncFuture<'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 DirChildren<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 DirChildren<T, F, Vfs::Path>
where T: WriteToAsync<'a, Vfs> + Send + Sync + 'static, F: Filter<Vfs::Path> + Send + 'static, T::Future: Future<Output = VfsResult<(), Vfs>> + Unpin + 'a,

Available on crate feature async only.
Source§

type Future = DirChildrenWriteAsyncFuture<'a, T, Vfs>

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<'r, T, F, Vfs: WriteSupportingVfsAsync + 'static> WriteToAsyncRef<'r, Vfs> for DirChildren<T, F, Vfs::Path>
where T: WriteToAsyncRef<'r, Vfs> + Send + Sync + 'static, F: Filter<Vfs::Path> + Send + 'static, for<'f> <T as WriteToAsyncRef<'r, Vfs>>::Future<'f>: Future<Output = VfsResult<(), Vfs>> + Unpin + 'f,

Available on crate feature async only.
Source§

type Future<'a> = DirChildrenWriteAsyncRefFuture<'r, 'a, T, Vfs> where T: 'a, Vfs: 'a, Self: 'a, 'r: 'a

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

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

Asynchronously writes the structure to the specified path.
Source§

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

Source§

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T, F, P> UnwindSafe for DirChildren<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<'data, I> IntoParallelRefMutIterator<'data> for I

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<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
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,