[][src]Struct libimagstore::storeid::StoreId

pub struct StoreId { /* fields omitted */ }

The Index into the Store

A StoreId object is a unique identifier for one entry in the store which might be present or not.

Methods

impl StoreId[src]

pub fn new(base: Option<PathBuf>, id: PathBuf) -> Result<StoreId>[src]

pub fn from_full_path<D>(store_part: &PathBuf, full_path: D) -> Result<StoreId> where
    D: Deref<Target = Path>, 
[src]

Try to create a StoreId object from a filesystem-absolute path.

Automatically creates a StoreId object which has a base set to store_part if stripping the store_part from the full_path succeeded.

pub fn new_baseless(id: PathBuf) -> Result<StoreId>[src]

pub fn without_base(self) -> StoreId[src]

pub fn with_base(self, base: PathBuf) -> Self[src]

pub fn into_pathbuf(self) -> Result<PathBuf>[src]

Transform the StoreId object into a PathBuf, error if the base of the StoreId is not specified.

pub fn exists(&self) -> Result<bool>[src]

Check whether the StoreId exists (as in whether the file exists)

Warning

Should be considered deprecated

pub fn to_str(&self) -> Result<String>[src]

pub fn local_display_string(&self) -> String[src]

Helper function for creating a displayable String from StoreId

This is safe because the

This example is not tested
    impl<T: fmt::Display + ?Sized> ToString for T

does only fail if Display::display() failed. The implementation of ::std::path::Display and the implementation ::std::fmt::Display for ::std::path::Display do not return errors though.

pub fn components(&self) -> Components[src]

Returns the components of the id part of the StoreId object.

Can be used to check whether a StoreId points to an entry in a specific collection of StoreIds.

pub fn local(&self) -> &PathBuf[src]

Get the local part of a StoreId object, as in "the part from the store root to the entry".

pub fn is_in_collection<S: AsRef<str>, V: AsRef<[S]>>(&self, colls: &V) -> bool[src]

Check whether a StoreId points to an entry in a specific collection.

A "collection" here is simply a directory. So foo/bar/baz is an entry which is in collection ["foo", "bar", "baz"], but also in ["foo", "bar"] and ["foo"].

Warning

The collection specification has to start with the module name. Otherwise this function may return false negatives.

pub fn local_push<P: AsRef<Path>>(&mut self, path: P)[src]

Trait Implementations

impl IntoStoreId for StoreId[src]

impl PartialOrd<StoreId> for StoreId[src]

impl PartialEq<StoreId> for StoreId[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl Clone for StoreId[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Ord for StoreId[src]

fn max(self, other: Self) -> Self1.21.0[src]

Compares and returns the maximum of two values. Read more

fn min(self, other: Self) -> Self1.21.0[src]

Compares and returns the minimum of two values. Read more

fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl Eq for StoreId[src]

impl Display for StoreId[src]

impl Debug for StoreId[src]

impl Hash for StoreId[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

Auto Trait Implementations

impl Send for StoreId

impl Sync for StoreId

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]