pub struct BinaryAttribute;Expand description
Marker type for DynamoDB Binary (B) attributes.
Use this as the Type in an attribute_definitions!
block to declare that an attribute stores binary data. Rust types that
implement IntoTypedAttributeValue<BinaryAttribute>
include Vec<u8> and [&[u8]].
The type system enforces this constraint at compile time: passing a
value of the wrong type (e.g. a &str or u32) to a
BinaryAttribute attribute will not compile.
§Examples
use dynamodb_facade::{attribute_definitions, has_attributes, BinaryAttribute};
attribute_definitions! {
Thumbnail { "thumbnail": BinaryAttribute }
}
struct MyItem;
// ✓ Vec<u8> implements IntoTypedAttributeValue<BinaryAttribute>
has_attributes! {
MyItem {
Thumbnail {
fn attribute_value(id) -> Vec<u8> { vec![0x89, 0x50, 0x4e, 0x47] }
}
}
}
// These would NOT compile — wrong attribute type:
// has_attributes! { MyItem { Thumbnail { const VALUE: &'static str = "img"; } } }
// has_attributes! { MyItem { Thumbnail { fn attribute_value(id) -> u32 { 0 } } } }Trait Implementations§
Source§impl Clone for BinaryAttribute
impl Clone for BinaryAttribute
Source§fn clone(&self) -> BinaryAttribute
fn clone(&self) -> BinaryAttribute
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BinaryAttribute
impl Debug for BinaryAttribute
impl AttributeType for BinaryAttribute
impl Copy for BinaryAttribute
impl<T: IntoBinaryAttributeValue + IntoAttributeValue> IntoTypedAttributeValue<BinaryAttribute> for T
Auto Trait Implementations§
impl Freeze for BinaryAttribute
impl RefUnwindSafe for BinaryAttribute
impl Send for BinaryAttribute
impl Sync for BinaryAttribute
impl Unpin for BinaryAttribute
impl UnsafeUnpin for BinaryAttribute
impl UnwindSafe for BinaryAttribute
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.