Trait moore_vhdl::ty2::Type
source · [−]pub trait Type: Debug + Display {
fn is_scalar(&self) -> bool;
fn is_discrete(&self) -> bool;
fn is_numeric(&self) -> bool;
fn is_composite(&self) -> bool;
fn into_owned<'a>(self) -> OwnedType<'a>
where
Self: 'a;
fn to_owned<'a>(&self) -> OwnedType<'a>
where
Self: 'a;
fn as_any(&self) -> AnyType<'_>;
fn is_equal(&self, other: &dyn Type) -> bool { ... }
fn is_implicitly_castable(&self, _into: &dyn Type) -> bool { ... }
}
Expand description
An interface for dealing with types.
This is the main type trait, which all types and subtypes implement.
Required methods
Check if this is a scalar type.
Enumeration, integer, floating-point, and physical types are scalar.
fn is_discrete(&self) -> bool
fn is_discrete(&self) -> bool
Check if this is a discrete type.
Enumeration and integer types are discrete.
fn is_numeric(&self) -> bool
fn is_numeric(&self) -> bool
Check if this is a numeric type.
Integer, floating-point, and physical types are numeric.
fn is_composite(&self) -> bool
fn is_composite(&self) -> bool
Check if this is a composite type.
Array and record types are composite.
fn into_owned<'a>(self) -> OwnedType<'a> where
Self: 'a,
fn into_owned<'a>(self) -> OwnedType<'a> where
Self: 'a,
Convert into an owned type.
Provided methods
fn is_implicitly_castable(&self, _into: &dyn Type) -> bool
fn is_implicitly_castable(&self, _into: &dyn Type) -> bool
Check if the type can be implicitly cast to another.
Trait Implementations
sourceimpl<'t> AllocOwned<'t, 't, dyn Type + 't> for TypeArena<'t>
impl<'t> AllocOwned<'t, 't, dyn Type + 't> for TypeArena<'t>
sourcefn alloc_owned(&'t self, value: OwnedType<'t>) -> &'t dyn Type
fn alloc_owned(&'t self, value: OwnedType<'t>) -> &'t dyn Type
Allocate a value of type T: ToOwned
into this arena. Read more
sourcefn maybe_alloc(&'a self, value: Cow<'t, T>) -> &'t T
fn maybe_alloc(&'a self, value: Cow<'t, T>) -> &'t T
Conditionally allocate a value of type Cow<T>
. Read more
sourcefn force_alloc(&'a self, value: Cow<'_, T>) -> &'t T
fn force_alloc(&'a self, value: Cow<'_, T>) -> &'t T
Forcefully allocate a value of type Cow<T>
. Read more