pub struct Element {
pub name: String,
pub namespace: Option<String>,
pub attributes: IndexMap<String, String>,
pub children: Vec<Node>,
}
Expand description
XML Element
Fields§
§name: String
§namespace: Option<String>
§attributes: IndexMap<String, String>
§children: Vec<Node>
Implementations§
Source§impl Element
impl Element
pub fn new(name: impl Into<String>) -> Self
pub fn with_namespace(self, ns: impl Into<String>) -> Self
pub fn with_attr(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn with_text(self, text: impl Into<String>) -> Self
pub fn add_child(&mut self, child: Element)
pub fn add_text(&mut self, text: impl Into<String>)
Sourcepub fn add_comment(&mut self, comment: Comment)
pub fn add_comment(&mut self, comment: Comment)
Add a structured comment to this element
Sourcepub fn add_simple_comment(&mut self, comment: impl Into<String>)
pub fn add_simple_comment(&mut self, comment: impl Into<String>)
Add a simple comment (for backward compatibility)
Sourcepub fn with_comment(self, content: String, position: CommentPosition) -> Self
pub fn with_comment(self, content: String, position: CommentPosition) -> Self
Add a comment with a specific position
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Element
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnwindSafe for Element
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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