Struct bonsaidb::core::connection::List[][src]

pub struct List<'a, Cn, Cl, PrimaryKey> where
    Cl: Collection
{ /* fields omitted */ }
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

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more