std/jule/constant
Index
struct Const
fn NewInt(i: big::Int): &Const
fn NewI64(x: i64): &Const
fn NewU64(x: u64): &Const
fn NewBool(x: bool): &Const
fn NewStr(x: str): &Const
fn NewF64(x: f64): &Const
fn NewNil(): &Const
fn ReadInt(*self): big::Int
fn ReadBool(*self): bool
fn ReadStr(*self): str
fn ReadF64(*self): f64
fn AsI64(*self): i64
fn AsU64(*self): u64
fn AsF64(*self): f64
fn SetInt(mut *self, x: big::Int)
fn SetI64(mut *self, x: i64)
fn SetU64(mut *self, x: u64)
fn SetBool(mut *self, x: bool)
fn SetStr(mut *self, x: str)
fn SetF64(mut *self, x: f64)
fn SetNil(mut *self)
fn IsInt(*self): bool
fn IsBool(*self): bool
fn IsStr(*self): bool
fn IsF64(*self): bool
fn IsNil(*self): bool
fn AreSameTypes(*self, x: Const): bool
fn And(*self, x: Const): bool
fn Or(*self, x: Const): bool
fn Eq(*self, x: Const): bool
fn Lt(*self, x: Const): bool
fn LtEq(*self, x: Const): bool
fn Gt(*self, x: Const): bool
fn GtEq(*self, x: Const): bool
fn Add(mut *self, x: Const): bool
fn Sub(mut *self, x: Const): bool
fn Mul(mut *self, x: Const): bool
fn Div(mut *self, x: Const): bool
fn Mod(mut *self, x: Const): bool
fn BitwiseAnd(mut *self, x: Const): bool
fn BitwiseOr(mut *self, x: Const): bool
fn Xor(mut *self, x: Const): bool
fn Lshift(mut *self, x: Const): bool
fn Rshift(mut *self, x: Const): bool
fn Str(*self): str
Const
struct Const {
Kind: str
// NOTE: contains filtered hidden or unexported fields
}
Constant data. Use Const.new_nil function instead of Const{} for nil literal.
NewInt
fn NewInt(i: big::Int): &Const
Returns new constant value instance from big-integer.
NewI64
fn NewI64(x: i64): &Const
Returns new constant value instance from 64-bit signed integer.
NewU64
fn NewU64(x: u64): &Const
Returns new constant value instance from 64-bit unsigned integer.
NewBool
fn NewBool(x: bool): &Const
Returns new constant value instance from boolean.
NewStr
fn NewStr(x: str): &Const
Returns new constant value instance from string.
NewF64
fn NewF64(x: f64): &Const
Returns new constant value instance from 64-bit floating-point.
NewNil
fn NewNil(): &Const
Returns new constant value instance with nil.
ReadInt
fn ReadInt(*self): big::Int
Reads integer data. Returns zero value if data is not integer.
ReadBool
fn ReadBool(*self): bool
Reads boolean data. Returns false if data is not boolean.
ReadStr
fn ReadStr(*self): str
Reads string data. Returns empty string if data is not string.
ReadF64
fn ReadF64(*self): f64
Reads 64-bit floating-point data. Returns 0 if data is not 64-bit floating-point.
AsI64
fn AsI64(*self): i64
Reads data as 64-bit signed integer. Returns 0 if data is string, bool or which is not numeric.
AsU64
fn AsU64(*self): u64
Reads data as 64-bit unsigned integer. Returns 0 if data is string, bool or which is not numeric.
AsF64
fn AsF64(*self): f64
Reads data as 64-bit floating-point. Returns 0 if data is string, bool or which is not numeric.
SetInt
fn SetInt(mut *self, x: big::Int)
Sets constant value from big-integer.
SetI64
fn SetI64(mut *self, x: i64)
Sets constant value from 64-bit signed integer.
SetU64
fn SetU64(mut *self, x: u64)
Sets constant value from 64-bit unsigned integer.
SetBool
fn SetBool(mut *self, x: bool)
Sets constant value from boolean.
SetStr
fn SetStr(mut *self, x: str)
Sets constant value from string.
SetF64
fn SetF64(mut *self, x: f64)
Sets constant value from 64-bit floating-point.
SetNil
fn SetNil(mut *self)
Sets constant value to nil.
IsInt
fn IsInt(*self): bool
Reports whether data is integer.
IsBool
fn IsBool(*self): bool
Reports whether data is boolean.
IsStr
fn IsStr(*self): bool
Reports whether data is string.
IsF64
fn IsF64(*self): bool
Reports whether data is 64-bit floating-point.
IsNil
fn IsNil(*self): bool
Reports whether data is nil.
AreSameTypes
fn AreSameTypes(*self, x: Const): bool
Reports whether self and x has same type.
And
fn And(*self, x: Const): bool
Reports whether self and x are true. Returns false if type is not supported.
Or
fn Or(*self, x: Const): bool
Reports whether self or x is true. Returns false if type is not supported.
Eq
fn Eq(*self, x: Const): bool
Reports whether self and x are equals. Returns false if type is not supported.
Lt
fn Lt(*self, x: Const): bool
Reports whether self less than x. Returns false if type is unsupported by operation.
Supported types are:
- strings
- 64-bit signed integer
- 64-bit unsigned integer
- 64-bit floating-point
LtEq
fn LtEq(*self, x: Const): bool
Reports whether self less than or equals to x. Returns false if type is unsupported by operation.
Supported types are:
- strings
- 64-bit signed integer
- 64-bit unsigned integer
- 64-bit floating-point
Gt
fn Gt(*self, x: Const): bool
Reports whether self greater than x. Returns false if type is unsupported by operation.
Supported types are:
- strings
- 64-bit signed integer
- 64-bit unsigned integer
- 64-bit floating-point
GtEq
fn GtEq(*self, x: Const): bool
Reports whether self greater than or equals to x. Returns false if type is unsupported by operation.
Supported types are:
- strings
- 64-bit signed integer
- 64-bit unsigned integer
- 64-bit floating-point
Add
fn Add(mut *self, x: Const): bool
Adds x's value to itself value. Reports whether operation is success.
Sub
fn Sub(mut *self, x: Const): bool
Subs x's value from itself value. Reports whether operation is success.
Mul
fn Mul(mut *self, x: Const): bool
Multiplies x's value to c's value. Reports whether operation is success.
Div
fn Div(mut *self, x: Const): bool
Divides itself value to x's value. Reports whether operation is success. Reports false if divided-by-zero.
NOTICE
This operation makes constant value is floating-point.
Mod
fn Mod(mut *self, x: Const): bool
Mods itself value to x's value. Reports whether operation is success. Reports false if divided-by-zero.
BitwiseAnd
fn BitwiseAnd(mut *self, x: Const): bool
Bitwise and itself value to x's value. Reports whether operation is success.
BitwiseOr
fn BitwiseOr(mut *self, x: Const): bool
Bitwise or itself value to x's value. Reports whether operation is success.
Xor
fn Xor(mut *self, x: Const): bool
Bitwise xor itself value to x's value. Reports whether operation is success.
Lshift
fn Lshift(mut *self, x: Const): bool
Left shifts itself value to x's value. Reports whether operation is success.
Rshift
fn Rshift(mut *self, x: Const): bool
Right shifts itself value to x's value. Reports whether operation is success.
Str
fn Str(*self): str