pub struct List<'a, Cn, Cl, PrimaryKey> where
    Cl: Collection
{ /* private fields */ }
Expand description

Retrieves a list of documents from a collection. This structure also offers functions to customize the options for the operation.

Implementations

Lists documents by id in ascending order.

Lists documents by id in descending order.

Sets the maximum number of results to return.

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: {}",
    db.collection::<MyCollection>().list(42..).count()?
);
println!(
    "Number of documents in MyCollection: {}",
    db.collection::<MyCollection>().all().count()?
);

Returns the list of headers for documents contained within the range.

println!(
    "Headers with id 42 or larger: {:?}",
    db.collection::<MyCollection>().list(42..).headers()?
);
println!(
    "Headers in MyCollection: {:?}",
    db.collection::<MyCollection>().all().headers()?
);

Retrieves the matching documents.

for doc in db.collection::<MyCollection>().all().query()? {
    println!("Retrieved #{} with bytes {:?}", doc.header.id, doc.contents);
    let deserialized = MyCollection::document_contents(&doc)?;
    println!("Deserialized contents: {:?}", deserialized);
}

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.