Struct ASlice

Source
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>

Source

pub fn len(&self) -> u32

Source

pub fn iter_node( &self, allocator: &'a HtmlAllocator, ) -> ASliceNodeIterator<'a, T>

Source

pub fn iter_att(&self, allocator: &'a HtmlAllocator) -> ASliceAttIterator<'a, T>

Source

pub fn iter_aid(&self, allocator: &'a HtmlAllocator) -> ASliceAIdIterator<'a, T>

Source

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>>

Source

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.

Source

pub fn split_at(&self, i: u32) -> Option<(ASlice<T>, ASlice<T>)>

Split the slice at position i, if that is within the slice.

Source

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.

Source

pub fn get(&self, i: u32, allocator: &'a HtmlAllocator) -> Option<AId<T>>

Source§

impl<'a> ASlice<Node>

Source

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.

Source

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.

Source

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>

Source

pub fn try_flat_map<F: Fn(AId<T>) -> Result<Flat<T>>>( &self, f: F, capacity: Option<u32>, allocator: &'a HtmlAllocator, ) -> Result<AVec<'a, T>>

Trait Implementations§

Source§

impl<T> Clone for ASlice<T>

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for ASlice<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: AllocatorType> Print for ASlice<T>

Source§

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<()>

Print plain text, completely ignoring HTML markup. Can currently only give an error if encountering preserialized HTML.
Source§

fn to_html_fragment_string(&self, allocator: &HtmlAllocator) -> Result<String>

Source§

fn to_plain_string(&self, allocator: &HtmlAllocator) -> Result<String>

Source§

impl<T> ToASlice<T> for &ASlice<T>

Source§

fn to_aslice(self, _allocator: &HtmlAllocator) -> Result<ASlice<T>>

Source§

impl<T> ToASlice<T> for ASlice<T>

Source§

fn to_aslice(self, _allocator: &HtmlAllocator) -> Result<ASlice<T>>

Source§

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> 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.