Trait dynomite::Attribute[][src]

pub trait Attribute: Sized {
    fn into_attr(self) -> AttributeValue;
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>; }
Expand description

A type capable of being converted into an or from and AWS AttributeValue

Default implementations of this are provided for each type of AttributeValue field which map to naturally fitting native Rustlang types.

Examples

use dynomite::{dynamodb::AttributeValue, Attribute};

assert_eq!(
    "test".to_string().into_attr().s,
    AttributeValue {
        s: Some("test".to_string()),
        ..AttributeValue::default()
    }
    .s
);

Required methods

Returns a conversion into an AttributeValue

Returns a fallible conversion from an AttributeValue

Implementations on Foreign Types

A String type for Uuids, represented by the S AttributeValue type

An rfc3339 formatted version of DateTime<Utc>, represented by the S AttributeValue type

An rfc3339 formatted version of DateTime<Local>, represented by the S AttributeValue type

An rfc3339 formatted version of DateTime<FixedOffset>, represented by the S AttributeValue type

An rfc3339 formatted version of SystemTime, represented by the S AttributeValue type

A String type, represented by the S AttributeValue type

A String Set type, represented by the SS AttributeValue type

A Binary Set type, represented by the BS AttributeValue type

A List type for vectors, represented by the L AttributeValue type

Note: Vectors support homogenious collection values. This means the default supported scalars do not permit cases where you need to store a list of heterogenus values. To accomplish this you’ll need to implement a wrapper type that represents your desired variants and implement Attribute for YourType. An Vec<YourType> implementation will already be provided

A Number set type, represented by the NS AttributeValue type

A Number set type, represented by the NS AttributeValue type

A Number set type, represented by the NS AttributeValue type

A Number set type, represented by the NS AttributeValue type

A Number set type, represented by the NS AttributeValue type

A Number set type, represented by the NS AttributeValue type

A Number set type, represented by the NS AttributeValue type

A Number set type, represented by the NS AttributeValue type

A Number set type, represented by the NS AttributeValue type

A Number set type, represented by the NS AttributeValue type

A Number set type, represented by the NS AttributeValue type

A Number set type, represented by the NS AttributeValue type

Implementors

A Map type for all hash-map-like values, represented as the M AttributeValue type