Struct stack_dst::ValueA [−][src]
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]
val: U,
get_ref: F
) -> Result<ValueA<T, D>, U>
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>ⓘ where
U: Unsize<T>,
Box<U>: Unsize<T>,
[src]
U: Unsize<T>,
Box<U>: Unsize<T>,
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]
info: &[usize],
data: *mut (),
size: usize
) -> Option<ValueA<T, D>>
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]
T: Debug,
impl<T: ?Sized, D: DataBuf> Deref for ValueA<T, D>
[src]
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]
T: Display,
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]
T: Future,
Future if the inner impls Future
Auto Trait Implementations
impl<T: ?Sized, D> RefUnwindSafe for ValueA<T, D> where
D: RefUnwindSafe,
T: RefUnwindSafe,
D: RefUnwindSafe,
T: RefUnwindSafe,
impl<T: ?Sized, D> Send for ValueA<T, D> where
D: Send,
T: Send,
D: Send,
T: Send,
impl<T: ?Sized, D> Sync for ValueA<T, D> where
D: Sync,
T: Sync,
D: Sync,
T: Sync,
impl<T: ?Sized, D> Unpin for ValueA<T, D> where
D: Unpin,
T: Unpin,
D: Unpin,
T: Unpin,
impl<T: ?Sized, D> UnwindSafe for ValueA<T, D> where
D: UnwindSafe,
T: UnwindSafe,
D: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<F> IntoFuture for F where
F: Future,
[src]
F: Future,
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?
pub fn into_future(self) -> <F as IntoFuture>::Future
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,