DocumentMutator

Struct DocumentMutator 

Source
pub struct DocumentMutator<'doc> {
    pub doc: &'doc mut BaseDocument,
    /* private fields */
}

Fields§

§doc: &'doc mut BaseDocument

Document is public as an escape hatch, but users of this API should ideally avoid using it and prefer exposing additional functionality in DocumentMutator.

Implementations§

Source§

impl DocumentMutator<'_>

Source

pub fn new<'doc>(doc: &'doc mut BaseDocument) -> DocumentMutator<'doc>

Source

pub fn node_has_parent(&self, node_id: usize) -> bool

Source

pub fn previous_sibling_id(&self, node_id: usize) -> Option<usize>

Source

pub fn next_sibling_id(&self, node_id: usize) -> Option<usize>

Source

pub fn parent_id(&self, node_id: usize) -> Option<usize>

Source

pub fn last_child_id(&self, node_id: usize) -> Option<usize>

Source

pub fn child_ids(&self, node_id: usize) -> Vec<usize>

Source

pub fn element_name(&self, node_id: usize) -> Option<&QualName>

Source

pub fn node_at_path(&self, start_node_id: usize, path: &[u8]) -> usize

Source

pub fn create_comment_node(&mut self) -> usize

Source

pub fn create_text_node(&mut self, text: &str) -> usize

Source

pub fn create_element(&mut self, name: QualName, attrs: Vec<Attribute>) -> usize

Source

pub fn deep_clone_node(&mut self, node_id: usize) -> usize

Source

pub fn set_node_text(&mut self, node_id: usize, value: &str)

Source

pub fn append_text_to_node( &mut self, node_id: usize, text: &str, ) -> Result<(), AppendTextErr>

Source

pub fn add_attrs_if_missing(&mut self, node_id: usize, attrs: Vec<Attribute>)

Source

pub fn set_attribute(&mut self, node_id: usize, name: QualName, value: &str)

Source

pub fn clear_attribute(&mut self, node_id: usize, name: QualName)

Source

pub fn set_style_property(&mut self, node_id: usize, name: &str, value: &str)

Source

pub fn remove_style_property(&mut self, node_id: usize, name: &str)

Source

pub fn remove_node(&mut self, node_id: usize)

Remove the node from it’s parent but don’t drop it

Source

pub fn remove_and_drop_node(&mut self, node_id: usize) -> Option<Node>

Source

pub fn remove_and_drop_all_children(&mut self, node_id: usize)

Source

pub fn remove_node_if_unparented(&mut self, node_id: usize)

Source

pub fn append_children(&mut self, parent_id: usize, child_ids: &[usize])

Remove all of the children from old_parent_id and append them to new_parent_id

Source

pub fn insert_nodes_before( &mut self, anchor_node_id: usize, new_node_ids: &[usize], )

Source

pub fn insert_nodes_after( &mut self, anchor_node_id: usize, new_node_ids: &[usize], )

Source

pub fn reparent_children(&mut self, old_parent_id: usize, new_parent_id: usize)

Source

pub fn replace_node_with( &mut self, anchor_node_id: usize, new_node_ids: &[usize], )

Source§

impl<'doc> DocumentMutator<'doc>

Source

pub fn flush(&mut self)

Source

pub fn set_inner_html(&mut self, node_id: usize, html: &str)

Trait Implementations§

Source§

impl Drop for DocumentMutator<'_>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<'doc> Freeze for DocumentMutator<'doc>

§

impl<'doc> !RefUnwindSafe for DocumentMutator<'doc>

§

impl<'doc> !Send for DocumentMutator<'doc>

§

impl<'doc> !Sync for DocumentMutator<'doc>

§

impl<'doc> Unpin for DocumentMutator<'doc>

§

impl<'doc> !UnwindSafe for DocumentMutator<'doc>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> MaybeBoxed<Box<T>> for T

Source§

fn maybe_boxed(self) -> Box<T>

Convert
Source§

impl<T> MaybeBoxed<T> for T

Source§

fn maybe_boxed(self) -> T

Convert
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,