pub struct Type { /* private fields */ }Expand description
A description of a Cap’n Proto type. The representation is optimized to avoid heap allocation.
To examine a Type, you should call the which() method.
Implementations§
Source§impl Type
impl Type
Sourcepub fn list_of(element_type: Type) -> Self
pub fn list_of(element_type: Type) -> Self
Constructs a new Type that is a list wrapping some other Type.
Sourcepub fn which(&self) -> TypeVariant
pub fn which(&self) -> TypeVariant
Unfolds a single layer of the Type, to allow for pattern matching.
Sourcepub fn is_pointer_type(&self) -> bool
pub fn is_pointer_type(&self) -> bool
Is the Type a pointer type?
Sourcepub fn loose_equals(&self, other: Self) -> bool
👎Deprecated since 0.27.0: Type now implements Eq. loose_equals ignores generics on structs, while Eq is more precise and most likely the one you want.
pub fn loose_equals(&self, other: Self) -> bool
Type now implements Eq. loose_equals ignores generics on structs, while Eq is more precise and most likely the one you want.
Returns true if self is equal to other modulo
type parameters and interface types.
Trait Implementations§
impl Copy for Type
impl Eq for Type
Source§impl From<TypeVariant> for Type
impl From<TypeVariant> for Type
Source§fn from(tv: TypeVariant) -> Type
fn from(tv: TypeVariant) -> Type
Converts to this type from the input type.
impl StructuralPartialEq for Type
Auto Trait Implementations§
impl Freeze for Type
impl RefUnwindSafe for Type
impl Send for Type
impl Sync for Type
impl Unpin for Type
impl UnsafeUnpin for Type
impl UnwindSafe for Type
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more