Skip to main content

AnyValueSizeless

Trait AnyValueSizeless 

Source
pub trait AnyValueSizeless {
    type Type: 'static;

    // Required method
    fn as_bytes_ptr(&self) -> *const u8;

    // Provided methods
    unsafe fn downcast_ref_unchecked<T>(&self) -> &T { ... }
    unsafe fn downcast_unchecked<T: 'static>(self) -> T
       where Self: Sized { ... }
    unsafe fn move_into<KnownType: 'static>(
        self,
        out: *mut u8,
        bytes_size: usize,
    )
       where Self: Sized { ... }
}
Expand description

AnyValue that doesn’t know its size or type, and can provide only object ptr.

Required Associated Types§

Source

type Type: 'static

Concrete type, or Unknown

N.B. This should be in AnyValueTyped. It is here due to ergonomic reasons, since Rust does not have impl specialization.

Required Methods§

Source

fn as_bytes_ptr(&self) -> *const u8

Aligned address.

Provided Methods§

Source

unsafe fn downcast_ref_unchecked<T>(&self) -> &T

Source

unsafe fn downcast_unchecked<T: 'static>(self) -> T
where Self: Sized,

Source

unsafe fn move_into<KnownType: 'static>(self, out: *mut u8, bytes_size: usize)
where Self: Sized,

Move self into out.

Will do compile-time optimization if type/size known.

§Safety
  • bytes_size must be correct object size.
  • out must not overlap with self.
  • out must have at least bytes_size bytes.
  • KnownType must be correct object type or Unknown.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl AnyValueSizeless for AnyValueRaw

Source§

impl AnyValueSizeless for AnyValueSizelessRaw

Source§

impl AnyValueSizeless for AnyValueTypelessRaw

Source§

impl<'a, AnyVecPtr: IAnyVecRawPtr> AnyValueSizeless for ElementPointer<'a, AnyVecPtr>

Source§

type Type = <AnyVecPtr as IAnyVecRawPtr>::Element

Source§

impl<'a, T: AnyValueCloneable> AnyValueSizeless for LazyClone<'a, T>

Source§

impl<Op: Operation> AnyValueSizeless for TempValue<Op>

Source§

type Type = <<Op as Operation>::AnyVecPtr as IAnyVecRawPtr>::Element

Source§

impl<T: 'static> AnyValueSizeless for AnyValueWrapper<T>

Source§

type Type = T