[][src]Struct libimagstore::iter::Entries

pub struct Entries<'a>(_, _);

Iterator for iterating over all (or a subset of all) entries

The iterator now has functionality to optimize the iteration, if only a subdirectory of the store is required, for example $STORE/foo.

This is done via functionality where the underlying iterator gets altered.

As the (for the filesystem backend underlying) walkdir::WalkDir type is not as nice as it could be, iterating over two subdirectories with one iterator is not possible. Thus, iterators for two collections in the store should be build like this (untested):

This example is not tested
    store
        .entries()?
        .in_collection("foo")?
        .chain(store.entries()?.in_collection("bar"))

Functionality to exclude subdirectories is not possible with the current implementation and has to be done during iteration, with filtering (as usual).

Methods

impl<'a> Entries<'a>[src]

pub fn in_collection(self, c: &str) -> Result<Self>[src]

Important traits for StoreIdIterator
pub fn into_storeid_iter(self) -> StoreIdIterator[src]

Turn Entries iterator into generic StoreIdIterator

TODO

Revisit whether this can be done in a cleaner way. See commit message for why this is needed.

Important traits for StoreDeleteIterator<'a>
pub fn into_delete_iter(self) -> StoreDeleteIterator<'a>[src]

Transform the iterator into a StoreDeleteIterator

This immitates the API from libimagstore::iter.

Important traits for StoreGetIterator<'a>
pub fn into_get_iter(self) -> StoreGetIterator<'a>[src]

Transform the iterator into a StoreGetIterator

This immitates the API from libimagstore::iter.

Important traits for StoreRetrieveIterator<'a>
pub fn into_retrieve_iter(self) -> StoreRetrieveIterator<'a>[src]

Transform the iterator into a StoreRetrieveIterator

This immitates the API from libimagstore::iter.

Important traits for FindContains<'a, 'b>
pub fn find_by_id_substr<'b>(self, id_substr: &'b str) -> FindContains<'a, 'b>[src]

Find entries where the id contains a substring

This is useful for finding entries if the user supplied only a part of the ID, for example if the ID contains a UUID where the user did not specify the full UUID, E.G.:

This example is not tested
    imag foo show 827d8596-fad1-4

Note

The substring match is done with contains().

Important traits for FindStartsWith<'a, 'b>
pub fn find_by_id_startswith<'b>(
    self,
    id_substr: &'b str
) -> FindStartsWith<'a, 'b>
[src]

Find entries where the id starts with a substring

Same as Entries::find_by_id_substr(), but using starts_with() rather than contains.

Trait Implementations

impl<'a> Iterator for Entries<'a>[src]

type Item = Result<StoreId>

The type of the elements being iterated over.

Auto Trait Implementations

impl<'a> !RefUnwindSafe for Entries<'a>

impl<'a> !Send for Entries<'a>

impl<'a> !Sync for Entries<'a>

impl<'a> Unpin for Entries<'a>

impl<'a> !UnwindSafe for Entries<'a>

Blanket Implementations

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

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

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

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

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

impl<I> IntoIterator for I where
    I: Iterator
[src]

type Item = <I as Iterator>::Item

The type of the elements being iterated over.

type IntoIter = I

Which kind of iterator are we turning this into?

impl<I> IteratorRandom for I where
    I: Iterator
[src]

impl<'a, I> StoreIdCreateIteratorExtension<'a> for I where
    I: Iterator<Item = Result<StoreId, Error>> + 'a, 
[src]

impl<'a, I> StoreIdDeleteIteratorExtension<'a> for I where
    I: Iterator<Item = Result<StoreId, Error>> + 'a, 
[src]

impl<'a, I> StoreIdGetIteratorExtension<'a> for I where
    I: Iterator<Item = Result<StoreId, Error>> + 'a, 
[src]

impl<'a, I> StoreIdRetrieveIteratorExtension<'a> for I where
    I: Iterator<Item = Result<StoreId, Error>> + 'a, 
[src]

impl<I, T> TraceIterator<T> for I where
    I: Iterator<Item = Result<T, Error>>, 
[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<V, T> VZip<V> for T where
    V: MultiLane<T>,