pub struct Tree<T> {
pub root: NodeRef<T>,
}Expand description
Represents a tree with a single root node
Fields§
§root: NodeRef<T>Implementations§
Source§impl Tree<HtmlNodeType>
impl Tree<HtmlNodeType>
Sourcepub fn get_elements_by_tag_name(
&self,
tag_name: &str,
) -> Vec<NodeRef<HtmlNodeType>> ⓘ
pub fn get_elements_by_tag_name( &self, tag_name: &str, ) -> Vec<NodeRef<HtmlNodeType>> ⓘ
Returns all elements with the given tag name
Sourcepub fn get_element_by_id(&self, id: &str) -> Option<NodeRef<HtmlNodeType>>
pub fn get_element_by_id(&self, id: &str) -> Option<NodeRef<HtmlNodeType>>
Returns the element with the given id
Sourcepub fn get_elements_by_class_name(
&self,
class_name: &str,
) -> Vec<NodeRef<HtmlNodeType>> ⓘ
pub fn get_elements_by_class_name( &self, class_name: &str, ) -> Vec<NodeRef<HtmlNodeType>> ⓘ
Returns all elements that have the given class
Sourcepub fn inner_text(node: &NodeRef<HtmlNodeType>) -> String
pub fn inner_text(node: &NodeRef<HtmlNodeType>) -> String
Returns the concatenated text content of this node (including children)
Sourcepub fn set_text_content(node: &NodeRef<HtmlNodeType>, new_text: &str)
pub fn set_text_content(node: &NodeRef<HtmlNodeType>, new_text: &str)
Replace all text content of this node with the given string
Sourcepub fn collect_text_by_tag(&self, tag_name: &str) -> Vec<String>
pub fn collect_text_by_tag(&self, tag_name: &str) -> Vec<String>
指定したタグ名の要素のテキストノードをすべて集める
Source§impl<T: Clone> Tree<T>
impl<T: Clone> Tree<T>
Sourcepub fn map<U, F>(&self, f: F) -> Tree<U>
pub fn map<U, F>(&self, f: F) -> Tree<U>
Map each node value to another type, returning a new Tree
Sourcepub fn map_with_node<U, F>(&self, f: F) -> Tree<U>
pub fn map_with_node<U, F>(&self, f: F) -> Tree<U>
Map using the NodeRef itself (for access to parent/children)
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Tree<T>
impl<T> !RefUnwindSafe for Tree<T>
impl<T> !Send for Tree<T>
impl<T> !Sync for Tree<T>
impl<T> Unpin for Tree<T>
impl<T> !UnwindSafe for Tree<T>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more