Skip to main content

Dom

Struct Dom 

Source
pub struct Dom { /* private fields */ }

Implementations§

Source§

impl Dom

Source

pub fn new() -> Self

Source

pub fn from_base(inner: BaseDocument) -> Self

Source

pub fn document(&self) -> NodeId

Source

pub fn inner(&self) -> &BaseDocument

Source

pub fn inner_mut(&mut self) -> &mut BaseDocument

Source

pub fn node_ref(&self, id: NodeId) -> NodeRef<'_>

Returns a lightweight borrowed reference to a node without allocating.

Source

pub fn children_of(&self, id: NodeId) -> ChildrenIter<'_>

Returns an iterator over the children of a node, reading directly from the BaseDocument children vec without allocating.

Source

pub fn get(&self, id: NodeId) -> Option<Node>

Source

pub fn get_mut(&mut self, id: NodeId) -> Option<&mut BaseDocument>

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

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

Source

pub fn create_text(&mut self, text: String) -> NodeId

Source

pub fn create_comment(&mut self, _text: String) -> NodeId

Source

pub fn create_document_fragment(&mut self) -> NodeId

Source

pub fn create_shadow_root( &mut self, _host: NodeId, _mode: ShadowRootMode, ) -> NodeId

Source

pub fn allocate_pi(&mut self, _target: String, _data: String) -> NodeId

Source

pub fn create_doctype( &mut self, _name: String, _public_id: String, _system_id: String, ) -> NodeId

Source

pub fn append_child(&mut self, parent: NodeId, child: NodeId)

Source

pub fn insert_before( &mut self, parent: NodeId, child: NodeId, reference: NodeId, )

Source

pub fn detach(&mut self, id: NodeId)

Source

pub fn remove(&mut self, id: NodeId)

Source

pub fn reparent_children(&mut self, source: NodeId, target: NodeId)

Source

pub fn children(&self, parent: NodeId) -> Vec<NodeId>

Source

pub fn child_elements(&self, parent: NodeId) -> Vec<NodeId>

Source

pub fn text_content(&self, id: NodeId) -> String

Source

pub fn set_text_content(&mut self, id: NodeId, text: &str)

Source

pub fn get_element_by_id(&self, id_value: &str) -> Option<NodeId>

Source

pub fn get_elements_by_tag_name(&self, root: NodeId, tag: &str) -> Vec<NodeId>

Source

pub fn get_elements_by_class_name( &self, root: NodeId, class: &str, ) -> Vec<NodeId>

Source

pub fn serialize_html(&self, id: NodeId) -> String

Source

pub fn serialize_inner_html(&self, id: NodeId) -> String

Source

pub fn merge_subtree(&mut self, source: &Dom, source_root: NodeId) -> NodeId

Source

pub fn node_type(&self, id: NodeId) -> u32

Trait Implementations§

Source§

impl Debug for Dom

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Dom

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for Dom

§

impl !RefUnwindSafe for Dom

§

impl !Send for Dom

§

impl !Sync for Dom

§

impl !UnwindSafe for Dom

§

impl Unpin for Dom

§

impl UnsafeUnpin for Dom

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more