pub enum ValueObj {
Show 21 variants Int(i32), Nat(u64), Float(f64), Str(Str), Bool(bool), Array(Rc<[ValueObj]>), Set(Set<ValueObj>), Dict(Dict<ValueObj, ValueObj>), Tuple(Rc<[ValueObj]>), Record(Dict<Field, ValueObj>), DataClass { name: Str, fields: 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]>)

§

Set(Set<ValueObj>)

§

Dict(Dict<ValueObj, ValueObj>)

§

Tuple(Rc<[ValueObj]>)

§

Record(Dict<Field, ValueObj>)

§

DataClass

Fields

§name: Str
§

Code(Box<CodeObj>)

§

Subr(ConstSubr)

§

Type(TypeObj)

§

None

§

Ellipsis

§

NotImplemented

§

NegInf

§

Inf

§

Mut(Shared<ValueObj>)

§

Illegal

Implementations§

source§

impl ValueObj

source

pub fn builtin_class(t: Type) -> Self

source

pub fn builtin_trait(t: Type) -> Self

source

pub fn builtin_type(t: Type) -> Self

source

pub fn gen_t(gen: GenTypeObj) -> Self

source

pub fn is_num(&self) -> bool

source

pub fn is_float(&self) -> bool

source

pub fn is_int(&self) -> bool

source

pub fn is_nat(&self) -> bool

source

pub fn is_bool(&self) -> bool

source

pub const fn is_str(&self) -> bool

source

pub const fn is_type(&self) -> bool

source

pub const fn is_mut(&self) -> bool

source

pub fn from_str(t: Type, content: Str) -> Option<Self>

source

pub fn into_bytes(self, python_ver: PythonVersion) -> Vec<u8>

source

pub fn from_const_expr(expr: ConstExpr) -> Self

source

pub fn tuple_from_const_args(args: ConstArgs) -> Self

source

pub fn vec_from_const_args(args: ConstArgs) -> Vec<Self>

source

pub fn class(&self) -> Type

source

pub fn try_cmp(&self, other: &Self) -> Option<Ordering>

source

pub fn try_add(self, other: Self) -> Option<Self>

source

pub fn try_sub(self, other: Self) -> Option<Self>

source

pub fn try_mul(self, other: Self) -> Option<Self>

source

pub fn try_div(self, other: Self) -> Option<Self>

source

pub fn try_floordiv(self, other: Self) -> Option<Self>

source

pub fn try_gt(self, other: Self) -> Option<Self>

source

pub fn try_ge(self, other: Self) -> Option<Self>

source

pub fn try_lt(self, other: Self) -> Option<Self>

source

pub fn try_le(self, other: Self) -> Option<Self>

source

pub fn try_eq(self, other: Self) -> Option<Self>

source

pub fn try_ne(self, other: Self) -> Option<Self>

source

pub fn try_or(self, other: Self) -> Option<Self>

source

pub fn try_get_attr(&self, attr: &Field) -> Option<Self>

source

pub fn as_type(&self) -> Option<TypeObj>

Trait Implementations§

source§

impl Clone for ValueObj

source§

fn clone(&self) -> ValueObj

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ValueObj

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ValueObj

source§

fn default() -> ValueObj

Returns the “default value” for a type. Read more
source§

impl Display for ValueObj

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<&str> for ValueObj

source§

fn from(item: &str) -> Self

Converts to this type from the input type.
source§

impl<const N: usize, V: Into<ValueObj>> From<[V; N]> for ValueObj

source§

fn from(item: [V; N]) -> Self

Converts to this type from the input type.
source§

impl From<CodeObj> for ValueObj

source§

fn from(item: CodeObj) -> Self

Converts to this type from the input type.
source§

impl From<Str> for ValueObj

source§

fn from(item: Str) -> Self

Converts to this type from the input type.
source§

impl<V: Into<ValueObj>> From<Vec<V, Global>> for ValueObj

source§

fn from(item: Vec<V>) -> Self

Converts to this type from the input type.
source§

impl From<bool> for ValueObj

source§

fn from(item: bool) -> Self

Converts to this type from the input type.
source§

impl From<f64> for ValueObj

source§

fn from(item: f64) -> Self

Converts to this type from the input type.
source§

impl From<i32> for ValueObj

source§

fn from(item: i32) -> Self

Converts to this type from the input type.
source§

impl From<u64> for ValueObj

source§

fn from(item: u64) -> Self

Converts to this type from the input type.
source§

impl From<usize> for ValueObj

source§

fn from(item: usize) -> Self

Converts to this type from the input type.
source§

impl HasType for ValueObj

source§

fn t(&self) -> Type

その要素だけの集合型を返す、クラスが欲しい場合は.classで

source§

fn ref_t(&self) -> &Type

source§

fn ref_mut_t(&mut self) -> &mut Type

source§

fn signature_t(&self) -> Option<&Type>

source§

fn signature_mut_t(&mut self) -> Option<&mut Type>

source§

fn inner_ts(&self) -> Vec<Type>

source§

fn lhs_t(&self) -> &Type

source§

fn rhs_t(&self) -> &Type

source§

impl Hash for ValueObj

source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Neg for ValueObj

§

type Output = ValueObj

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl PartialEq<ValueObj> for ValueObj

source§

fn eq(&self, other: &ValueObj) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a> TryFrom<&'a ValueObj> for &'a Type

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(val: &'a ValueObj) -> Result<Self, ()>

Performs the conversion.
source§

impl TryFrom<&ValueObj> for f64

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(val: &ValueObj) -> Result<f64, Self::Error>

Performs the conversion.
source§

impl TryFrom<TyParam> for ValueObj

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(tp: TyParam) -> Result<Self, ()>

Performs the conversion.
source§

impl TryFrom<ValueObj> for Type

§

type Error = ()

The type returned in the event of a conversion error.
source§

fn try_from(val: ValueObj) -> Result<Type, ()>

Performs the conversion.
source§

impl Eq for ValueObj

source§

impl StructuralPartialEq for ValueObj

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.