Enum swc_xml_ast::Child
source · pub enum Child {
DocumentType(DocumentType),
Element(Element),
Text(Text),
CdataSection(CdataSection),
Comment(Comment),
ProcessingInstruction(ProcessingInstruction),
}
Variants§
DocumentType(DocumentType)
Element(Element)
Text(Text)
CdataSection(CdataSection)
Comment(Comment)
ProcessingInstruction(ProcessingInstruction)
Implementations§
source§impl Child
impl Child
sourcepub const fn is_document_type(&self) -> bool
pub const 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 const fn is_element(&self) -> bool
pub const 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 const fn is_cdata_section(&self) -> bool
pub const fn is_cdata_section(&self) -> bool
Returns true
if self
is of variant CdataSection
.
sourcepub fn as_cdata_section(&self) -> Option<&CdataSection>
pub fn as_cdata_section(&self) -> Option<&CdataSection>
Returns Some
if self
is a reference of variant CdataSection
, and None
otherwise.
sourcepub fn as_mut_cdata_section(&mut self) -> Option<&mut CdataSection>
pub fn as_mut_cdata_section(&mut self) -> Option<&mut CdataSection>
Returns Some
if self
is a mutable reference of variant CdataSection
, and None
otherwise.
sourcepub fn expect_cdata_section(self) -> CdataSectionwhere
Self: Debug,
pub fn expect_cdata_section(self) -> CdataSectionwhere
Self: Debug,
Unwraps the value, yielding the content of CdataSection
.
§Panics
Panics if the value is not CdataSection
, with a panic message including the content of self
.
sourcepub fn cdata_section(self) -> Option<CdataSection>
pub fn cdata_section(self) -> Option<CdataSection>
Returns Some
if self
is of variant CdataSection
, and None
otherwise.
sourcepub const fn is_comment(&self) -> bool
pub const 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 const fn is_processing_instruction(&self) -> bool
pub const 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.
Trait Implementations§
source§impl EqIgnoreSpan for Child
impl EqIgnoreSpan for Child
fn eq_ignore_span(&self, other: &Self) -> bool
source§impl From<CdataSection> for Child
impl From<CdataSection> for Child
source§fn from(v: CdataSection) -> Self
fn from(v: CdataSection) -> Self
source§impl From<DocumentType> for Child
impl From<DocumentType> for Child
source§fn from(v: DocumentType) -> Self
fn from(v: DocumentType) -> Self
source§impl From<ProcessingInstruction> for Child
impl From<ProcessingInstruction> for Child
source§fn from(v: ProcessingInstruction) -> Self
fn from(v: ProcessingInstruction) -> Self
source§impl PartialEq for Child
impl PartialEq for Child
impl Eq for Child
impl StructuralPartialEq for Child
Auto Trait Implementations§
impl Freeze for Child
impl RefUnwindSafe for Child
impl Send for Child
impl Sync for Child
impl Unpin for Child
impl UnwindSafe for Child
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§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>
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>
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