Enum html_node_core::Node 
source · pub enum Node {
    Comment(Comment),
    Doctype(Doctype),
    Fragment(Fragment),
    Element(Element),
    Text(Text),
    UnsafeText(UnsafeText),
}Expand description
An HTML node.
Variants§
Comment(Comment)
A comment.
<!-- I'm a comment! -->
Doctype(Doctype)
A doctype.
<!DOCTYPE html>
Fragment(Fragment)
A fragment.
<>
    I'm in a fragment!
</>
Element(Element)
An element.
<div class="container">
    I'm in an element!
</div>
Text(Text)
A text node.
<div>
    I'm a text node!
</div>
UnsafeText(UnsafeText)
An unsafe text node.
Warning
Node::UnsafeText is not escaped when rendered, and as such, can
allow for XSS attacks. Use with caution!
Implementations§
source§impl Node
 
impl Node
sourcepub const EMPTY: Self = _
 
pub const EMPTY: Self = _
A Node::Fragment with no children.
sourcepub fn from_typed<E: TypedElement>(
    element: E,
    children: Option<Vec<Self>>
) -> Self
 Available on crate feature typed only.
pub fn from_typed<E: TypedElement>( element: E, children: Option<Vec<Self>> ) -> Self
typed only.Create a new Node from a TypedElement.
sourcepub fn pretty(self) -> Pretty
 Available on crate feature pretty only.
pub fn pretty(self) -> Pretty
pretty only.Wrap the node in a pretty-printing wrapper.
sourcepub fn as_children(&self) -> Option<&[Self]>
 
pub fn as_children(&self) -> Option<&[Self]>
Borrow the children of the node, if it is an element (with children) or a fragment.
sourcepub fn children_iter(&self) -> impl Iterator<Item = &Self>
 
pub fn children_iter(&self) -> impl Iterator<Item = &Self>
Iterate over the children of the node.
sourcepub fn children(self) -> Option<Vec<Self>>
 
pub fn children(self) -> Option<Vec<Self>>
The children of the node, if it is an element (with children) or a fragment.
sourcepub fn into_children(self) -> impl Iterator<Item = Self>
 
pub fn into_children(self) -> impl Iterator<Item = Self>
Iterate over the children of the node, consuming it.
sourcepub const fn as_comment(&self) -> Option<&Comment>
 
pub const fn as_comment(&self) -> Option<&Comment>
Try to get this node as a Comment, if it is one.
sourcepub const fn as_doctype(&self) -> Option<&Doctype>
 
pub const fn as_doctype(&self) -> Option<&Doctype>
Try to get this node as a Doctype, if it is one.
sourcepub const fn as_fragment(&self) -> Option<&Fragment>
 
pub const fn as_fragment(&self) -> Option<&Fragment>
Try to get this node as a Fragment, if it is one.
sourcepub const fn as_element(&self) -> Option<&Element>
 
pub const fn as_element(&self) -> Option<&Element>
Try to get this node as an Element, if it is one.
sourcepub const fn as_unsafe_text(&self) -> Option<&UnsafeText>
 
pub const fn as_unsafe_text(&self) -> Option<&UnsafeText>
Try to get this node as an UnsafeText, if it is one.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Node
 
impl<'de> Deserialize<'de> for Node
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl From<UnsafeText> for Node
 
impl From<UnsafeText> for Node
source§fn from(text: UnsafeText) -> Self
 
fn from(text: UnsafeText) -> Self
source§impl IntoResponse for Node
Available on crate feature axum only. 
impl IntoResponse for Node
axum only.source§fn into_response(self) -> Response
 
fn into_response(self) -> Response
source§impl PartialEq<Node> for Node
 
impl PartialEq<Node> for Node
impl Eq for Node
impl StructuralEq for Node
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
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
source§impl<T, S, B> Handler<IntoResponseHandler, S, B> for Twhere
    T: IntoResponse + Clone + Send + 'static,
    B: Send + 'static,
 
impl<T, S, B> Handler<IntoResponseHandler, S, B> for Twhere T: IntoResponse + Clone + Send + 'static, B: Send + 'static,
§type Future = Ready<Response<UnsyncBoxBody<Bytes, Error>>>
 
type Future = Ready<Response<UnsyncBoxBody<Bytes, Error>>>
source§fn call(
    self,
    _req: Request<B>,
    _state: S
) -> <T as Handler<IntoResponseHandler, S, B>>::Future
 
fn call( self, _req: Request<B>, _state: S ) -> <T as Handler<IntoResponseHandler, S, B>>::Future
source§fn layer<L, NewReqBody>(self, layer: L) -> Layered<L, Self, T, S, B, NewReqBody>where
    L: Layer<HandlerService<Self, T, S, B>> + Clone,
    <L as Layer<HandlerService<Self, T, S, B>>>::Service: Service<Request<NewReqBody>>,
 
fn layer<L, NewReqBody>(self, layer: L) -> Layered<L, Self, T, S, B, NewReqBody>where L: Layer<HandlerService<Self, T, S, B>> + Clone, <L as Layer<HandlerService<Self, T, S, B>>>::Service: Service<Request<NewReqBody>>,
tower::Layer] to the handler. Read moresource§fn with_state(self, state: S) -> HandlerService<Self, T, S, B>
 
fn with_state(self, state: S) -> HandlerService<Self, T, S, B>
Service] by providing the statesource§impl<H, T, B> HandlerWithoutStateExt<T, B> for Hwhere
    H: Handler<T, (), B>,
 
impl<H, T, B> HandlerWithoutStateExt<T, B> for Hwhere H: Handler<T, (), B>,
source§fn into_service(self) -> HandlerService<H, T, (), B>
 
fn into_service(self) -> HandlerService<H, T, (), B>
Service] and no state.source§fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, (), B>>
 
fn into_make_service(self) -> IntoMakeService<HandlerService<H, T, (), B>>
MakeService and no state. Read more