Skip to main content

AttributeAccess

Trait AttributeAccess 

Source
pub trait AttributeAccess {
    // Required methods
    fn has_attribute<T: FromAttribute + PartialEq<T>>(
        &self,
        attrib: T,
    ) -> Result<bool>;
    fn get_attribute<T: FromAttribute>(&self) -> Result<Option<T>>;
}
Expand description

Bring useful methods to access attributes of an element.

Required Methods§

Source

fn has_attribute<T: FromAttribute + PartialEq<T>>( &self, attrib: T, ) -> Result<bool>

Check to see if has the given attribute. See FromAttribute for more information.

note: Will immediately return Err(_) on the first error T returns.

Source

fn get_attribute<T: FromAttribute>(&self) -> Result<Option<T>>

Returns the first attribute that returns Some(Self). See FromAttribute for more information.

note: Will immediately return Err(_) on the first error T returns.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl AttributeAccess for Vec<Attribute>

Implementors§