Struct stack_dst::ValueA[][src]

pub struct ValueA<T: ?Sized, D: DataBuf> { /* fields omitted */ }

Stack-allocated dynamically sized type

T is the unsized type contained. D is the buffer used to hold the unsized type (both data and metadata).

Implementations

impl<T: ?Sized, D: DataBuf> ValueA<T, D>[src]

pub fn new<U: Unsize<T>>(val: U) -> Result<ValueA<T, D>, U>[src]

Construct a stack-based DST

Returns Ok(dst) if the allocation was successful, or Err(val) if it failed

pub fn new_stable<U, F: FnOnce(&U) -> &T>(
    val: U,
    get_ref: F
) -> Result<ValueA<T, D>, U>
[src]

Construct a stack-based DST (without needing Unsize)

Returns Ok(dst) if the allocation was successful, or Err(val) if it failed

pub fn new_or_boxed<U>(val: U) -> ValueA<T, D>

Notable traits for ValueA<T, D>

impl<D: DataBuf, T: ?Sized> Future for ValueA<T, D> where
    T: Future
type Output = T::Output;
where
    U: Unsize<T>,
    Box<U>: Unsize<T>, 
[src]

Construct a stack-based DST, falling back on boxing if the value doesn’t fit

use stack_dst::ValueA;
use core::fmt::Debug;
let val = [1usize, 2, 3, 4];
assert!( ValueA::<dyn Debug, [usize; 2]>::new(val).is_err() );
let v = ValueA::<dyn Debug, [usize; 2]>::new_or_boxed(val);
println!("v = {:?}", v);

pub unsafe fn new_raw(
    info: &[usize],
    data: *mut (),
    size: usize
) -> Option<ValueA<T, D>>
[src]

UNSAFE: data must point to size bytes, which shouldn’t be freed if Some is returned

Trait Implementations

impl<D: DataBuf, T: ?Sized> Debug for ValueA<T, D> where
    T: Debug
[src]

impl<T: ?Sized, D: DataBuf> Deref for ValueA<T, D>[src]

type Target = T

The resulting type after dereferencing.

impl<T: ?Sized, D: DataBuf> DerefMut for ValueA<T, D>[src]

impl<D: DataBuf, T: ?Sized> Display for ValueA<T, D> where
    T: Display
[src]

impl<T: ?Sized, D: DataBuf> Drop for ValueA<T, D>[src]

impl<D: DataBuf, T: ?Sized> Future for ValueA<T, D> where
    T: Future
[src]

Future if the inner impls Future

type Output = T::Output

The type of value produced on completion.

Auto Trait Implementations

impl<T: ?Sized, D> RefUnwindSafe for ValueA<T, D> where
    D: RefUnwindSafe,
    T: RefUnwindSafe

impl<T: ?Sized, D> Send for ValueA<T, D> where
    D: Send,
    T: Send

impl<T: ?Sized, D> Sync for ValueA<T, D> where
    D: Sync,
    T: Sync

impl<T: ?Sized, D> Unpin for ValueA<T, D> where
    D: Unpin,
    T: Unpin

impl<T: ?Sized, D> UnwindSafe for ValueA<T, D> where
    D: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

type Future = F

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.