Skip to content

std/jule/constant

Index

struct Const
    static fn NewI64(x: i64): &Const
    static fn NewU64(x: u64): &Const
    static fn NewBool(x: bool): &Const
    static fn NewStr(x: str): &Const
    static fn NewF64(x: f64): &Const
    static fn NewNil(): &Const
    fn ReadI64(self): i64
    fn ReadU64(self): u64
    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 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 IsI64(self): bool
    fn IsU64(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

Const

jule
struct Const {
	Kind: str
	// NOTE: contains filtered hidden or unexported fields
}

Constant data. Use Const.new_nil function instead of Const{} for nil literal.

NewI64

jule
static fn NewI64(x: i64): &Const

Returns new constant value instance from 64-bit signed integer.

NewU64

jule
static fn NewU64(x: u64): &Const

Returns new constant value instance from 64-bit unsigned integer.

NewBool

jule
static fn NewBool(x: bool): &Const

Returns new constant value instance from boolean.

NewStr

jule
static fn NewStr(x: str): &Const

Returns new constant value instance from string.

NewF64

jule
static fn NewF64(x: f64): &Const

Returns new constant value instance from 64-bit floating-point.

NewNil

jule
static fn NewNil(): &Const

Returns new constant value instance with nil.

ReadI64

jule
fn ReadI64(self): i64

Reads 64-bit signed integer data. Returns 0 if data is not 64-bit signed integer.

ReadU64

jule
fn ReadU64(self): u64

Reads 64-bit unsigned integer data. Returns 0 if data is not 64-bit unsigned integer.

ReadBool

jule
fn ReadBool(self): bool

Reads boolean data. Returns false if data is not boolean.

ReadStr

jule
fn ReadStr(self): str

Reads string data. Returns empty string if data is not string.

ReadF64

jule
fn ReadF64(self): f64

Reads 64-bit floating-point data. Returns 0 if data is not 64-bit floating-point.

AsI64

jule
fn AsI64(self): i64

Reads data as 64-bit signed integer. Returns 0 if data is string, bool or which is not numeric.

AsU64

jule
fn AsU64(self): u64

Reads data as 64-bit unsigned integer. Returns 0 if data is string, bool or which is not numeric.

AsF64

jule
fn AsF64(self): f64

Reads data as 64-bit floating-point. Returns 0 if data is string, bool or which is not numeric.

SetI64

jule
fn SetI64(mut self, x: i64)

Sets constant value from 64-bit signed integer.

SetU64

jule
fn SetU64(mut self, x: u64)

Sets constant value from 64-bit unsigned integer.

SetBool

jule
fn SetBool(mut self, x: bool)

Sets constant value from boolean.

SetStr

jule
fn SetStr(mut self, x: str)

Sets constant value from string.

SetF64

jule
fn SetF64(mut self, x: f64)

Sets constant value from 64-bit floating-point.

SetNil

jule
fn SetNil(mut self)

Sets constant value to nil.

IsI64

jule
fn IsI64(self): bool

Reports whether data is 64-bit signed integer.

IsU64

jule
fn IsU64(self): bool

Reports whether data is 64-bit unsigned integer.

IsBool

jule
fn IsBool(self): bool

Reports whether data is boolean.

IsStr

jule
fn IsStr(self): bool

Reports whether data is string.

IsF64

jule
fn IsF64(self): bool

Reports whether data is 64-bit floating-point.

IsNil

jule
fn IsNil(self): bool

Reports whether data is nil.

AreSameTypes

jule
fn AreSameTypes(self, x: Const): bool

Reports whether self and x has same type.

And

jule
fn And(self, x: Const): bool

Reports whether self and x are true. Returns false if type is not supported.

Or

jule
fn Or(self, x: Const): bool

Reports whether self or x is true. Returns false if type is not supported.

Eq

jule
fn Eq(self, x: Const): bool

Reports whether self and x are equals. Returns false if type is not supported.

Lt

jule
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

jule
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

jule
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

jule
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

jule
fn Add(mut self, x: Const): bool

Adds x's value to itself value. Reports whether operation is success.

Sub

jule
fn Sub(mut self, x: Const): bool

Subs x's value from itself value. Reports whether operation is success.

Mul

jule
fn Mul(mut self, x: Const): bool

Multiplies x's value to c's value. Reports whether operation is success.

Div

jule
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

jule
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

jule
fn BitwiseAnd(mut self, x: Const): bool

Bitwise and itself value to x's value. Reports whether operation is success.

BitwiseOr

jule
fn BitwiseOr(mut self, x: Const): bool

Bitwise or itself value to x's value. Reports whether operation is success.

Xor

jule
fn Xor(mut self, x: Const): bool

Bitwise xor itself value to x's value. Reports whether operation is success.

Lshift

jule
fn Lshift(mut self, x: Const): bool

Left shifts itself value to x's value. Reports whether operation is success.

Rshift

jule
fn Rshift(mut self, x: Const): bool

Right shifts itself value to x's value. Reports whether operation is success.