pub struct AttrParserRef<'a> {
pub attrs: &'a [(Cow<'a, str>, ValueRef<'a>)],
pub errors: Vec<BinaryError>,
}Fields§
§attrs: &'a [(Cow<'a, str>, ValueRef<'a>)]§errors: Vec<BinaryError>Implementations§
Source§impl<'a> AttrParserRef<'a>
impl<'a> AttrParserRef<'a>
pub fn new(node: &'a NodeRef<'a>) -> Self
pub fn ok(&self) -> bool
pub fn finish(&self) -> Result<()>
Sourcepub fn optional_string(&mut self, key: &str) -> Option<&'a str>
pub fn optional_string(&mut self, key: &str) -> Option<&'a str>
Get string from the value. For JID values, this returns None - use optional_jid instead.
Sourcepub fn required_string(&mut self, key: &str) -> Result<&'a str>
pub fn required_string(&mut self, key: &str) -> Result<&'a str>
Get a required string attribute, returning an error if missing.
Prefer this over string() for required attributes as it makes
the error explicit rather than silently defaulting to empty string.
Sourcepub fn string(&mut self, key: &str) -> String
👎Deprecated since 0.2.0: Use optional_string() with explicit handling or required_string() instead
pub fn string(&mut self, key: &str) -> String
Get string, defaulting to empty string if missing.
§Deprecation
This method silently defaults to an empty string when the attribute is missing.
Use optional_string() with explicit error handling or required_string()
to avoid silent failures.
Sourcepub fn optional_jid(&mut self, key: &str) -> Option<Jid>
pub fn optional_jid(&mut self, key: &str) -> Option<Jid>
Get JID from the value. If the value is a JidRef, returns it directly without parsing (zero allocation). If the value is a string, parses it as a JID.
pub fn jid(&mut self, key: &str) -> Jid
pub fn non_ad_jid(&mut self, key: &str) -> Jid
pub fn optional_bool(&mut self, key: &str) -> bool
pub fn bool(&mut self, key: &str) -> bool
pub fn optional_u64(&mut self, key: &str) -> Option<u64>
pub fn unix_time(&mut self, key: &str) -> i64
pub fn optional_unix_time(&mut self, key: &str) -> Option<i64>
pub fn unix_milli(&mut self, key: &str) -> i64
pub fn optional_unix_milli(&mut self, key: &str) -> Option<i64>
Auto Trait Implementations§
impl<'a> Freeze for AttrParserRef<'a>
impl<'a> !RefUnwindSafe for AttrParserRef<'a>
impl<'a> Send for AttrParserRef<'a>
impl<'a> Sync for AttrParserRef<'a>
impl<'a> Unpin for AttrParserRef<'a>
impl<'a> UnsafeUnpin for AttrParserRef<'a>
impl<'a> !UnwindSafe for AttrParserRef<'a>
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