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<()>
Sourcepub fn optional_string(&mut self, key: &str) -> Option<Cow<'a, str>>
pub fn optional_string(&mut self, key: &str) -> Option<Cow<'a, str>>
Get string from the value. Works for both String and JID variants.
- String variant: Cow::Borrowed — zero copy
- JID variant: Cow::Owned — allocates only when needed
Sourcepub fn required_string(&mut self, key: &str) -> Result<Cow<'a, str>>
pub fn required_string(&mut self, key: &str) -> Result<Cow<'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 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