@@ -390,7 +390,7 @@ pub type Attributes = HashMap<String, AttributeValue>;
390
390
/// #[dynomite(default)]
391
391
/// summary: Option<String>
392
392
/// }
393
- pub trait Item : Into < Attributes > + FromAttributes {
393
+ pub trait Item : IntoAttributes + FromAttributes {
394
394
/// Returns the set of attributes which make up this item's primary key
395
395
///
396
396
/// This is often used in item look ups
@@ -514,11 +514,11 @@ impl<A: Attribute> IntoAttributes for BTreeMap<String, A> {
514
514
}
515
515
}
516
516
517
- /// A Map type for Items , represented as the `M` AttributeValue type
518
- impl < T : Item > Attribute for T {
517
+ /// A Map type for all hash-map-like values , represented as the `M` AttributeValue type
518
+ impl < T : IntoAttributes + FromAttributes > Attribute for T {
519
519
fn into_attr ( self : Self ) -> AttributeValue {
520
520
AttributeValue {
521
- m : Some ( self . into ( ) ) ,
521
+ m : Some ( self . into_attrs ( ) ) ,
522
522
..AttributeValue :: default ( )
523
523
}
524
524
}
@@ -530,39 +530,6 @@ impl<T: Item> Attribute for T {
530
530
}
531
531
}
532
532
533
- /// A Map type for Items for HashMaps, represented as the `M` AttributeValue type
534
- #[ allow( clippy:: implicit_hasher) ]
535
- impl < A : Attribute > Attribute for HashMap < String , A > {
536
- fn into_attr ( self : Self ) -> AttributeValue {
537
- AttributeValue {
538
- m : Some ( self . into_iter ( ) . map ( |( k, v) | ( k, v. into_attr ( ) ) ) . collect ( ) ) ,
539
- ..AttributeValue :: default ( )
540
- }
541
- }
542
- fn from_attr ( value : AttributeValue ) -> Result < Self , AttributeError > {
543
- value
544
- . m
545
- . ok_or ( AttributeError :: InvalidType )
546
- . and_then ( Self :: from_attrs) // because FromAttributes is impl by all HashMap<String, A>
547
- }
548
- }
549
-
550
- /// A Map type for `Items` for `BTreeMaps`, represented as the `M` AttributeValue type
551
- impl < A : Attribute > Attribute for BTreeMap < String , A > {
552
- fn into_attr ( self : Self ) -> AttributeValue {
553
- AttributeValue {
554
- m : Some ( self . into_iter ( ) . map ( |( k, v) | ( k, v. into_attr ( ) ) ) . collect ( ) ) ,
555
- ..AttributeValue :: default ( )
556
- }
557
- }
558
- fn from_attr ( value : AttributeValue ) -> Result < Self , AttributeError > {
559
- value
560
- . m
561
- . ok_or ( AttributeError :: InvalidType )
562
- . and_then ( Self :: from_attrs) // because FromAttributes is impl by all BTreeMap<String, A>
563
- }
564
- }
565
-
566
533
/// A `String` type for `Uuids`, represented by the `S` AttributeValue type
567
534
#[ cfg( feature = "uuid" ) ]
568
535
impl Attribute for Uuid {
0 commit comments