Struct qldb::DocumentCollection [−][src]
pub struct DocumentCollection { /* fields omitted */ }
Expand description
Represents a collection of documents. It implements so you can call in order to use it in for loops or with .
It adds some utilities methods in order to do common operations.
You can use the into_iter in order to execute aggregate values or to make other complex operation.
use qldb::{DocumentCollection, QldbExtractResult}; // Adds all the "points" attributes from each document. // It stops early in case of error extracting the attribute. fn count_points(matches: DocumentCollection) -> QldbExtractResult<u64> { // You can use other types as BigUInt, BigDecimal, etc // in order to avoid overflow let result: u64 = matches .into_iter() .map(|doc| doc.get_value::<u64>("points")) .collect::<Result<Vec<u64>, _>>()? .into_iter() .fold(0, |acc, val| acc + val); Ok(result) }
Implementations
Trait Implementations
Extends a collection with the contents of an iterator. Read more
🔬 This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
🔬 This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
Auto Trait Implementations
impl RefUnwindSafe for DocumentCollection
impl Send for DocumentCollection
impl Sync for DocumentCollection
impl Unpin for DocumentCollection
impl UnwindSafe for DocumentCollection
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self