Skip to main content

SliceSurrogate

Struct SliceSurrogate 

Source
pub struct SliceSurrogate<T>(/* private fields */);
Expand description

A borrowed sequence of runtime values.

Implementations§

Source§

impl<T> SliceSurrogate<T>

Source

pub fn len(&self) -> UsizeSurrogate

Source

pub fn is_empty(&self) -> BoolSurrogate

Source

pub fn get(&self, index: UsizeSurrogate) -> OptionSurrogate<&T>

Source

pub fn index<'a>( &'a self, index: UsizeSurrogate, ) -> <&'a T as Surrogated>::Surrogate

Borrows the element at index.

§Panics

Panics if index is out of bounds.

Source

pub fn first(&self) -> OptionSurrogate<&T>

Source

pub fn last(&self) -> OptionSurrogate<&T>

Source§

impl<T: Clone> SliceSurrogate<T>

Source

pub fn to_vec(&self) -> VecSurrogate<T>

Source

pub fn to_owned(&self) -> VecSurrogate<T>

Trait Implementations§

Source§

impl<T: Debug> Debug for SliceSurrogate<T>

Source§

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

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

impl<T> RefCast for SliceSurrogate<T>

Source§

type From = [T]

Source§

fn ref_cast(_from: &Self::From) -> &Self

Source§

fn ref_cast_mut(_from: &mut Self::From) -> &mut Self

Source§

impl<T> Serialize for SliceSurrogate<T>
where for<'a> &'a T: Surrogated, for<'a> <&'a T as Surrogated>::Surrogate: Serialize,

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<'__lifetime, T> Surrogate for &'__lifetime SliceSurrogate<T>

Source§

type Real = &'__lifetime [T]

Source§

fn into_real(self) -> Self::Real

Source§

impl<'__lifetime, T> Surrogate for &'__lifetime mut SliceSurrogate<T>

Source§

type Real = &'__lifetime mut [T]

Source§

fn into_real(self) -> Self::Real

Auto Trait Implementations§

§

impl<T> !Sized for SliceSurrogate<T>

§

impl<T> Freeze for SliceSurrogate<T>
where [T]: Freeze,

§

impl<T> RefUnwindSafe for SliceSurrogate<T>

§

impl<T> Send for SliceSurrogate<T>
where [T]: Send,

§

impl<T> Sync for SliceSurrogate<T>
where [T]: Sync,

§

impl<T> Unpin for SliceSurrogate<T>
where [T]: Unpin,

§

impl<T> UnsafeUnpin for SliceSurrogate<T>

§

impl<T> UnwindSafe for SliceSurrogate<T>
where [T]: UnwindSafe,

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