Trait Attribute

Source
pub trait Attribute: Sized {
    // Required methods
    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§

Source

fn into_attr(self) -> AttributeValue

Returns a conversion into an AttributeValue

Source

fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>

Returns a fallible conversion from an AttributeValue

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl Attribute for bool

Source§

impl Attribute for f32

Source§

impl Attribute for f64

Source§

impl Attribute for i16

Source§

impl Attribute for i32

Source§

impl Attribute for i64

Source§

impl Attribute for u16

Source§

impl Attribute for u32

Source§

impl Attribute for u64

Source§

impl Attribute for BTreeSet<i16>

A Number set type, represented by the NS AttributeValue type

Source§

impl Attribute for BTreeSet<i32>

A Number set type, represented by the NS AttributeValue type

Source§

impl Attribute for BTreeSet<i64>

A Number set type, represented by the NS AttributeValue type

Source§

impl Attribute for BTreeSet<u16>

A Number set type, represented by the NS AttributeValue type

Source§

impl Attribute for BTreeSet<u32>

A Number set type, represented by the NS AttributeValue type

Source§

impl Attribute for BTreeSet<u64>

A Number set type, represented by the NS AttributeValue type

Source§

impl Attribute for BTreeSet<String>

Source§

impl Attribute for String

A String type, represented by the S AttributeValue type

Source§

impl Attribute for Vec<u8>

Source§

impl Attribute for HashSet<i16>

A Number set type, represented by the NS AttributeValue type

Source§

impl Attribute for HashSet<i32>

A Number set type, represented by the NS AttributeValue type

Source§

impl Attribute for HashSet<i64>

A Number set type, represented by the NS AttributeValue type

Source§

impl Attribute for HashSet<u16>

A Number set type, represented by the NS AttributeValue type

Source§

impl Attribute for HashSet<u32>

A Number set type, represented by the NS AttributeValue type

Source§

impl Attribute for HashSet<u64>

A Number set type, represented by the NS AttributeValue type

Source§

impl Attribute for HashSet<String>

A String Set type, represented by the SS AttributeValue type

Source§

impl Attribute for HashSet<Vec<u8>>

A Binary Set type, represented by the BS AttributeValue type

Source§

impl Attribute for SystemTime

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

Source§

impl Attribute for Bytes

Source§

impl Attribute for DateTime<FixedOffset>

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

Source§

impl Attribute for DateTime<Local>

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

Source§

impl Attribute for DateTime<Utc>

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

Source§

impl Attribute for Uuid

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

Source§

impl<'a> Attribute for Cow<'a, str>

Source§

impl<A: Attribute> Attribute for BTreeMap<String, A>

A Map type for Items for BTreeMaps, represented as the M AttributeValue type

Source§

impl<A: Attribute> Attribute for Vec<A>

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

Source§

impl<A: Attribute> Attribute for HashMap<String, A>

A Map type for Items for HashMaps, represented as the M AttributeValue type

Source§

impl<T: Attribute> Attribute for Option<T>

Implementors§

Source§

impl<T: Item> Attribute for T

A Map type for Items, represented as the M AttributeValue type