Skip to main content

Clamp

Struct Clamp 

Source
pub struct Clamp<Idx>(pub Idx);
๐Ÿ”ฌThis is a nightly-only experimental API. (sliceindex_wrappers)
Expand description

Clamps an index, guaranteeing that it will only access valid elements of the slice.

ยงExamples

#![feature(sliceindex_wrappers)]

use core::index::Clamp;

let s: &[usize] = &[0, 1, 2, 3];

assert_eq!(&3, &s[Clamp(6)]);
assert_eq!(&[1, 2, 3], &s[Clamp(1..6)]);
assert_eq!(&[] as &[usize], &s[Clamp(5..6)]);
assert_eq!(&[0, 1, 2, 3], &s[Clamp(..6)]);
assert_eq!(&[0, 1, 2, 3], &s[Clamp(..=6)]);
assert_eq!(&[] as &[usize], &s[Clamp(6..)]);

Tuple Fieldsยง

ยง0: Idx
๐Ÿ”ฌThis is a nightly-only experimental API. (sliceindex_wrappers)

Trait Implementationsยง

Sourceยง

impl<Idx> Debug for Clamp<Idx>
where Idx: Debug,

Sourceยง

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

Formats the value using the given formatter. Read more
Sourceยง

impl<T> SliceIndex<[T]> for Clamp<Range<usize>>

Sourceยง

type Output = [T]

The output type returned by methods.
Sourceยง

fn get( self, slice: &[T], ) -> Option<&<Clamp<Range<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Sourceยง

fn get_mut( self, slice: &mut [T], ) -> Option<&mut <Clamp<Range<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Sourceยง

unsafe fn get_unchecked( self, slice: *const [T], ) -> *const <Clamp<Range<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

unsafe fn get_unchecked_mut( self, slice: *mut [T], ) -> *mut <Clamp<Range<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

fn index(self, slice: &[T]) -> &<Clamp<Range<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Sourceยง

fn index_mut( self, slice: &mut [T], ) -> &mut <Clamp<Range<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.
Sourceยง

impl<T> SliceIndex<[T]> for Clamp<Range<usize>>

Sourceยง

type Output = [T]

The output type returned by methods.
Sourceยง

fn get( self, slice: &[T], ) -> Option<&<Clamp<Range<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Sourceยง

fn get_mut( self, slice: &mut [T], ) -> Option<&mut <Clamp<Range<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Sourceยง

unsafe fn get_unchecked( self, slice: *const [T], ) -> *const <Clamp<Range<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

unsafe fn get_unchecked_mut( self, slice: *mut [T], ) -> *mut <Clamp<Range<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

fn index(self, slice: &[T]) -> &<Clamp<Range<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Sourceยง

fn index_mut( self, slice: &mut [T], ) -> &mut <Clamp<Range<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.
Sourceยง

impl<T> SliceIndex<[T]> for Clamp<RangeFrom<usize>>

Sourceยง

type Output = [T]

The output type returned by methods.
Sourceยง

fn get( self, slice: &[T], ) -> Option<&<Clamp<RangeFrom<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Sourceยง

fn get_mut( self, slice: &mut [T], ) -> Option<&mut <Clamp<RangeFrom<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Sourceยง

unsafe fn get_unchecked( self, slice: *const [T], ) -> *const <Clamp<RangeFrom<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

unsafe fn get_unchecked_mut( self, slice: *mut [T], ) -> *mut <Clamp<RangeFrom<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

fn index( self, slice: &[T], ) -> &<Clamp<RangeFrom<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Sourceยง

fn index_mut( self, slice: &mut [T], ) -> &mut <Clamp<RangeFrom<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.
Sourceยง

impl<T> SliceIndex<[T]> for Clamp<RangeFrom<usize>>

Sourceยง

type Output = [T]

The output type returned by methods.
Sourceยง

fn get( self, slice: &[T], ) -> Option<&<Clamp<RangeFrom<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Sourceยง

fn get_mut( self, slice: &mut [T], ) -> Option<&mut <Clamp<RangeFrom<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Sourceยง

unsafe fn get_unchecked( self, slice: *const [T], ) -> *const <Clamp<RangeFrom<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

unsafe fn get_unchecked_mut( self, slice: *mut [T], ) -> *mut <Clamp<RangeFrom<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

fn index( self, slice: &[T], ) -> &<Clamp<RangeFrom<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Sourceยง

fn index_mut( self, slice: &mut [T], ) -> &mut <Clamp<RangeFrom<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.
Sourceยง

impl<T> SliceIndex<[T]> for Clamp<RangeFull>

Sourceยง

type Output = [T]

The output type returned by methods.
Sourceยง

fn get( self, slice: &[T], ) -> Option<&<Clamp<RangeFull> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Sourceยง

