Enum swc_html_ast::Child
source · [−]pub enum Child {
DocumentType(DocumentType),
Element(Element),
Text(Text),
Comment(Comment),
}
Variants
DocumentType(DocumentType)
Element(Element)
Text(Text)
Comment(Comment)
Implementations
sourceimpl Child
impl Child
sourcepub fn is_document_type(&self) -> bool
pub fn is_document_type(&self) -> bool
Returns true
if self
is of variant DocumentType
.
sourcepub fn as_document_type(&self) -> Option<&DocumentType>
pub fn as_document_type(&self) -> Option<&DocumentType>
Returns Some
if self
is a reference of variant DocumentType
, and None
otherwise.
sourcepub fn expect_document_type(self) -> DocumentType where
Self: Debug,
pub fn expect_document_type(self) -> DocumentType where
Self: Debug,
Unwraps the value, yielding the content of DocumentType
.
Panics
Panics if the value is not DocumentType
, with a panic message including the content of self
.
sourcepub fn document_type(self) -> Option<DocumentType>
pub fn document_type(self) -> Option<DocumentType>
Returns Some
if self
is of variant DocumentType
, and None
otherwise.
sourcepub fn is_element(&self) -> bool
pub fn is_element(&self) -> bool
Returns true
if self
is of variant Element
.
sourcepub fn as_element(&self) -> Option<&Element>
pub fn as_element(&self) -> Option<&Element>
Returns Some
if self
is a reference of variant Element
, and None
otherwise.
sourcepub fn expect_element(self) -> Element where
Self: Debug,
pub fn expect_element(self) -> Element where
Self: Debug,
sourcepub fn element(self) -> Option<Element>
pub fn element(self) -> Option<Element>
Returns Some
if self
is of variant Element
, and None
otherwise.
sourcepub fn as_text(&self) -> Option<&Text>
pub fn as_text(&self) -> Option<&Text>
Returns Some
if self
is a reference of variant Text
, and None
otherwise.
sourcepub fn expect_text(self) -> Text where
Self: Debug,
pub fn expect_text(self) -> Text where
Self: Debug,
sourcepub fn is_comment(&self) -> bool
pub fn is_comment(&self) -> bool
Returns true
if self
is of variant Comment
.
sourcepub fn as_comment(&self) -> Option<&Comment>
pub fn as_comment(&self) -> Option<&Comment>
Returns Some
if self
is a reference of variant Comment
, and None
otherwise.
sourcepub fn expect_comment(self) -> Comment where
Self: Debug,
pub fn expect_comment(self) -> Comment where
Self: Debug,
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Child
impl<'de> Deserialize<'de> for Child
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl EqIgnoreSpan for Child
impl EqIgnoreSpan for Child
fn eq_ignore_span(&self, other: &Self) -> bool
sourceimpl From<DocumentType> for Child
impl From<DocumentType> for Child
sourcefn from(v: DocumentType) -> Self
fn from(v: DocumentType) -> Self
Converts to this type from the input type.
impl Eq for Child
impl StructuralEq for Child
impl StructuralPartialEq for Child
Auto Trait Implementations
impl RefUnwindSafe for Child
impl Send for Child
impl Sync for Child
impl Unpin for Child
impl UnwindSafe for Child
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more