pub struct DataPath<'a> { /* private fields */ }
Expand description
Represents a position in the data directory when resolving data.
Implementations§
Source§impl<'a> DataPath<'a>
impl<'a> DataPath<'a>
Sourcepub fn descend(self) -> Option<Self>
pub fn descend(self) -> Option<Self>
Takes self by value, and steps to the next logical data path (mutating self). Returns None if there’s nowhere to go.
Sourcepub fn done(&self) -> bool
pub fn done(&self) -> bool
Returns whether or not this instance is exhausted, i.e. when descend would be a no-op
Sourcepub fn file_stem(&self) -> Option<&OsStr>
pub fn file_stem(&self) -> Option<&OsStr>
Returns the current path file stem (i.e. basename without file extension)
Sourcepub fn join<P: AsRef<Path>>(&self, tail: P) -> Self
pub fn join<P: AsRef<Path>>(&self, tail: P) -> Self
Spawns a new instance with a given path suffix appended, and same data address.
Sourcepub fn new<P: Into<PathBuf>>(path: P, address: &'a [&'a str]) -> Self
pub fn new<P: Into<PathBuf>>(path: P, address: &'a [&'a str]) -> Self
Creates a new instance from a path and data address.
Sourcepub fn sub_paths(&self) -> Vec<Self>
pub fn sub_paths(&self) -> Vec<Self>
Creates a vector of new instances, one for each file/directory at the current path.
Sourcepub fn value(&self) -> Result<Value, DataResolverError>
pub fn value(&self) -> Result<Value, DataResolverError>
Tries to convert the current position to a serde_yaml::Value.
Auto Trait Implementations§
impl<'a> Freeze for DataPath<'a>
impl<'a> RefUnwindSafe for DataPath<'a>
impl<'a> Send for DataPath<'a>
impl<'a> Sync for DataPath<'a>
impl<'a> Unpin for DataPath<'a>
impl<'a> UnwindSafe for DataPath<'a>
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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