pub struct DocumentMutator<'doc> {
pub doc: &'doc mut BaseDocument,
/* private fields */
}Fields§
§doc: &'doc mut BaseDocumentDocument 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<'_>
impl DocumentMutator<'_>
pub fn new<'doc>(doc: &'doc mut BaseDocument) -> DocumentMutator<'doc>
pub fn node_has_parent(&self, node_id: usize) -> bool
pub fn previous_sibling_id(&self, node_id: usize) -> Option<usize>
pub fn next_sibling_id(&self, node_id: usize) -> Option<usize>
pub fn parent_id(&self, node_id: usize) -> Option<usize>
pub fn last_child_id(&self, node_id: usize) -> Option<usize>
pub fn child_ids(&self, node_id: usize) -> Vec<usize>
pub fn element_name(&self, node_id: usize) -> Option<&QualName>
pub fn node_at_path(&self, start_node_id: usize, path: &[u8]) -> usize
pub fn create_comment_node(&mut self) -> usize
pub fn create_text_node(&mut self, text: &str) -> usize
pub fn create_element(&mut self, name: QualName, attrs: Vec<Attribute>) -> usize
pub fn deep_clone_node(&mut self, node_id: usize) -> usize
pub fn set_node_text(&mut self, node_id: usize, value: &str)
pub fn append_text_to_node( &mut self, node_id: usize, text: &str, ) -> Result<(), AppendTextErr>
pub fn add_attrs_if_missing(&mut self, node_id: usize, attrs: Vec<Attribute>)
pub fn set_attribute(&mut self, node_id: usize, name: QualName, value: &str)
pub fn clear_attribute(&mut self, node_id: usize, name: QualName)
pub fn set_style_property(&mut self, node_id: usize, name: &str, value: &str)
pub fn remove_style_property(&mut self, node_id: usize, name: &str)
Sourcepub fn remove_node(&mut self, node_id: usize)
pub fn remove_node(&mut self, node_id: usize)
Remove the node from it’s parent but don’t drop it
pub fn remove_and_drop_node(&mut self, node_id: usize) -> Option<Node>
pub fn remove_and_drop_all_children(&mut self, node_id: usize)
pub fn remove_node_if_unparented(&mut self, node_id: usize)
Sourcepub fn append_children(&mut self, parent_id: usize, child_ids: &[usize])
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
pub fn insert_nodes_before( &mut self, anchor_node_id: usize, new_node_ids: &[usize], )
pub fn insert_nodes_after( &mut self, anchor_node_id: usize, new_node_ids: &[usize], )
pub fn reparent_children(&mut self, old_parent_id: usize, new_parent_id: usize)
pub fn replace_node_with( &mut self, anchor_node_id: usize, new_node_ids: &[usize], )
Source§impl<'doc> DocumentMutator<'doc>
impl<'doc> DocumentMutator<'doc>
Trait Implementations§
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> 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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert