pub struct TagSet(pub Vec<(String, String)>);Expand description
An ordered tag set. Insertion order is preserved (mirrors the AWS
XML wire format, which is order-significant for the response). For
duplicates on the same key, the last pair wins on lookup, matching
AWS S3 behaviour for x-amz-tagging.
Tuple Fields§
§0: Vec<(String, String)>Implementations§
Source§impl TagSet
impl TagSet
Sourcepub fn from_pairs(pairs: Vec<(String, String)>) -> Result<Self, TagError>
pub fn from_pairs(pairs: Vec<(String, String)>) -> Result<Self, TagError>
Construct a tag set from (key, value) pairs, validating the
AWS S3 limits (max 10, key ≤ 128 B, value ≤ 256 B). Duplicate
keys are retained in insertion order; lookup picks the last one.
Sourcepub fn get(&self, key: &str) -> Option<&str>
pub fn get(&self, key: &str) -> Option<&str>
Look up the value for key. Last-wins on duplicates.
Sourcepub fn iter(&self) -> impl Iterator<Item = &(String, String)>
pub fn iter(&self) -> impl Iterator<Item = &(String, String)>
Iterate the pairs in insertion order.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn validate(&self) -> Result<(), TagError>
pub fn validate(&self) -> Result<(), TagError>
Enforce the AWS S3 spec: count ≤ 10, key ≤ 128 B, value ≤ 256 B,
keys must be non-empty, and keys must be unique within the set.
Called by Self::from_pairs; can also be called directly when
constructing a TagSet from external input that wasn’t validated
yet.
v0.8.4 #79: empty-key + duplicate-key rejection added so the
x-amz-tagging header path and the PutObjectTagging XML body
path both surface 400 InvalidArgument (matching AWS S3) instead
of silently last-wins-collapsing duplicates.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for TagSet
impl<'de> Deserialize<'de> for TagSet
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for TagSet
impl StructuralPartialEq for TagSet
Auto Trait Implementations§
impl Freeze for TagSet
impl RefUnwindSafe for TagSet
impl Send for TagSet
impl Sync for TagSet
impl Unpin for TagSet
impl UnsafeUnpin for TagSet
impl UnwindSafe for TagSet
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.