TypedVTableDirectBuilder

Struct TypedVTableDirectBuilder 

Source
pub struct TypedVTableDirectBuilder<T> { /* private fields */ }
Expand description

Type-safe builder for VTableDirect.

Generic over T at the type level, ensuring all function pointers are for the same type. The transmute to erased pointers happens inside the builder methods.

Implementations§

Source§

impl<T> TypedVTableDirectBuilder<T>

Source

pub const fn display(self, f: fn(&T, &mut Formatter<'_>) -> Result) -> Self

Set the display function.

Source

pub const fn debug(self, f: fn(&T, &mut Formatter<'_>) -> Result) -> Self

Set the debug function.

Source

pub const fn hash(self, f: fn(&T, &mut HashProxy<'static>)) -> Self

Set the hash function.

Pass <T as Hash>::hash::<HashProxy> to use the type’s Hash impl.

Source

pub const fn invariants(self, f: fn(&T) -> Result<(), String>) -> Self

Set the invariants function.

Source

pub const fn parse( self, f: unsafe fn(&str, *mut T) -> Result<(), ParseError>, ) -> Self

Set the parse function.

Source

pub const fn parse_bytes( self, f: unsafe fn(&[u8], *mut T) -> Result<(), ParseError>, ) -> Self

Set the parse_bytes function.

For types with efficient binary representations (e.g., UUID as 16 bytes).

Source

pub const fn try_from( self, f: unsafe fn(*mut T, &'static Shape, PtrConst) -> Result<(), String>, ) -> Self

Set the try_from function. Arguments: (dst, src_shape, src_ptr)

Source

pub const fn try_into_inner( self, f: unsafe fn(*mut T) -> Result<PtrMut, String>, ) -> Self

Set the try_into_inner function.

For transparent types, this extracts the inner value (consuming). Takes a pointer to the wrapper type, returns a pointer to the inner value.

Source

pub const fn try_borrow_inner( self, f: unsafe fn(*const T) -> Result<PtrMut, String>, ) -> Self

Set the try_borrow_inner function.

For transparent types, this borrows the inner value. Takes a pointer to the wrapper type, returns a pointer to the inner value.

Source

pub const fn partial_eq(self, f: fn(&T, &T) -> bool) -> Self

Set the partial_eq function.

Source

pub const fn partial_cmp(self, f: fn(&T, &T) -> Option<Ordering>) -> Self

Set the partial_cmp function.

Source

pub const fn cmp(self, f: fn(&T, &T) -> Ordering) -> Self

Set the cmp function.

Source

pub const fn build(self) -> VTableDirect

Build the VTable.

Auto Trait Implementations§

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> 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<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.