Struct HtmlAllocator

Source
pub struct HtmlAllocator { /* private fields */ }

Implementations§

Source§

impl HtmlAllocator

Source

pub fn new_with_metadb( max_allocations: u32, metadb: Option<&'static MetaDb>, context: Context, ) -> Self

max_allocations: how many node (text, elements, empty nodes) and attribute allocations in total are allowed before out of memory errors are being returned for allocations (i.e. when creating new elements, attributes, or pushing to an AVec). metadb: if given, HTML structure is verified during element allocation.

Source

pub fn clear(&mut self)

Source

pub fn regionid(&self) -> RegionId

Source

pub fn assert_regionid(&self, rid: RegionId)

Source

pub fn get_node<'a>(&'a self, id: AId<Node>) -> Option<&'a Node>

Source

pub fn get_att<'a>( &'a self, id: AId<(KString, KString)>, ) -> Option<&'a (KString, KString)>

Source

pub fn get_id<T: AllocatorType>(&self, id_bare: u32) -> Option<AId<T>>

Source

pub fn new_vec<'a, T: AllocatorType>(&'a self) -> AVec<'a, T>

Source

pub fn new_vec_with_capacity<'a, T: AllocatorType>( &'a self, capacity: u32, ) -> Result<AVec<'a, T>>

Source

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.

Source

pub fn allocate_element(&self, elt: Element) -> Result<AId<Node>>

Source

pub fn empty_node(&self) -> Result<AId<Node>>

Source

pub fn new_attribute( &self, att: (KString, KString), ) -> Result<AId<(KString, KString)>>

Source

pub fn attribute<K, V>(&self, key: K, val: V) -> Result<AId<(KString, KString)>>
where KString: MyFrom<K> + MyFrom<V>,

Source

pub fn preserialized(&self, val: SerHtmlFrag) -> Result<AId<Node>>

Source

pub fn staticstr(&self, s: &'static str) -> Result<AId<Node>>

Source

pub fn str(&self, s: &str) -> Result<AId<Node>>

Source

pub fn text<T>(&self, s: T) -> Result<AId<Node>>
where KString: MyFrom<T>,

Create a text node (i.e. put the given string into the allocator, return the id to it)

Source

pub fn text_slice<T>(&self, s: T) -> Result<ASlice<Node>>
where KString: MyFrom<T>,

Like text but returns an ASlice containing the single text node, for contexts that expect a slice (i.e. any number of nodes).

Source

pub fn string(&self, s: String) -> Result<AId<Node>>

Source

pub fn opt_string(&self, s: Option<String>) -> Result<AId<Node>>

Source

pub fn kstring(&self, s: KString) -> Result<AId<Node>>

Source

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.

Source

pub fn nbsp(&self) -> Result<AId<Node>>

A text node with just a non-breaking space.

Source

pub fn empty_slice<T>(&self) -> ASlice<T>

Source§

impl HtmlAllocator

Source

pub fn new(max_allocations: u32, context: Context) -> Self

Source§

impl HtmlAllocator

Source

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.

Source

pub fn print_html_fragment( &self, id_: AId<Node>, out: &mut impl Write, ) -> Result<()>

Source

pub fn print_html_document( &self, id_: AId<Node>, out: &mut impl Write, ) -> Result<()>

Source

pub fn to_html_string(&self, id: AId<Node>, want_doctype: bool) -> String

Source

pub fn preserialize(&self, id: AId<Node>) -> Result<SerHtmlFrag>

Returns an error if id doesn’t refer to an Element Node.

Source

pub fn print_plain(&self, id: AId<Node>, out: &mut String) -> Result<()>

Source

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.

Source

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.

Source§

impl HtmlAllocator

Source

pub fn a( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn abbr( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn address( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn area( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn article( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn aside( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn audio( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn b( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn base( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn bdi( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn bdo( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn blockquote( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn body( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn br( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn button( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn canvas( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn caption( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn cite( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn code( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn col( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn colgroup( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn data( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn datalist( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn dd( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn del( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn details( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn dfn( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn dialog( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn div( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn dl( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn dt( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn em( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn embed( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn fieldset( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn figcaption( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn figure( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn footer( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn form( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn h1( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn h2( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn h3( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn h4( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn h5( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn h6( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn head( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn header( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn hgroup( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn hr( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn html( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn i( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn iframe( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn img( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn input( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn ins( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn kbd( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn label( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn legend( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn li( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn main( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn map( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn mark( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn menu( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn meta( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn meter( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn nav( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn noscript( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn object( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn ol( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn optgroup( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn option( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn output( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn p( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn picture( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn pre( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn progress( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn q( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn rp( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn rt( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn ruby( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn s( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn samp( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn script( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn search( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn section( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn select( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn slot( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn small( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn source( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn span( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn strong( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn style( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn sub( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn summary( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn sup( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn table( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn tbody( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn td( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn template( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn textarea( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn tfoot( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn th( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn thead( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn time( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn title( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn tr( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn track( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn u( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn ul( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn var( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn video( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Source

pub fn wbr( &self, attr: impl ToASlice<(KString, KString)>, body: impl ToASlice<Node>, ) -> Result<AId<Node>>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoArc<T> for T

Source§

fn into_arc(self) -> Arc<T>

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.