[][src]Struct abi_stable::prefix_type::WithMetadata_

#[repr(C)]
pub struct WithMetadata_<T, P> {
    pub _prefix_type_field_acc: FieldAccessibility,
    pub _prefix_type_layout: &'static PTStructLayout,
    pub original: T,
    // some fields omitted
}

Wraps a prefix-type,with extra metadata about field count and layout.

Can be converted to the PrefixTypeTrait::Prefix of T with the as_prefix method.

Fields

_prefix_type_field_acc: FieldAccessibility

A bit array,where the bit at field index represents whether a field is accessible.

_prefix_type_layout: &'static PTStructLayout

Yhe basic layout of the prefix type.

original: T

The original value of the prefix type, which can be converted into a reference to P by calling the as_prefix methods.

Methods

impl<T, P> WithMetadata_<T, P>[src]

pub const fn new(metadata: WithMetadataFor<T, P>, value: T) -> Self[src]

Constructs Self with WithMetadata::new(PrefixTypeTrait::METADATA,value)

This takes in the metadata:WithMetadataFor<T,P> parameter as a workaround for const fn not allowing trait bounds, which in case is PrefixTypeTrait.

pub fn ref_as_prefix(&self) -> &P[src]

Converts this WithMetadata<T,P> to a <prefix_struct> type.

pub const fn as_prefix(this: StaticRef<Self>) -> StaticRef<P>[src]

Converts a StaticRef<WithMetadata<T,P>> to a StaticRef< <prefix_struct> > type. Use this if you need to implement nested vtables at compile-time.

Auto Trait Implementations

impl<T, P> Send for WithMetadata_<T, P> where
    P: Send,
    T: Send

impl<T, P> Sync for WithMetadata_<T, P> where
    P: Sync,
    T: Sync

impl<T, P> Unpin for WithMetadata_<T, P> where
    P: Unpin,
    T: Unpin

impl<T, P> UnwindSafe for WithMetadata_<T, P> where
    P: UnwindSafe,
    T: UnwindSafe

impl<T, P> RefUnwindSafe for WithMetadata_<T, P> where
    P: RefUnwindSafe,
    T: RefUnwindSafe

Blanket Implementations

impl<This> TransmuteElement for This where
    This: ?Sized
[src]

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

impl<T> From<T> for T[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.

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

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

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

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

type Type = T

The same type as Self. Read more

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

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

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

The error type returned when the conversion fails.