Struct TinyBoxSized

#[repr(C)]
pub struct TinyBoxSized<T: ?Sized, const S: usize>(/* private fields */);

Implementations§

§

impl<T: ?Sized, const S: usize> TinyBoxSized<T, S>

pub unsafe fn read_raw(src: *mut T) -> Self

§Safety

Behavior is undefined if any of the following conditions are violated:

  • src must be valid for reads.
  • src must be properly aligned.
  • src must point to a properly initialized value of type T.
  • the value at src must not be used or dropped after read_raw is called.

Like ptr::read, read_raw creates a bitwise copy of T, regardless of whether T is Copy. If T is not Copy, using the value at *src after calling read_raw can violate memory safety. This also applies for dropping dte value at src. It is recommended, that mem::forget is called on the value at src.

Note that even if T has size 0, the pointer must be non-null and properly aligned.

pub fn as_ptr(&self) -> *mut T

§

impl<T: Sized, const S: usize> TinyBoxSized<T, S>

pub fn new(v: T) -> Self

pub fn into_inner(boxed: Self) -> T

§

impl<const S: usize> TinyBoxSized<dyn Any, S>

pub fn downcast<T: Any>(self) -> Result<TinyBoxSized<T, S>, Self>

§

impl<const S: usize> TinyBoxSized<dyn Any + Send, S>

pub fn downcast<T: Any>(self) -> Result<TinyBoxSized<T, S>, Self>

§

impl<const S: usize> TinyBoxSized<dyn Any + Send + Sync, S>

pub fn downcast<T: Any>(self) -> Result<TinyBoxSized<T, S>, Self>

Trait Implementations§

§

impl<T: ?Sized, const S: usize> AsMut<T> for TinyBoxSized<T, S>

§

fn as_mut(&mut self) -> &mut T

Converts this type into a mutable reference of the (usually inferred) input type.
§

impl<T: ?Sized, const S: usize> AsRef<T> for TinyBoxSized<T, S>

§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
§

impl<T: ?Sized, const S: usize> Borrow<T> for TinyBoxSized<T, S>

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T: ?Sized, const S: usize> BorrowMut<T> for TinyBoxSized<T, S>

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T: Clone + Sized, const S: usize> Clone for TinyBoxSized<T, S>

§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T: ?Sized + Debug, const S: usize> Debug for TinyBoxSized<T, S>

§

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

Formats the value using the given formatter. Read more
§

impl<T: Default + Sized, const S: usize> Default for TinyBoxSized<T, S>

§

fn default() -> Self

Returns the “default value” for a type. Read more
§

impl<T: ?Sized, const S: usize> Deref for TinyBoxSized<T, S>

§

type Target = T

The resulting type after dereferencing.
§

fn deref(&self) -> &T

Dereferences the value.
§

impl<T: ?Sized, const S: usize> DerefMut for TinyBoxSized<T, S>

§

fn deref_mut(&mut self) -> &mut T

Mutably dereferences the value.
§

impl<T: ?Sized + Display, const S: usize> Display for TinyBoxSized<T, S>

§

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

Formats the value using the given formatter. Read more
§

impl<T: ?Sized, const S: usize> Drop for TinyBoxSized<T, S>

§

fn drop(&mut self)

Executes the destructor for this type. Read more
§

impl<T: ?Sized + Future, const S: usize> Future for TinyBoxSized<T, S>

§

type Output = <T as Future>::Output

The type of value produced on completion.
§

fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output>

Attempts to resolve the future to a final value, registering the current task for wakeup if the value is not yet available. Read more
§

impl<T: ?Sized + Hash, const S: usize> Hash for TinyBoxSized<T, S>

§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<T: ?Sized + Ord, const S: usize> Ord for TinyBoxSized<T, S>

§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
§

impl<T: ?Sized + PartialEq<Rhs::Target>, Rhs: Deref, const S: usize> PartialEq<Rhs> for TinyBoxSized<T, S>

§

fn eq(&self, other: &Rhs) -> 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.
§

impl<T: ?Sized + PartialOrd<Rhs::Target>, Rhs: Deref, const S: usize> PartialOrd<Rhs> for TinyBoxSized<T, S>

§

fn partial_cmp(&self, other: &Rhs) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
§

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

Tests less than (for self and other) and is used by the < operator. Read more
§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
§

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

Tests greater than (for self and other) and is used by the > operator. Read more
§

impl<T: ?Sized, const S: usize> Pointer for TinyBoxSized<T, S>

§

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

Formats the value using the given formatter. Read more
§

impl<T: ?Sized + Eq, const S: usize> Eq for TinyBoxSized<T, S>

§

impl<T: ?Sized + Send, const S: usize> Send for TinyBoxSized<T, S>

§

impl<T: ?Sized + Sync, const S: usize> Sync for TinyBoxSized<T, S>

Auto Trait Implementations§

§

impl<T, const S: usize> Freeze for TinyBoxSized<T, S>
where T: ?Sized,

§

impl<T, const S: usize> RefUnwindSafe for TinyBoxSized<T, S>
where T: RefUnwindSafe + ?Sized,

§

impl<T, const S: usize> Unpin for TinyBoxSized<T, S>
where T: ?Sized,

§

impl<T, const S: usize> UnwindSafe for TinyBoxSized<T, S>
where T: RefUnwindSafe + ?Sized,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<F> IntoFuture for F
where F: Future,

Source§

type Output = <F as Future>::Output

The output that the future will produce on completion.
Source§

type IntoFuture = F

Which kind of future are we turning this into?
Source§

fn into_future(self) -> <F as IntoFuture>::IntoFuture

Creates a future from a value. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.