Enum erg_compiler::ty::value::ValueObj
source · pub enum ValueObj {
Show 20 variants
Int(i32),
Nat(u64),
Float(f64),
Str(Str),
Bool(bool),
Array(ArcArray<ValueObj>),
Set(Set<ValueObj>),
Dict(Dict<ValueObj, ValueObj>),
Tuple(ArcArray<ValueObj>),
Record(Dict<Field, ValueObj>),
DataClass {
name: Str,
fields: Dict<Field, ValueObj>,
},
Code(Box<CodeObj>),
Subr(ConstSubr),
Type(TypeObj),
None,
Ellipsis,
NotImplemented,
NegInf,
Inf,
Illegal,
}
Expand description
値オブジェクト コンパイル時評価ができ、シリアライズも可能
Variants§
Int(i32)
Nat(u64)
Float(f64)
Str(Str)
Bool(bool)
Array(ArcArray<ValueObj>)
Set(Set<ValueObj>)
Dict(Dict<ValueObj, ValueObj>)
Tuple(ArcArray<ValueObj>)
Record(Dict<Field, ValueObj>)
DataClass
Code(Box<CodeObj>)
Subr(ConstSubr)
Type(TypeObj)
None
Ellipsis
NotImplemented
NegInf
Inf
Illegal
Implementations§
source§impl ValueObj
impl ValueObj
pub const fn builtin_class(t: Type) -> Self
pub const fn builtin_trait(t: Type) -> Self
pub fn builtin_type(t: Type) -> Self
pub const fn gen_t(gen: GenTypeObj) -> Self
pub const fn is_num(&self) -> bool
pub const fn is_float(&self) -> bool
pub const fn is_int(&self) -> bool
pub const fn is_nat(&self) -> bool
pub const fn is_bool(&self) -> bool
pub const fn is_str(&self) -> bool
pub const fn is_type(&self) -> bool
pub fn from_str(t: Type, content: Str) -> Option<Self>
pub fn into_bytes(self, python_ver: PythonVersion) -> Vec<u8>
pub fn from_const_expr(expr: ConstExpr) -> Self
pub fn tuple_from_const_args(args: ConstArgs) -> Self
pub fn vec_from_const_args(args: ConstArgs) -> Vec<Self>
pub fn class(&self) -> Type
pub fn try_cmp(&self, other: &Self) -> Option<Ordering>
pub fn try_add(self, other: Self) -> Option<Self>
pub fn try_sub(self, other: Self) -> Option<Self>
pub fn try_mul(self, other: Self) -> Option<Self>
pub fn try_div(self, other: Self) -> Option<Self>
pub fn try_floordiv(self, other: Self) -> Option<Self>
pub fn try_gt(self, other: Self) -> Option<Self>
pub fn try_ge(self, other: Self) -> Option<Self>
pub fn try_lt(self, other: Self) -> Option<Self>
pub fn try_le(self, other: Self) -> Option<Self>
pub fn try_eq(self, other: Self) -> Option<Self>
pub fn try_ne(self, other: Self) -> Option<Self>
pub fn try_or(self, other: Self) -> Option<Self>
pub fn try_get_attr(&self, attr: &Field) -> Option<Self>
pub fn as_type(&self, ctx: &Context) -> Option<TypeObj>
Trait Implementations§
source§impl HasType for ValueObj
impl HasType for ValueObj
fn ref_t(&self) -> &Type
source§fn ref_mut_t(&mut self) -> &mut Type
fn ref_mut_t(&mut self) -> &mut Type
x.ref_mut_t()
may panic, in which case x
is Call
and x.ref_t() == Type::Failure
.fn signature_t(&self) -> Option<&Type>
fn signature_mut_t(&mut self) -> Option<&mut Type>
fn inner_ts(&self) -> Vec<Type>
fn lhs_t(&self) -> &Type
fn rhs_t(&self) -> &Type
source§impl PartialEq<ValueObj> for ValueObj
impl PartialEq<ValueObj> for ValueObj
impl Eq for ValueObj
impl StructuralPartialEq for ValueObj
Auto Trait Implementations§
impl !RefUnwindSafe for ValueObj
impl !Send for ValueObj
impl !Sync for ValueObj
impl Unpin for ValueObj
impl !UnwindSafe for ValueObj
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