Slice

Struct Slice 

Source
pub struct Slice<'a, T>(/* private fields */);
Expand description

Initializes a slice by copying or cloning elements from a source slice.

This initializer is created by the slice() factory function or through the IntoInitPin trait for slice types.

Trait Implementations§

Source§

impl<'a, T: Debug> Debug for Slice<'a, T>

Source§

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

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

impl<T: Clone> Init<[T]> for Slice<'_, T>

Source§

fn init(self, place: Uninit<'_, [T]>) -> InitResult<'_, [T], SliceError>

Initializes a place with a value. Read more
Source§

fn and<F: FnOnce(&mut T)>(self, f: F) -> And<Self, F>

Chains a closure to execute after successful initialization. Read more
Source§

impl<T: Clone, const N: usize> Init<[T; N]> for Slice<'_, T>

Source§

fn init(self, place: Uninit<'_, [T; N]>) -> InitResult<'_, [T; N], SliceError>

Initializes a place with a value. Read more
Source§

fn and<F: FnOnce(&mut T)>(self, f: F) -> And<Self, F>

Chains a closure to execute after successful initialization. Read more
Source§

impl<T: Clone> InitPin<[T]> for Slice<'_, T>

Source§

fn init_pin<'a, 'b>( self, place: Uninit<'a, [T]>, slot: DropSlot<'a, 'b, [T]>, ) -> InitPinResult<'a, 'b, [T], SliceError>

Initializes a place with a pinned value. Read more
Source§

fn and_pin<F: FnOnce(Pin<&mut T>)>(self, f: F) -> AndPin<Self, F>

Chains a closure to execute after successful initialization with a pinned reference. Read more
Source§

fn or<M, I2>(self, other: I2) -> Or<Self, I2, M>
where I2: IntoInitPin<T, M, Error: Into<Self::Error>>,

Provides a fallback initializer if this one fails. Read more
Source§

fn or_else<F, I2>(self, f: F) -> OrElse<Self, F>
where F: FnOnce(Self::Error) -> I2, I2: InitPin<T, Error: Into<Self::Error>>,

Provides a fallback initializer based on the error from this one. Read more
Source§

fn unwrap_or<M, I2>(self, other: I2) -> UnwrapOr<Self, I2, M>
where I2: IntoInitPin<T, M, Error = Infallible>,

Provides a fallback initializer if the primary one fails. The fallback initializer must be infallible. Read more
Source§

fn unwrap_or_else<F, I2>(self, f: F) -> UnwrapOrElse<Self, F>
where F: FnOnce(Self::Error) -> I2, I2: InitPin<T, Error = Infallible>,

Provides a fallback initializer computed from the error of the primary one. The fallback initializer must be infallible. Read more
Source§

impl<T: Clone, const N: usize> InitPin<[T; N]> for Slice<'_, T>

Source§

fn init_pin<'a, 'b>( self, place: Uninit<'a, [T; N]>, slot: DropSlot<'a, 'b, [T; N]>, ) -> InitPinResult<'a, 'b, [T; N], SliceError>

Initializes a place with a pinned value. Read more
Source§

fn and_pin<F: FnOnce(Pin<&mut T>)>(self, f: F) -> AndPin<Self, F>

Chains a closure to execute after successful initialization with a pinned reference. Read more
Source§

fn or<M, I2>(self, other: I2) -> Or<Self, I2, M>
where I2: IntoInitPin<T, M, Error: Into<Self::Error>>,

Provides a fallback initializer if this one fails. Read more
Source§

fn or_else<F, I2>(self, f: F) -> OrElse<Self, F>
where F: FnOnce(Self::Error) -> I2, I2: InitPin<T, Error: Into<Self::Error>>,

Provides a fallback initializer based on the error from this one. Read more
Source§

fn unwrap_or<M, I2>(self, other: I2) -> UnwrapOr<Self, I2, M>
where I2: IntoInitPin<T, M, Error = Infallible>,

Provides a fallback initializer if the primary one fails. The fallback initializer must be infallible. Read more
Source§

fn unwrap_or_else<F, I2>(self, f: F) -> UnwrapOrElse<Self, F>
where F: FnOnce(Self::Error) -> I2, I2: InitPin<T, Error = Infallible>,

Provides a fallback initializer computed from the error of the primary one. The fallback initializer must be infallible. Read more
Source§

impl<T> Initializer for Slice<'_, T>

Source§

type Error = SliceError

The error type that can occur during initialization.
Source§

fn map_err<F, E2>(self, f: F) -> MapErr<Self, F>
where F: FnOnce(Self::Error) -> E2,

Maps the error type of the initializer using a closure. Read more
Source§

impl<'a, T: Clone> IntoInitPin<[T], Slice<'a, T>> for &'a [T]

Source§

type Init = Slice<'a, T>

Which kind of initializer this converts into?
Source§

type Error = SliceError

The error type that can occur during initialization.
Source§

fn into_init(self) -> Self::Init

Creates an initializer from this value.
Source§

impl<'a, T: Clone, const N: usize> IntoInitPin<[T; N], Slice<'a, T>> for &'a [T]

Source§

type Init = Slice<'a, T>

Which kind of initializer this converts into?
Source§

type Error = SliceError

The error type that can occur during initialization.
Source§

fn into_init(self) -> Self::Init

Creates an initializer from this value.
Source§

impl<'a, T: PartialEq> PartialEq for Slice<'a, T>

Source§

fn eq(&self, other: &Slice<'a, T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T> StructuralPartialEq for Slice<'a, T>

Auto Trait Implementations§

§

impl<'a, T> Freeze for Slice<'a, T>

§

impl<'a, T> RefUnwindSafe for Slice<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for Slice<'a, T>
where T: Sync,

§

impl<'a, T> Sync for Slice<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for Slice<'a, T>

§

impl<'a, T> UnwindSafe for Slice<'a, T>
where T: RefUnwindSafe,

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, I> IntoInitPin<T> for I
where I: InitPin<T>, T: ?Sized,

Source§

type Init = I

Which kind of initializer this converts into?
Source§

type Error = <I as Initializer>::Error

The error type that can occur during initialization.
Source§

fn into_init(self) -> <I as IntoInitPin<T>>::Init

Creates an initializer from this value.
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.