afia-component 0.0.4

A high-level Rust wrapper for `libafia_component`.
Documentation
use crate::dom::element::DomElement;

impl DomElement {
    /// Set an attribute on the DOM element.
    pub fn set_attribute(&self, key: &str, value: &str) {
        unsafe {
            afia_component_sys::dom_element_set_attribute(
                self.component_imports_ptr(),
                self.to_i64(),
                key.as_ptr(),
                key.len(),
                value.as_ptr(),
                value.len(),
            )
        };
    }

    /// Remove an attribute from the DOM element.
    pub fn remove_attribute(&self, key: &str) {
        unsafe {
            afia_component_sys::dom_element_remove_attribute(
                self.component_imports_ptr(),
                self.to_i64(),
                key.as_ptr(),
                key.len(),
            )
        };
    }
}