Enum swc_xml_ast::Child
source · [−]pub enum Child {
DocumentType(DocumentType),
Element(Element),
Text(Text),
Comment(Comment),
ProcessingInstruction(ProcessingInstruction),
}
Variants
DocumentType(DocumentType)
Element(Element)
Text(Text)
Comment(Comment)
ProcessingInstruction(ProcessingInstruction)
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 as_mut_document_type(&mut self) -> Option<&mut DocumentType>
pub fn as_mut_document_type(&mut self) -> Option<&mut DocumentType>
Returns Some
if self
is a mutable 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 as_mut_element(&mut self) -> Option<&mut Element>
pub fn as_mut_element(&mut self) -> Option<&mut Element>
Returns Some
if self
is a mutable 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 as_mut_text(&mut self) -> Option<&mut Text>
pub fn as_mut_text(&mut self) -> Option<&mut Text>
Returns Some
if self
is a mutable 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 as_mut_comment(&mut self) -> Option<&mut Comment>
pub fn as_mut_comment(&mut self) -> Option<&mut Comment>
Returns Some
if self
is a mutable 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,
sourcepub fn comment(self) -> Option<Comment>
pub fn comment(self) -> Option<Comment>
Returns Some
if self
is of variant Comment
, and None
otherwise.
sourcepub fn is_processing_instruction(&self) -> bool
pub fn is_processing_instruction(&self) -> bool
Returns true
if self
is of variant ProcessingInstruction
.
sourcepub fn as_processing_instruction(&self) -> Option<&ProcessingInstruction>
pub fn as_processing_instruction(&self) -> Option<&ProcessingInstruction>
Returns Some
if self
is a reference of variant ProcessingInstruction
, and None
otherwise.
sourcepub fn as_mut_processing_instruction(
&mut self
) -> Option<&mut ProcessingInstruction>
pub fn as_mut_processing_instruction(
&mut self
) -> Option<&mut ProcessingInstruction>
Returns Some
if self
is a mutable reference of variant ProcessingInstruction
, and None
otherwise.
sourcepub fn expect_processing_instruction(self) -> ProcessingInstruction where
Self: Debug,
pub fn expect_processing_instruction(self) -> ProcessingInstruction where
Self: Debug,
Unwraps the value, yielding the content of ProcessingInstruction
.
Panics
Panics if the value is not ProcessingInstruction
, with a panic message including the content of self
.
sourcepub fn processing_instruction(self) -> Option<ProcessingInstruction>
pub fn processing_instruction(self) -> Option<ProcessingInstruction>
Returns Some
if self
is of variant ProcessingInstruction
, and None
otherwise.
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.
sourceimpl From<ProcessingInstruction> for Child
impl From<ProcessingInstruction> for Child
sourcefn from(v: ProcessingInstruction) -> Self
fn from(v: ProcessingInstruction) -> 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> 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