pub struct AttrParserRef<'a> {
pub errors: Vec<BinaryError>,
/* private fields */
}Fields§
§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<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 JidRef, returns it directly without parsing (zero allocation). If the value is a string, parses it as a JID.
Sourcepub fn optional_jid_result(&mut self, key: &str) -> Result<Option<Jid>>
pub fn optional_jid_result(&mut self, key: &str) -> Result<Option<Jid>>
Get an optional JID attribute, failing when a present value is invalid.
Sourcepub fn required_jid(&mut self, key: &str) -> Result<Jid>
pub fn required_jid(&mut self, key: &str) -> Result<Jid>
Get a required JID attribute, failing immediately when it is missing or invalid.
Structured JIDs are converted directly from their decoded representation; string attributes are parsed exactly once.
pub fn jid(&mut self, key: &str) -> Jid
pub fn non_ad_jid(&mut self, key: &str) -> Jid
Sourcepub fn optional_bool_value(&mut self, key: &str) -> Option<bool>
pub fn optional_bool_value(&mut self, key: &str) -> Option<bool>
Parse an optional protocol boolean while preserving absence.
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> !RefUnwindSafe for AttrParserRef<'a>
impl<'a> !UnwindSafe for AttrParserRef<'a>
impl<'a> Freeze 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>
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