Enum wolfram_wxf::WolframValue
source · pub enum WolframValue {
Show 16 variants
Skip,
Function(Box<WolframFunction>),
Boolean(bool),
String(String),
Bytes(Vec<u8>),
Symbol(Box<WolframSymbol>),
Integer8(i8),
Integer16(i16),
Integer32(i32),
Integer64(i64),
BigInteger(BigInt),
Decimal64(OrderedFloat<f64>),
BigDecimal(String),
PackedArray(WolframArray),
NumericArray(WolframArray),
Association(BTreeMap<WolframValue, (WolframRule, WolframValue)>),
}
Expand description
A WolframValue
is a value that can be converted to a WolframValue
Variants§
Skip
A Empty value, roughly equivalent to Nothing
in Wolfram Language
Function(Box<WolframFunction>)
A wolfram function, notice the head of the function can be any WolframValue
.
Examples
WolframValue::function("Plus", vec![1, 2, 3]);
Boolean(bool)
A wolfram boolean, notice that True
and False
are symbols in Wolfram Language
WolframValue::function("Plus", vec![1, 2, 3]);
String(String)
A wolfram string
WolframValue::function("Plus", vec![1, 2, 3]);
Bytes(Vec<u8>)
A wolfram bytes
WolframValue::function("Plus", vec![1, 2, 3]);
Symbol(Box<WolframSymbol>)
A wolfram symbol
WolframValue::function("Plus", vec![1, 2, 3]);
Integer8(i8)
A wolfram number in range [-128, 127]
Integer16(i16)
A wolfram number in range [-32768, 32767]
Integer32(i32)
A wolfram number in range [-2147483648, 2147483647]
Integer64(i64)
A wolfram number in range [-9223372036854775808, 9223372036854775807]
BigInteger(BigInt)
A wolfram integer in arbitrary precision
Decimal64(OrderedFloat<f64>)
Do not use f64
, because partial order cannot be defined
BigDecimal(String)
A wolfram decimal in arbitrary precision
PackedArray(WolframArray)
Need to optimize
NumericArray(WolframArray)
Need to optimize
Association(BTreeMap<WolframValue, (WolframRule, WolframValue)>)
Record with key, rule, value
Implementations§
source§impl WolframValue
impl WolframValue
sourcepub fn to_compressed(&self) -> Vec<u8>
pub fn to_compressed(&self) -> Vec<u8>
Encode a value into a compressed byte vector.
source§impl WolframValue
impl WolframValue
sourcepub fn system_symbol<S>(s: S) -> WolframValue
pub fn system_symbol<S>(s: S) -> WolframValue
Creates a [Symbol] value
sourcepub fn global_symbol<S>(s: S) -> WolframValue
pub fn global_symbol<S>(s: S) -> WolframValue
Creates a [Symbol] value
sourcepub fn integer<I>(i: I) -> WolframValue
pub fn integer<I>(i: I) -> WolframValue
Creates a [Integer] value
sourcepub fn function<T>(head: &str, args: Vec<T>) -> WolframValuewhere
T: ToWolfram,
pub fn function<T>(head: &str, args: Vec<T>) -> WolframValuewhere
T: ToWolfram,
Creates a [Function] with sequence of arguments
sourcepub fn list<T>(items: Vec<T>) -> WolframValuewhere
T: ToWolfram,
pub fn list<T>(items: Vec<T>) -> WolframValuewhere
T: ToWolfram,
Creates a [List] from sequence of elements
sourcepub fn pair<K, V>(key: K, value: V, delayed: bool) -> WolframValue
pub fn pair<K, V>(key: K, value: V, delayed: bool) -> WolframValue
Creates a [Association] from sequence of key-value pairs
sourcepub fn numeric_array()
pub fn numeric_array()
Creates a [NumericArray]
sourcepub fn packed_array()
pub fn packed_array()
Creates a [PackedArray]
Trait Implementations§
source§impl Clone for WolframValue
impl Clone for WolframValue
source§fn clone(&self) -> WolframValue
fn clone(&self) -> WolframValue
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for WolframValue
impl Debug for WolframValue
source§impl Default for WolframValue
impl Default for WolframValue
source§impl Display for WolframValue
impl Display for WolframValue
source§impl From<f32> for WolframValue
impl From<f32> for WolframValue
source§impl From<f64> for WolframValue
impl From<f64> for WolframValue
source§impl Ord for WolframValue
impl Ord for WolframValue
source§fn cmp(&self, other: &WolframValue) -> Ordering
fn cmp(&self, other: &WolframValue) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for WolframValue
impl PartialEq for WolframValue
source§fn eq(&self, other: &WolframValue) -> bool
fn eq(&self, other: &WolframValue) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for WolframValue
impl PartialOrd for WolframValue
source§fn partial_cmp(&self, other: &WolframValue) -> Option<Ordering>
fn partial_cmp(&self, other: &WolframValue) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl ToWolfram for WolframValue
impl ToWolfram for WolframValue
source§fn to_wolfram(&self) -> WolframValue
fn to_wolfram(&self) -> WolframValue
WolframValue
value.source§fn to_wolfram_string(&self) -> String
fn to_wolfram_string(&self) -> String
WolframValue
in string form.source§fn to_wolfram_bytes(&self) -> Vec<u8>
fn to_wolfram_bytes(&self) -> Vec<u8>
WolframValue
in bytes form.source§fn to_wolfram_solid(&self) -> Vec<u8>
fn to_wolfram_solid(&self) -> Vec<u8>
WolframValue
in compressed bytes form.