pub struct HtmlAllocatorGuard<'p> { /* private fields */ }Methods from Deref<Target = HtmlAllocator>§
pub fn regionid(&self) -> RegionId
pub fn assert_regionid(&self, rid: RegionId)
pub fn get_node<'a>(&'a self, id: AId<Node>) -> Option<&'a Node>
pub fn get_att<'a>( &'a self, id: AId<(KString, KString)>, ) -> Option<&'a (KString, KString)>
pub fn get_id<T: AllocatorType>(&self, id_bare: u32) -> Option<AId<T>>
pub fn new_vec<'a, T: AllocatorType>(&'a self) -> AVec<'a, T>
pub fn new_vec_with_capacity<'a, T: AllocatorType>( &'a self, capacity: u32, ) -> Result<AVec<'a, T>>
Sourcepub fn new_element(
&self,
meta: &'static ElementMeta,
attr: ASlice<(KString, KString)>,
body: ASlice<Node>,
) -> Result<AId<Node>>
pub fn new_element( &self, meta: &'static ElementMeta, attr: ASlice<(KString, KString)>, body: ASlice<Node>, ) -> Result<AId<Node>>
But also see element method for more comfort.
pub fn allocate_element(&self, elt: Element) -> Result<AId<Node>>
pub fn empty_node(&self) -> Result<AId<Node>>
pub fn new_attribute( &self, att: (KString, KString), ) -> Result<AId<(KString, KString)>>
pub fn attribute<K, V>(&self, key: K, val: V) -> Result<AId<(KString, KString)>>
pub fn preserialized(&self, val: SerHtmlFrag) -> Result<AId<Node>>
pub fn staticstr(&self, s: &'static str) -> Result<AId<Node>>
pub fn str(&self, s: &str) -> Result<AId<Node>>
Sourcepub fn text<T>(&self, s: T) -> Result<AId<Node>>
pub fn text<T>(&self, s: T) -> Result<AId<Node>>
Create a text node (i.e. put the given string into the allocator, return the id to it)
Sourcepub fn text_slice<T>(&self, s: T) -> Result<ASlice<Node>>
pub fn text_slice<T>(&self, s: T) -> Result<ASlice<Node>>
Like text but returns an ASlice containing the single text
node, for contexts that expect a slice (i.e. any number of
nodes).
pub fn string(&self, s: String) -> Result<AId<Node>>
pub fn opt_string(&self, s: Option<String>) -> Result<AId<Node>>
pub fn kstring(&self, s: KString) -> Result<AId<Node>>
Sourcepub fn element(
&self,
meta: &'static ElementMeta,
attr: impl ToASlice<(KString, KString)>,
body: impl ToASlice<Node>,
) -> Result<AId<Node>>
pub fn element( &self, meta: &'static ElementMeta, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>
Create an element from normal slices or arrays, for nice to use syntax.
pub fn empty_slice<T>(&self) -> ASlice<T>
Sourcepub fn html_escape(&self, bytes: &[u8]) -> RefMut<'_, Vec<u8>>
pub fn html_escape(&self, bytes: &[u8]) -> RefMut<'_, Vec<u8>>
bytes must represent proper UTF-8,
e.g. string.as_bytes(). The resulting reference must be
dropped before calling html_escape again, or there will be a
panic.
pub fn print_html_fragment( &self, id_: AId<Node>, out: &mut impl Write, ) -> Result<()>
pub fn print_html_document( &self, id_: AId<Node>, out: &mut impl Write, ) -> Result<()>
pub fn to_html_string(&self, id: AId<Node>, want_doctype: bool) -> String
Sourcepub fn preserialize(&self, id: AId<Node>) -> Result<SerHtmlFrag>
pub fn preserialize(&self, id: AId<Node>) -> Result<SerHtmlFrag>
Returns an error if id doesn’t refer to an Element Node.
pub fn print_plain(&self, id: AId<Node>, out: &mut String) -> Result<()>
Sourcepub fn to_plain_string(&self, id: AId<Node>) -> Result<KString>
pub fn to_plain_string(&self, id: AId<Node>) -> Result<KString>
If you need this to strip html and use the result as AId, be
sure to use to_plain_string_aid instead, as that optimizes
the case of id already representing a string.
Sourcepub fn to_plain_string_aid(&self, id: AId<Node>) -> Result<AId<Node>>
pub fn to_plain_string_aid(&self, id: AId<Node>) -> Result<AId<Node>>
Like to_plain_string but returns a string node (or empty
node if the input is empty) and optimizes (and silences) the
case where id already represents a string.