Struct qldb::DocumentCollection [−][src]
pub struct DocumentCollection { /* fields omitted */ }
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
impl Clone for DocumentCollection
[src]
impl Clone for DocumentCollection
[src]fn clone(&self) -> DocumentCollection
[src]
fn clone(&self) -> DocumentCollection
[src]Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]Performs copy-assignment from source
. Read more
impl Debug for DocumentCollection
[src]
impl Debug for DocumentCollection
[src]impl Default for DocumentCollection
[src]
impl Default for DocumentCollection
[src]impl Extend<Document> for DocumentCollection
[src]
impl Extend<Document> for DocumentCollection
[src]fn extend<T: IntoIterator<Item = Document>>(&mut self, iter: T)
[src]
fn extend<T: IntoIterator<Item = Document>>(&mut self, iter: T)
[src]Extends a collection with the contents of an iterator. Read more
fn extend_one(&mut self, item: A)
[src]
fn extend_one(&mut self, item: A)
[src]extend_one
)Extends a collection with exactly one element.
fn extend_reserve(&mut self, additional: usize)
[src]
fn extend_reserve(&mut self, additional: usize)
[src]extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
impl Index<usize> for DocumentCollection
[src]
impl Index<usize> for DocumentCollection
[src]impl IntoIterator for DocumentCollection
[src]
impl IntoIterator for DocumentCollection
[src]impl PartialEq<DocumentCollection> for DocumentCollection
[src]
impl PartialEq<DocumentCollection> for DocumentCollection
[src]fn eq(&self, other: &DocumentCollection) -> bool
[src]
fn eq(&self, other: &DocumentCollection) -> bool
[src]This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &DocumentCollection) -> bool
[src]
fn ne(&self, other: &DocumentCollection) -> bool
[src]This method tests for !=
.
impl StructuralPartialEq for DocumentCollection
[src]
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
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Instrument for T
[src]
impl<T> Instrument for T
[src]fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
fn in_current_span(self) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more