Trait TrustedItem

Source
pub unsafe trait TrustedItem<Array: TrustedContainer<Item = Self> + ?Sized> {
    type Unit;

    // Required methods
    fn vet<'id, I: Idx>(
        idx: I,
        container: &Container<'id, Array>,
    ) -> Result<Index<'id, I, Unknown>, IndexError>;
    fn after<'id, I: Idx>(
        this: Index<'id, I, NonEmpty>,
        container: &Container<'id, Array>,
    ) -> Index<'id, I, Unknown>;
    fn advance<'id, I: Idx>(
        this: Index<'id, I, NonEmpty>,
        container: &Container<'id, Array>,
    ) -> Option<Index<'id, I, NonEmpty>>;
}
Expand description

An item within a trusted container.

Required Associated Types§

Required Methods§

Source

fn vet<'id, I: Idx>( idx: I, container: &Container<'id, Array>, ) -> Result<Index<'id, I, Unknown>, IndexError>

Vet an index for being on item boundaries.

The index for the end of the container should pass. This function does not imply a nonempty proof.

Source

fn after<'id, I: Idx>( this: Index<'id, I, NonEmpty>, container: &Container<'id, Array>, ) -> Index<'id, I, Unknown>

Increment an index to the next item, potentially leaving the container.

Source

fn advance<'id, I: Idx>( this: Index<'id, I, NonEmpty>, container: &Container<'id, Array>, ) -> Option<Index<'id, I, NonEmpty>>

Advance an index to the next item, if a next item exists.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl TrustedItem<str> for Character

Source§

impl TrustedItem<String> for Character

Available on crate feature std only.
Source§

impl<T> TrustedItem<[T]> for T

Source§

type Unit = T

Source§

impl<T: TrustedItem<[T]>> TrustedItem<Vec<T>> for T

Available on crate feature std only.
Source§

impl<T: TrustedItem<Array> + ?Sized, Array: TrustedContainer<Item = T> + ?Sized> TrustedItem<&Array> for T

Source§

type Unit = <T as TrustedItem<Array>>::Unit

Source§

impl<T: TrustedItem<Array> + ?Sized, Array: TrustedContainer<Item = T> + ?Sized> TrustedItem<Box<Array>> for T

Available on crate feature std only.
Source§

type Unit = <T as TrustedItem<Array>>::Unit