Skip to main content

OwnedSlice

Trait OwnedSlice 

Source
pub trait OwnedSlice {
    type Item;
    type Take: TakeOwnedSlice<Item = Self::Item>;

    // Required method
    fn into_take_owned_slice(self) -> Self::Take;
}
Expand description

A trait for objects that own a slice of elements.

For example [T; N], Vec<T>, Box<[T]> and vec::Drain<T>.

This trait is used for the parameter of alloc_slice_move, init_move, append and from_owned_slice_in.

Any implementor of TakeOwnedSlice automatically implements this trait.

Required Associated Types§

Source

type Item

The type of an element of this owned slice.

Source

type Take: TakeOwnedSlice<Item = Self::Item>

A type that Self can convert into that implements TakeOwnedSlice.

Required Methods§

Source

fn into_take_owned_slice(self) -> Self::Take

Converts this type into one that implements TakeOwnedSlice.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T, const N: usize> OwnedSlice for Box<[T; N]>

Available on crate feature alloc only.
Source§

impl<T, const N: usize> OwnedSlice for [T; N]

Implementors§

Source§

impl<'a, T, const N: usize> OwnedSlice for BumpBox<'a, [T; N]>

Source§

type Item = T

Source§

type Take = BumpBox<'a, [T]>

Source§

impl<T: TakeOwnedSlice> OwnedSlice for T