Struct DataPath

Source
pub struct DataPath<'a> { /* private fields */ }
Expand description

Represents a position in the data directory when resolving data.

Implementations§

Source§

impl<'a> DataPath<'a>

Source

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.

Source

pub fn done(&self) -> bool

Returns whether or not this instance is exhausted, i.e. when descend would be a no-op

Source

pub fn file_stem(&self) -> Option<&OsStr>

Returns the current path file stem (i.e. basename without file extension)

Source

pub fn join<P: AsRef<Path>>(&self, tail: P) -> Self

Spawns a new instance with a given path suffix appended, and same data address.

Source

pub fn new<P: Into<PathBuf>>(path: P, address: &'a [&'a str]) -> Self

Creates a new instance from a path and data address.

Source

pub fn sub_paths(&self) -> Vec<Self>

Creates a vector of new instances, one for each file/directory at the current path.

Source

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> 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> 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, 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

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