pub struct Constant {
    pub name: Spanned<String>,
    pub value: PreExp,
}Expand description
A constant value with a name and a value
Fields§
§name: Spanned<String>§value: PreExpImplementations§
Source§impl Constant
 
impl Constant
Sourcepub fn as_primitive(
    &self,
    context: &TransformerContext,
    fn_context: &FunctionContext<'_>,
) -> Result<Primitive, TransformError>
 
pub fn as_primitive( &self, context: &TransformerContext, fn_context: &FunctionContext<'_>, ) -> Result<Primitive, TransformError>
Get the primitive value of the constant, it evaluates the value of the expression
Sourcepub fn from_primitive(name: &str, primitive: Primitive) -> Self
 
pub fn from_primitive(name: &str, primitive: Primitive) -> Self
Create a new constant from a primitive value
Trait Implementations§
Source§impl TypeCheckable for Constant
 
impl TypeCheckable for Constant
Source§fn populate_token_type_map(
    &self,
    context: &mut TypeCheckerContext,
    fn_context: &FunctionContext<'_>,
)
 
fn populate_token_type_map( &self, context: &mut TypeCheckerContext, fn_context: &FunctionContext<'_>, )
Populates the token type map with type information. Read more
Source§fn type_check(
    &self,
    context: &mut TypeCheckerContext,
    fn_context: &FunctionContext<'_>,
) -> Result<(), TransformError>
 
fn type_check( &self, context: &mut TypeCheckerContext, fn_context: &FunctionContext<'_>, ) -> Result<(), TransformError>
Performs type checking on the implementing type. Read more
Source§impl WithType for Constant
 
impl WithType for Constant
Source§fn get_type(
    &self,
    context: &TypeCheckerContext,
    fn_context: &FunctionContext<'_>,
) -> PrimitiveKind
 
fn get_type( &self, context: &TypeCheckerContext, fn_context: &FunctionContext<'_>, ) -> PrimitiveKind
Gets the primitive type of the implementing type. Read more
Auto Trait Implementations§
impl Freeze for Constant
impl RefUnwindSafe for Constant
impl Send for Constant
impl Sync for Constant
impl Unpin for Constant
impl UnwindSafe for Constant
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<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