TypesView

Struct TypesView 

Source
pub struct TypesView<'a> { /* private fields */ }
Expand description

View into type metadata.

Types are stored in three sub-sections:

  • TypeDefs: structural topology (4 bytes each)
  • TypeMembers: fields and variants (4 bytes each)
  • TypeNames: name → TypeId mapping (4 bytes each)

Implementations§

Source§

impl<'a> TypesView<'a>

Source

pub fn get_def(&self, idx: usize) -> TypeDef

Get a type definition by index.

Source

pub fn get(&self, id: TypeId) -> Option<TypeDef>

Get a type definition by TypeId.

Source

pub fn get_member(&self, idx: usize) -> TypeMember

Get a type member by index.

Source

pub fn get_name(&self, idx: usize) -> TypeName

Get a type name entry by index.

Source

pub fn defs_count(&self) -> usize

Number of type definitions.

Source

pub fn members_count(&self) -> usize

Number of type members.

Source

pub fn names_count(&self) -> usize

Number of type names.

Source

pub fn members_of(&self, def: &TypeDef) -> impl Iterator<Item = TypeMember> + '_

Iterate over members of a struct or enum type.

Source

pub fn unwrap_optional(&self, type_id: TypeId) -> (TypeId, bool)

Unwrap Optional wrapper and return (inner_type, is_optional). If not Optional, returns (type_id, false).

Auto Trait Implementations§

§

impl<'a> Freeze for TypesView<'a>

§

impl<'a> RefUnwindSafe for TypesView<'a>

§

impl<'a> Send for TypesView<'a>

§

impl<'a> Sync for TypesView<'a>

§

impl<'a> Unpin for TypesView<'a>

§

impl<'a> UnwindSafe for TypesView<'a>

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.