pub trait AttributeDefinition {
type Type: AttributeType + AttributeValueRef;
const NAME: &'static str;
}Expand description
Defines the name and type of a single DynamoDB attribute at the type level.
Implementations are generated by
attribute_definitions!. Each implementing
type is a zero-sized struct that carries:
NAME— the DynamoDB attribute name as a&'static str.Type— one ofStringAttribute,NumberAttribute, orBinaryAttribute, indicating the DynamoDB scalar type.
These types serve as type-safe identifiers that connect attribute names and DynamoDB types to your key schemas, item definitions, and query builders.
§Examples
use dynamodb_facade::{attribute_definitions, has_attributes, AttributeDefinition, StringAttribute};
attribute_definitions! {
CourseId { "course_id": StringAttribute }
}
// Use with the has_attributes! or dynamodb_item! macros:
struct MyItem;
has_attributes! {
MyItem {
CourseId { const VALUE: &'static str = "COURSE1234"; }
}
}
// Access the attribute name.
assert_eq!(CourseId::NAME, "course_id");Required Associated Constants§
Required Associated Types§
Sourcetype Type: AttributeType + AttributeValueRef
type Type: AttributeType + AttributeValueRef
The DynamoDB scalar type: StringAttribute, NumberAttribute, or BinaryAttribute.
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.