pub struct List<'a, Cn, Cl, PrimaryKey>(/* private fields */)
where
Cl: Collection,
PrimaryKey: KeyEncoding<<Cl as Collection>::PrimaryKey> + PartialEq + ?Sized,
<Cl as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>;
Expand description
Retrieves a list of documents from a collection. This structure also offers functions to customize the options for the operation.
Implementations§
source§impl<'a, Cn, Cl, PrimaryKey> List<'a, Cn, Cl, PrimaryKey>where
Cl: SerializedCollection,
Cn: Connection,
PrimaryKey: KeyEncoding<<Cl as Collection>::PrimaryKey> + PartialEq + 'a + ?Sized,
<Cl as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
impl<'a, Cn, Cl, PrimaryKey> List<'a, Cn, Cl, PrimaryKey>where
Cl: SerializedCollection,
Cn: Connection,
PrimaryKey: KeyEncoding<<Cl as Collection>::PrimaryKey> + PartialEq + 'a + ?Sized,
<Cl as Collection>::PrimaryKey: Borrow<PrimaryKey> + PartialEq<PrimaryKey>,
sourcepub fn ascending(self) -> List<'a, Cn, Cl, PrimaryKey>
pub fn ascending(self) -> List<'a, Cn, Cl, PrimaryKey>
Lists documents by id in ascending order.
sourcepub fn descending(self) -> List<'a, Cn, Cl, PrimaryKey>
pub fn descending(self) -> List<'a, Cn, Cl, PrimaryKey>
Lists documents by id in descending order.
sourcepub fn limit(self, maximum_results: u32) -> List<'a, Cn, Cl, PrimaryKey>
pub fn limit(self, maximum_results: u32) -> List<'a, Cn, Cl, PrimaryKey>
Sets the maximum number of results to return.
sourcepub fn headers(self) -> Result<Vec<Header>, Error>
pub fn headers(self) -> Result<Vec<Header>, Error>
Returns the list of document headers contained within the range.
println!(
"Headers with id 42 or larger: {:?}",
MyCollection::list(42.., db).headers()?
);
println!(
"Headers in MyCollection: {:?}",
MyCollection::all(db).headers()?
);
sourcepub fn count(self) -> Result<u64, Error>
pub fn count(self) -> Result<u64, Error>
Returns the number of documents contained within the range.
Order and limit are ignored if they were set.
println!(
"Number of documents with id 42 or larger: {}",
MyCollection::list(42.., db).count()?
);
println!(
"Number of documents in MyCollection: {}",
MyCollection::all(db).count()?
);
Auto Trait Implementations§
impl<'a, Cn, Cl, PrimaryKey: ?Sized> RefUnwindSafe for List<'a, Cn, Cl, PrimaryKey>where
Cl: RefUnwindSafe,
Cn: RefUnwindSafe,
PrimaryKey: RefUnwindSafe,
<Cl as Collection>::PrimaryKey: RefUnwindSafe,
impl<'a, Cn, Cl, PrimaryKey: ?Sized> Send for List<'a, Cn, Cl, PrimaryKey>where
Cn: Sync,
impl<'a, Cn, Cl, PrimaryKey: ?Sized> Sync for List<'a, Cn, Cl, PrimaryKey>where
Cn: Sync,
impl<'a, Cn, Cl, PrimaryKey: ?Sized> Unpin for List<'a, Cn, Cl, PrimaryKey>
impl<'a, Cn, Cl, PrimaryKey: ?Sized> UnwindSafe for List<'a, Cn, Cl, PrimaryKey>where
Cl: UnwindSafe + RefUnwindSafe,
Cn: RefUnwindSafe,
PrimaryKey: RefUnwindSafe,
<Cl as Collection>::PrimaryKey: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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