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) -> DocumentTypewhere
Self: Debug,
pub fn expect_document_type(self) -> DocumentTypewhere
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) -> Elementwhere
Self: Debug,
pub fn expect_element(self) -> Elementwhere
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) -> Textwhere
Self: Debug,
pub fn expect_text(self) -> Textwhere
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) -> Commentwhere
Self: Debug,
pub fn expect_comment(self) -> Commentwhere
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) -> ProcessingInstructionwhere
Self: Debug,
pub fn expect_processing_instruction(self) -> ProcessingInstructionwhere
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.