pub struct AttrParser<'a> {
pub attrs: &'a Attrs,
pub errors: Vec<BinaryError>,
}Fields§
§attrs: &'a Attrs§errors: Vec<BinaryError>Implementations§
Source§impl<'a> AttrParser<'a>
impl<'a> AttrParser<'a>
pub fn new(node: &'a Node) -> Self
pub fn ok(&self) -> bool
pub fn finish(&self) -> Result<()>
pub fn optional_string(&mut self, key: &str) -> Option<&'a str>
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 JID variant, returns it directly without parsing (zero allocation clone). 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 AttrParser<'a>
impl<'a> !RefUnwindSafe for AttrParser<'a>
impl<'a> Send for AttrParser<'a>
impl<'a> Sync for AttrParser<'a>
impl<'a> Unpin for AttrParser<'a>
impl<'a> UnsafeUnpin for AttrParser<'a>
impl<'a> !UnwindSafe for AttrParser<'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