pub struct ASlice<T> { /* private fields */ }Expand description
A slice of stored AId<T>s inside a HtmlAllocator.
Implementations§
Source§impl<'a, T: AllocatorType> ASlice<T>
impl<'a, T: AllocatorType> ASlice<T>
pub fn len(&self) -> u32
pub fn iter_node( &self, allocator: &'a HtmlAllocator, ) -> ASliceNodeIterator<'a, T> ⓘ
pub fn iter_att(&self, allocator: &'a HtmlAllocator) -> ASliceAttIterator<'a, T> ⓘ
pub fn iter_aid(&self, allocator: &'a HtmlAllocator) -> ASliceAIdIterator<'a, T> ⓘ
pub fn try_filter_map<F: Fn(AId<T>) -> Result<Option<AId<T>>>>( &self, f: F, capacity: Option<u32>, allocator: &'a HtmlAllocator, ) -> Result<AVec<'a, T>>
Sourcepub fn split_when<F: Fn(AId<T>) -> bool>(
&self,
f: F,
allocator: &'a HtmlAllocator,
) -> Option<(ASlice<T>, ASlice<T>)>
pub fn split_when<F: Fn(AId<T>) -> bool>( &self, f: F, allocator: &'a HtmlAllocator, ) -> Option<(ASlice<T>, ASlice<T>)>
Split the slice before the first element for which f returns true.
Sourcepub fn split_at(&self, i: u32) -> Option<(ASlice<T>, ASlice<T>)>
pub fn split_at(&self, i: u32) -> Option<(ASlice<T>, ASlice<T>)>
Split the slice at position i, if that is within the slice.
Sourcepub fn first_and_rest(
&self,
allocator: &'a HtmlAllocator,
) -> Option<(AId<T>, ASlice<T>)>
pub fn first_and_rest( &self, allocator: &'a HtmlAllocator, ) -> Option<(AId<T>, ASlice<T>)>
The first element and the rest, unless the slice is empty.
pub fn get(&self, i: u32, allocator: &'a HtmlAllocator) -> Option<AId<T>>
Source§impl<'a> ASlice<Node>
impl<'a> ASlice<Node>
Sourcepub fn unwrap_element_opt(
&self,
meta: &ElementMeta,
strict: bool,
allocator: &'a HtmlAllocator,
) -> Option<ASlice<Node>>
pub fn unwrap_element_opt( &self, meta: &ElementMeta, strict: bool, allocator: &'a HtmlAllocator, ) -> Option<ASlice<Node>>
If this slice contains only one element of kind meta (and
that element has no attributes, if strict is true), returns
that element’s body slice.
Sourcepub fn unwrap_element(
&self,
meta: &ElementMeta,
strict: bool,
allocator: &'a HtmlAllocator,
) -> ASlice<Node>
pub fn unwrap_element( &self, meta: &ElementMeta, strict: bool, allocator: &'a HtmlAllocator, ) -> ASlice<Node>
If this slice contains only one element of kind meta (and
that element has no attributes, if strict is true), returns
that element’s body slice, otherwise itself.
Sourcepub fn unwrap_elements(
&self,
meta: &ElementMeta,
strict: bool,
allocator: &'a HtmlAllocator,
) -> Result<ASlice<Node>>
pub fn unwrap_elements( &self, meta: &ElementMeta, strict: bool, allocator: &'a HtmlAllocator, ) -> Result<ASlice<Node>>
Unwrap even if there are multiple elements, unwrap all of
those matching meta.
Source§impl<'a, T: AllocatorType> ASlice<T>
impl<'a, T: AllocatorType> ASlice<T>
Trait Implementations§
Source§impl<T: AllocatorType> Print for ASlice<T>
impl<T: AllocatorType> Print for ASlice<T>
Source§fn print_html_fragment(
&self,
out: &mut impl Write,
allocator: &HtmlAllocator,
) -> Result<()>
fn print_html_fragment( &self, out: &mut impl Write, allocator: &HtmlAllocator, ) -> Result<()>
Print serialized HTML.
Source§fn print_plain(&self, out: &mut String, allocator: &HtmlAllocator) -> Result<()>
fn print_plain(&self, out: &mut String, allocator: &HtmlAllocator) -> Result<()>
Print plain text, completely ignoring HTML markup. Can
currently only give an error if encountering preserialized
HTML.
fn to_html_fragment_string(&self, allocator: &HtmlAllocator) -> Result<String>
fn to_plain_string(&self, allocator: &HtmlAllocator) -> Result<String>
impl<T> Copy for ASlice<T>
Auto Trait Implementations§
impl<T> Freeze for ASlice<T>
impl<T> RefUnwindSafe for ASlice<T>
impl<T> Send for ASlice<T>
impl<T> Sync for ASlice<T>
impl<T> Unpin for ASlice<T>
impl<T> UnwindSafe for ASlice<T>
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