Skip to main content

FromAttributes

Trait FromAttributes 

Source
pub trait FromAttributes: Sized {
    // Required method
    fn from_attributes<'a, I>(attrs: I, max_attr_length: usize) -> Option<Self>
       where I: Iterator<Item = Attribute<'a>>;
}
Expand description

Trait for types that can be built from XML attributes

Implement this trait for structs that are parsed from XML element attributes, providing a consistent interface for attribute extraction with limit validation.

Required Methods§

Source

fn from_attributes<'a, I>(attrs: I, max_attr_length: usize) -> Option<Self>
where I: Iterator<Item = Attribute<'a>>,

Parse from XML attributes with limit validation

§Arguments
  • attrs - Iterator over XML attributes
  • max_attr_length - Maximum allowed attribute value length
§Returns
  • Some(Self) - Successfully parsed struct
  • None - Required attributes missing or validation failed

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§