pub enum ValueType {
Void,
SignedChar,
Int,
Float,
Bool,
Array(Box<ValueType>, usize),
Pointer(Box<ValueType>),
}Expand description
Represent the type of a value.
Variants§
Implementations§
Source§impl ValueType
impl ValueType
pub fn is_basic_type(&self) -> bool
pub fn is_num(&self) -> bool
pub fn is_pointer(&self) -> bool
pub fn is_array(&self) -> bool
Sourcepub fn get_sub_type(&self) -> Option<&ValueType>
pub fn get_sub_type(&self) -> Option<&ValueType>
Get subtype of the value type. Subtype is the type of the element in the array or the type of the pointer.
Sourcepub fn get_base_type(&self) -> ValueType
pub fn get_base_type(&self) -> ValueType
Get base type of the value type. Base type is i32 / f32 for array.
Sourcepub fn default_initializer(&self) -> Result<Constant>
pub fn default_initializer(&self) -> Result<Constant>
Get default initializer of this type.
Sourcepub fn to_precision_level(&self) -> i32
pub fn to_precision_level(&self) -> i32
Convert a numeric value type to its precision level. Higher is more precise.
Sourcepub fn from_precision_level(level: i32) -> Self
pub fn from_precision_level(level: i32) -> Self
Convert a precision level to a value type.
Trait Implementations§
impl Eq for ValueType
impl StructuralPartialEq for ValueType
Auto Trait Implementations§
impl Freeze for ValueType
impl RefUnwindSafe for ValueType
impl Send for ValueType
impl Sync for ValueType
impl Unpin for ValueType
impl UnwindSafe for ValueType
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more