ShapeBuilder

Struct ShapeBuilder 

Source
pub struct ShapeBuilder { /* private fields */ }
Expand description

Builder for Shape

Implementations§

Source§

impl ShapeBuilder

Source

pub const fn new(vtable: &'static ValueVTable) -> Self

Creates a new ShapeBuilder with all fields set to None.

Source

pub const fn id(self, id: ConstTypeId) -> Self

Sets the id field of the ShapeBuilder.

Source

pub const fn layout(self, layout: Layout) -> Self

Sets the layout field of the ShapeBuilder.

Source

pub const fn set_unsized(self) -> Self

Sets the type as unsized

Source

pub const fn def(self, def: Def) -> Self

Sets the def field of the ShapeBuilder.

Source

pub const fn ty(self, ty: Type) -> Self

Sets the ty field of the ShapeBuilder.

Source

pub const fn type_identifier(self, type_identifier: &'static str) -> Self

Sets the type_identifier field of the ShapeBuilder.

Source

pub const fn type_params(self, type_params: &'static [TypeParam]) -> Self

Sets the type_params field of the ShapeBuilder.

Source

pub const fn doc(self, doc: &'static [&'static str]) -> Self

Sets the doc field of the ShapeBuilder.

Source

pub const fn attributes(self, attributes: &'static [ShapeAttribute]) -> Self

Sets the attributes field of the ShapeBuilder.

Source

pub const fn type_tag(self, type_tag: &'static str) -> Self

Sets the type_tag field of the ShapeBuilder.

Source

pub const fn inner(self, inner_fn: fn() -> &'static Shape) -> Self

Sets the inner field of the ShapeBuilder.

This indicates that this shape is a transparent wrapper for another shape, like a newtype or smart pointer, and should be treated as such for serialization and deserialization.

The function inner_fn should return the static shape of the inner type.

Source

pub const fn build(self) -> Shape

Builds a Shape from the ShapeBuilder.

§Panics

This method will panic if any of the required fields (id, layout, type_identifier, or ty) are None.

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.