fn get_mut( self, slice: &mut [T], ) -> Option<&mut <Clamp<RangeFull> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Sourceยง

unsafe fn get_unchecked( self, slice: *const [T], ) -> *const <Clamp<RangeFull> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

unsafe fn get_unchecked_mut( self, slice: *mut [T], ) -> *mut <Clamp<RangeFull> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

fn index(self, slice: &[T]) -> &<Clamp<RangeFull> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Sourceยง

fn index_mut( self, slice: &mut [T], ) -> &mut <Clamp<RangeFull> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.
Sourceยง

impl<T> SliceIndex<[T]> for Clamp<RangeInclusive<usize>>

Sourceยง

type Output = [T]

The output type returned by methods.
Sourceยง

fn get( self, slice: &[T], ) -> Option<&<Clamp<RangeInclusive<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Sourceยง

fn get_mut( self, slice: &mut [T], ) -> Option<&mut <Clamp<RangeInclusive<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Sourceยง

unsafe fn get_unchecked( self, slice: *const [T], ) -> *const <Clamp<RangeInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

unsafe fn get_unchecked_mut( self, slice: *mut [T], ) -> *mut <Clamp<RangeInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

fn index( self, slice: &[T], ) -> &<Clamp<RangeInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Sourceยง

fn index_mut( self, slice: &mut [T], ) -> &mut <Clamp<RangeInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.
Sourceยง

impl<T> SliceIndex<[T]> for Clamp<RangeInclusive<usize>>

Sourceยง

type Output = [T]

The output type returned by methods.
Sourceยง

fn get( self, slice: &[T], ) -> Option<&<Clamp<RangeInclusive<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Sourceยง

fn get_mut( self, slice: &mut [T], ) -> Option<&mut <Clamp<RangeInclusive<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Sourceยง

unsafe fn get_unchecked( self, slice: *const [T], ) -> *const <Clamp<RangeInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

unsafe fn get_unchecked_mut( self, slice: *mut [T], ) -> *mut <Clamp<RangeInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

fn index( self, slice: &[T], ) -> &<Clamp<RangeInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Sourceยง

fn index_mut( self, slice: &mut [T], ) -> &mut <Clamp<RangeInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.
Sourceยง

impl<T> SliceIndex<[T]> for Clamp<RangeTo<usize>>

Sourceยง

type Output = [T]

The output type returned by methods.
Sourceยง

fn get( self, slice: &[T], ) -> Option<&<Clamp<RangeTo<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Sourceยง

fn get_mut( self, slice: &mut [T], ) -> Option<&mut <Clamp<RangeTo<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Sourceยง

unsafe fn get_unchecked( self, slice: *const [T], ) -> *const <Clamp<RangeTo<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

unsafe fn get_unchecked_mut( self, slice: *mut [T], ) -> *mut <Clamp<RangeTo<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

fn index( self, slice: &[T], ) -> &<Clamp<RangeTo<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Sourceยง

fn index_mut( self, slice: &mut [T], ) -> &mut <Clamp<RangeTo<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.
Sourceยง

impl<T> SliceIndex<[T]> for Clamp<RangeToInclusive<usize>>

Sourceยง

type Output = [T]

The output type returned by methods.
Sourceยง

fn get( self, slice: &[T], ) -> Option<&<Clamp<RangeToInclusive<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Sourceยง

fn get_mut( self, slice: &mut [T], ) -> Option<&mut <Clamp<RangeToInclusive<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Sourceยง

unsafe fn get_unchecked( self, slice: *const [T], ) -> *const <Clamp<RangeToInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

unsafe fn get_unchecked_mut( self, slice: *mut [T], ) -> *mut <Clamp<RangeToInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

fn index( self, slice: &[T], ) -> &<Clamp<RangeToInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Sourceยง

fn index_mut( self, slice: &mut [T], ) -> &mut <Clamp<RangeToInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.
Sourceยง

impl<T> SliceIndex<[T]> for Clamp<RangeToInclusive<usize>>

Sourceยง

type Output = [T]

The output type returned by methods.
Sourceยง

fn get( self, slice: &[T], ) -> Option<&<Clamp<RangeToInclusive<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Sourceยง

fn get_mut( self, slice: &mut [T], ) -> Option<&mut <Clamp<RangeToInclusive<usize>> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Sourceยง

unsafe fn get_unchecked( self, slice: *const [T], ) -> *const <Clamp<RangeToInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

unsafe fn get_unchecked_mut( self, slice: *mut [T], ) -> *mut <Clamp<RangeToInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

fn index( self, slice: &[T], ) -> &<Clamp<RangeToInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Sourceยง

fn index_mut( self, slice: &mut [T], ) -> &mut <Clamp<RangeToInclusive<usize>> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.
Sourceยง

