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§
Sourcefn into_attr(self) -> AttributeValue
fn into_attr(self) -> AttributeValue
Returns a conversion into an AttributeValue
Sourcefn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
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
impl Attribute for bool
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for f32
impl Attribute for f32
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for f64
impl Attribute for f64
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for i16
impl Attribute for i16
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for i32
impl Attribute for i32
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for i64
impl Attribute for i64
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for u16
impl Attribute for u16
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for u32
impl Attribute for u32
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for u64
impl Attribute for u64
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for BTreeSet<i16>
A Number set type, represented by the NS AttributeValue type
impl Attribute for BTreeSet<i16>
A Number set type, represented by the NS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for BTreeSet<i32>
A Number set type, represented by the NS AttributeValue type
impl Attribute for BTreeSet<i32>
A Number set type, represented by the NS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for BTreeSet<i64>
A Number set type, represented by the NS AttributeValue type
impl Attribute for BTreeSet<i64>
A Number set type, represented by the NS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for BTreeSet<u16>
A Number set type, represented by the NS AttributeValue type
impl Attribute for BTreeSet<u16>
A Number set type, represented by the NS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for BTreeSet<u32>
A Number set type, represented by the NS AttributeValue type
impl Attribute for BTreeSet<u32>
A Number set type, represented by the NS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for BTreeSet<u64>
A Number set type, represented by the NS AttributeValue type
impl Attribute for BTreeSet<u64>
A Number set type, represented by the NS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for BTreeSet<String>
impl Attribute for BTreeSet<String>
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for String
A String
type, represented by the S AttributeValue type
impl Attribute for String
A String
type, represented by the S AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for Vec<u8>
impl Attribute for Vec<u8>
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for HashSet<i16>
A Number set type, represented by the NS AttributeValue type
impl Attribute for HashSet<i16>
A Number set type, represented by the NS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for HashSet<i32>
A Number set type, represented by the NS AttributeValue type
impl Attribute for HashSet<i32>
A Number set type, represented by the NS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for HashSet<i64>
A Number set type, represented by the NS AttributeValue type
impl Attribute for HashSet<i64>
A Number set type, represented by the NS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for HashSet<u16>
A Number set type, represented by the NS AttributeValue type
impl Attribute for HashSet<u16>
A Number set type, represented by the NS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for HashSet<u32>
A Number set type, represented by the NS AttributeValue type
impl Attribute for HashSet<u32>
A Number set type, represented by the NS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for HashSet<u64>
A Number set type, represented by the NS AttributeValue type
impl Attribute for HashSet<u64>
A Number set type, represented by the NS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for HashSet<String>
A String Set type, represented by the SS AttributeValue type
impl Attribute for HashSet<String>
A String Set type, represented by the SS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for HashSet<Vec<u8>>
A Binary Set type, represented by the BS AttributeValue type
impl Attribute for HashSet<Vec<u8>>
A Binary Set type, represented by the BS AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for SystemTime
An rfc3339
formatted version of SystemTime
, represented by the S
AttributeValue type
impl Attribute for SystemTime
An rfc3339
formatted version of SystemTime
, represented by the S
AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for Bytes
impl Attribute for Bytes
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for DateTime<FixedOffset>
An rfc3339
formatted version of DateTime<FixedOffset>
, represented by the S
AttributeValue type
impl Attribute for DateTime<FixedOffset>
An rfc3339
formatted version of DateTime<FixedOffset>
, represented by the S
AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for DateTime<Local>
An rfc3339
formatted version of DateTime<Local>
, represented by the S
AttributeValue type
impl Attribute for DateTime<Local>
An rfc3339
formatted version of DateTime<Local>
, represented by the S
AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for DateTime<Utc>
An rfc3339
formatted version of DateTime<Utc>
, represented by the S
AttributeValue type
impl Attribute for DateTime<Utc>
An rfc3339
formatted version of DateTime<Utc>
, represented by the S
AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl Attribute for Uuid
A String
type for Uuids
, represented by the S
AttributeValue type
impl Attribute for Uuid
A String
type for Uuids
, represented by the S
AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl<'a> Attribute for Cow<'a, str>
impl<'a> Attribute for Cow<'a, str>
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl<A: Attribute> Attribute for BTreeMap<String, A>
A Map type for Items
for BTreeMaps
, represented as the M
AttributeValue type
impl<A: Attribute> Attribute for BTreeMap<String, A>
A Map type for Items
for BTreeMaps
, represented as the M
AttributeValue type
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl<A: Attribute> Attribute for Vec<A>
A List type for vectors, represented by the L AttributeValue type
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
fn into_attr(self) -> AttributeValue
fn from_attr(value: AttributeValue) -> Result<Self, AttributeError>
Source§impl<A: Attribute> Attribute for HashMap<String, A>
A Map type for Items for HashMaps, represented as the M
AttributeValue type
impl<A: Attribute> Attribute for HashMap<String, A>
A Map type for Items for HashMaps, represented as the M
AttributeValue type