[][src]Struct qldb::Document

pub struct Document { /* fields omitted */ }

It contains the IonValue representing the QLDB Document.

It contains methods that will extract and try to transfor the IonValue to your type.

use qldb::{QLDBExtractResult, Document};

fn test(document: Document) -> QLDBExtractResult<u64> {

    let points: u64 = document.get_value("points")?;

    Ok(points)
}

Implementations

impl Document[src]

pub fn get_value<T>(&self, name: &str) -> QLDBExtractResult<T> where
    T: TryFrom<IonValue> + Send + Sync + Clone,
    <T as TryFrom<IonValue>>::Error: Error + Send + Sync + 'static, 
[src]

Extract a value from the document and tries to transform to the value of the return type. Fails if the property is not there.

pub fn get(&self, name: &str) -> Option<&IonValue>[src]

Gets the raw IonValue

pub fn get_optional_value<T>(&self, name: &str) -> QLDBExtractResult<Option<T>> where
    T: TryFrom<IonValue> + Send + Sync + Clone,
    <T as TryFrom<IonValue>>::Error: Error + Send + Sync + 'static, 
[src]

Same as extract_value but it returns None if the property is not there.

Trait Implementations

impl Clone for Document[src]

impl Debug for Document[src]

impl Extend<Document> for DocumentCollection[src]

impl PartialEq<Document> for Document[src]

impl StructuralPartialEq for Document[src]

impl TryFrom<IonValue> for Document[src]

type Error = QLDBExtractError

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.