impl<T> SliceIndex<[T]> for Clamp<usize>

Sourceยง

type Output = T

The output type returned by methods.
Sourceยง

fn get(self, slice: &[T]) -> Option<&<Clamp<usize> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, if in bounds.
Sourceยง

fn get_mut( self, slice: &mut [T], ) -> Option<&mut <Clamp<usize> as SliceIndex<[T]>>::Output>

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, if in bounds.
Sourceยง

unsafe fn get_unchecked( self, slice: *const [T], ) -> *const <Clamp<usize> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

unsafe fn get_unchecked_mut( self, slice: *mut [T], ) -> *mut <Clamp<usize> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable pointer to the output at this location, without performing any bounds checking. Read more
Sourceยง

fn index(self, slice: &[T]) -> &<Clamp<usize> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a shared reference to the output at this location, panicking if out of bounds.
Sourceยง

fn index_mut( self, slice: &mut [T], ) -> &mut <Clamp<usize> as SliceIndex<[T]>>::Output

๐Ÿ”ฌThis is a nightly-only experimental API. (slice_index_methods)
Returns a mutable reference to the output at this location, panicking if out of bounds.

Auto Trait Implementationsยง

ยง

impl<Idx> Freeze for Clamp<Idx>
where Idx: Freeze,

ยง

impl<Idx> RefUnwindSafe for Clamp<Idx>
where Idx: RefUnwindSafe,

ยง

impl<Idx> Send for Clamp<Idx>
where Idx: Send,

ยง

impl<Idx> Sync for Clamp<Idx>
where Idx: Sync,

ยง

impl<Idx> Unpin for Clamp<Idx>
where Idx: Unpin,

ยง

impl<Idx> UnsafeUnpin for Clamp<Idx>
where Idx: UnsafeUnpin,

ยง

impl<Idx> UnwindSafe for Clamp<Idx>
where Idx: 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
Sourceยง

impl<T> DebugExt<T> for T
where T: Debug,

Sourceยง

impl<T> Downcast for T
where T: Any,

Sourceยง

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Sourceยง

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Sourceยง

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Anyโ€™s vtable from &Traitโ€™s.
Sourceยง

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Anyโ€™s vtable from &mut Traitโ€™s.
Sourceยง

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Sourceยง

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync> โ“˜

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Sourceยง

impl<A> DynCastExt for A

Sourceยง

fn dyn_cast<T>( self, ) -> Result<<A as DynCastExtHelper<T>>::Target, <A as DynCastExtHelper<T>>::Source>
where A: DynCastExtHelper<T>, T: ?Sized,

Use this to cast from one trait object type to another. Read more
Sourceยง

fn dyn_upcast<T>(self) -> <A as DynCastExtAdvHelper<T, T>>::Target
where A: DynCastExtAdvHelper<T, T, Source = <A as DynCastExtAdvHelper<T, T>>::Target>, T: ?Sized,

Use this to upcast a trait to one of its supertraits. Read more
Sourceยง

fn dyn_cast_adv<F, T>( self, ) -> Result<<A as DynCastExtAdvHelper<F, T>>::Target, <A as DynCastExtAdvHelper<F, T>>::Source>
where A: DynCastExtAdvHelper<F, T>, F: ?Sized, T: ?Sized,

Use this to cast from one trait object type to another. This method is more customizable than the dyn_cast method. Here you can also specify the โ€œsourceโ€ trait from which the cast is defined. This can for example allow using casts from a supertrait of the current trait object. Read more
Sourceยง

fn dyn_cast_with_config<C>( self, ) -> Result<<A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Target, <A as DynCastExtAdvHelper<<C as DynCastConfig>::Source, <C as DynCastConfig>::Target>>::Source>

Use this to cast from one trait object type to another. With this method the type parameter is a config type that uniquely specifies which cast should be preformed. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T> Instrument for T

Sourceยง

fn instrument(self, span: Span) -> Instrumented<Self> โ“˜

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Sourceยง

fn in_current_span(self) -> Instrumented<Self> โ“˜

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Sourceยง

fn into_either(self, into_left: bool) -> Either<Self, Self> โ“˜

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Sourceยง

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> โ“˜
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Sourceยง

impl<T> Pointable for T

Sourceยง

const ALIGN: usize

The alignment of pointer.
Sourceยง

type Init = T

The type for initializers.
Sourceยง

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Sourceยง

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Sourceยง

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Sourceยง

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Sourceยง

impl<T> Same for T

Sourceยง

type Output = T

Should always be Self
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.
Sourceยง

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Sourceยง

fn vzip(self) -> V

Sourceยง

impl<T> WithSubscriber for T

Sourceยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> โ“˜
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

fn with_current_subscriber(self) -> WithDispatch<Self> โ“˜

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more