pub enum ValueObj {
Show 19 variants
Int(i32),
Nat(u64),
Float(f64),
Str(Str),
Bool(bool),
Array(Rc<[ValueObj]>),
Dict(Rc<[(ValueObj, ValueObj)]>),
Tuple(Rc<[ValueObj]>),
Record(Dict<Field, ValueObj>),
Code(Box<CodeObj>),
Subr(ConstSubr),
Type(TypeObj),
None,
Ellipsis,
NotImplemented,
NegInf,
Inf,
Mut(Shared<ValueObj>),
Illegal,
}
Expand description
値オブジェクト コンパイル時評価ができ、シリアライズも可能
Variants
Int(i32)
Nat(u64)
Float(f64)
Str(Str)
Bool(bool)
Array(Rc<[ValueObj]>)
Dict(Rc<[(ValueObj, ValueObj)]>)
Tuple(Rc<[ValueObj]>)
Record(Dict<Field, ValueObj>)
Code(Box<CodeObj>)
Subr(ConstSubr)
Type(TypeObj)
None
Ellipsis
NotImplemented
NegInf
Inf
Mut(Shared<ValueObj>)
Illegal
Implementations
sourceimpl ValueObj
impl ValueObj
pub fn builtin_t(t: Type) -> Self
pub fn gen_t(
kind: TypeKind,
t: Type,
require_or_sup: TypeObj,
impls: Option<TypeObj>,
additional: Option<TypeObj>
) -> Self
pub fn is_num(&self) -> bool
pub const fn is_type(&self) -> bool
pub const fn is_mut(&self) -> bool
pub fn from_str(t: Type, content: Str) -> Self
pub fn into_bytes(self) -> Vec<u8>
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_gt(self, other: Self) -> Option<Self>
pub fn try_ge(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_get_attr(&self, attr: &Field) -> Option<Self>
pub fn as_type(&self) -> Option<TypeObj>
Trait Implementations
sourceimpl HasType for ValueObj
impl HasType 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more