diff options
author | Martin Fischer <martin@push-f.com> | 2023-08-30 10:31:41 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2023-09-03 23:00:05 +0200 |
commit | 41198ce17b8d4388105a021c1645823b8d24324b (patch) | |
tree | 37eb2a1d44275a809f4508787e7e92f869b33446 /src/attr.rs | |
parent | ef0f2208992121a45019dce4b5753638607eeb06 (diff) |
docs: document what has been ASCII-lowercased
Diffstat (limited to 'src/attr.rs')
-rw-r--r-- | src/attr.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/attr.rs b/src/attr.rs index 48ae5b0..a4a3428 100644 --- a/src/attr.rs +++ b/src/attr.rs @@ -61,6 +61,7 @@ pub struct Attribute<'a, O> { #[derive(Debug, PartialEq, Eq)] pub struct AttributeOwned<O> { /// The attribute name. + /// Uppercase ASCII characters (A-Z) have been converted to lowercase. pub name: String, /// The attribute value. pub value: String, @@ -76,6 +77,9 @@ pub struct AttributeOwned<O> { impl<O> AttributeMap<O> { /// Returns the attribute with the given name. + /// + /// The name must not contain any uppercase ASCII character (A-Z) + /// or the method will always return `None`. pub fn get(&self, name: &str) -> Option<Attribute<O>> { self.inner .get_key_value(name) @@ -85,6 +89,7 @@ impl<O> AttributeMap<O> { impl<'a, O: Offset> Attribute<'a, O> { /// Returns the attribute name. + /// Uppercase ASCII characters (A-Z) have been converted to lowercase. pub fn name(&self) -> &'a str { self.name } @@ -122,6 +127,10 @@ impl<'a, O: Offset> Attribute<'a, O> { impl<O> Index<&str> for AttributeMap<O> { type Output = str; + /// Returns the attribute value with the given name. + /// + /// The name must not contain any uppercase ASCII character (A-Z) + /// or the method will always panic. fn index(&self, name: &str) -> &Self::Output { &self.inner[name].value } |