Enum erg_compiler::ty::value::ValueObj
source · pub enum ValueObj {
Show 21 variants
Int(i32),
Nat(u64),
Float(f64),
Str(Str),
Bool(bool),
Array(ArcArray<ValueObj>),
UnsizedArray(Box<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
値オブジェクト コンパイル時評価ができ、シリアライズも可能(Typeなどはシリアライズ不可)
Variants§
Int(i32)
Nat(u64)
Float(f64)
Str(Str)
Bool(bool)
Array(ArcArray<ValueObj>)
UnsizedArray(Box<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 const fn is_inited(&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_binary(self, other: Self, op: OpKind) -> Option<Self>
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
source§impl LimitedDisplay for ValueObj
impl LimitedDisplay for ValueObj
source§impl PartialEq for ValueObj
impl PartialEq 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