pub struct TagBuilder<'a> { /* private fields */ }Expand description
Utility for servers to build custom opening tags.
§Examples
let mut builder = mxp::node::TagBuilder::new("monster");
builder
.push("hostile")
.push_all(&["Minotaur", "old veteran"])
.insert("hp", "150");
let tag = builder.build();
assert_eq!(
tag.to_string(),
r#"<monster hostile Minotaur "old veteran" hp=150>"#
);Implementations§
Source§impl<'a> TagBuilder<'a>
A server-side utility for building opening tags.
impl<'a> TagBuilder<'a>
A server-side utility for building opening tags.
Sourcepub fn new(name: &'a str) -> Self
pub fn new(name: &'a str) -> Self
Creates a builder for an opening tag with the specified element name.
Sourcepub fn build(self) -> TagOpen<'a, Cow<'a, str>>
pub fn build(self) -> TagOpen<'a, Cow<'a, str>>
Converts this builder into a finalized TagOpen.
Sourcepub fn push(&mut self, value: &'a str) -> &mut Self
pub fn push(&mut self, value: &'a str) -> &mut Self
Adds a positional argument or keyword without escaping special characters.
Sourcepub fn escape_and_push(&mut self, value: &'a str) -> &mut Self
pub fn escape_and_push(&mut self, value: &'a str) -> &mut Self
Adds a positional argument or keyword after escaping special characters.
Sourcepub fn push_all<I>(&mut self, iter: I) -> &mut Self
pub fn push_all<I>(&mut self, iter: I) -> &mut Self
Adds multiple positional arguments or keywords without escaping special characters.
Sourcepub fn escape_and_push_all<I>(&mut self, iter: I) -> &mut Self
pub fn escape_and_push_all<I>(&mut self, iter: I) -> &mut Self
Adds multiple positional arguments or keywords after escaping special characters.
Sourcepub fn insert(&mut self, name: &'a str, value: &'a str) -> &mut Self
pub fn insert(&mut self, name: &'a str, value: &'a str) -> &mut Self
Inserts a named argument without escaping special characters.
Sourcepub fn escape_and_insert(&mut self, name: &'a str, value: &'a str) -> &mut Self
pub fn escape_and_insert(&mut self, name: &'a str, value: &'a str) -> &mut Self
Inserts a named argument after escaping special characters.
Sourcepub fn insert_all<I, K, V>(&mut self, iter: I) -> &mut Self
pub fn insert_all<I, K, V>(&mut self, iter: I) -> &mut Self
Inserts multiple named arguments without escaping special characters.
Sourcepub fn escape_and_insert_all<I, K, V>(&mut self, iter: I) -> &mut Self
pub fn escape_and_insert_all<I, K, V>(&mut self, iter: I) -> &mut Self
Inserts multiple named arguments after escaping special characters.
Trait Implementations§
Source§impl<'a> Clone for TagBuilder<'a>
impl<'a> Clone for TagBuilder<'a>
Source§fn clone(&self) -> TagBuilder<'a>
fn clone(&self) -> TagBuilder<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more