Struct wolfram_expr::Symbol
source · #[repr(C)]pub struct Symbol(_);
Expand description
Wolfram Language symbol.
PartialOrd sorting order
The comparison behavior of this type is NOT guaranteed to match the behavior of
System`Order
for symbols (and does not match it at the moment).
This type implements PartialOrd
/Ord
primarily for the purposes of allowing
instances of this type to be included in ordered sets (e.g. BTreeMap
).
Implementations§
source§impl Symbol
impl Symbol
sourcepub fn try_new(input: &str) -> Option<Self>
pub fn try_new(input: &str) -> Option<Self>
Attempt to parse input
as an absolute symbol.
An absolute symbol is a symbol with an explicit context path. "System`Plus"
is
an absolute symbol, "Plus"
is a relative symbol and/or a SymbolName
.
"`Plus"
is also a relative symbol.
sourcepub fn new(input: &str) -> Self
pub fn new(input: &str) -> Self
Construct a symbol from input
.
Panics
This function will panic if input
is not a valid Wolfram Language symbol.
Symbol::try_new(input)
must succeed.
This method is intended to be used for convenient construction of symbols from string literals, where an error is unlikely to occur, e.g.:
let expr = Expr::normal(Symbol::new("MyPackage`Foo"), vec![]);
If not using a string literal as the argument, prefer to use Symbol::try_new
and handle the error condition.
sourcepub fn as_symbol_ref(&self) -> SymbolRef<'_>
pub fn as_symbol_ref(&self) -> SymbolRef<'_>
sourcepub fn context(&self) -> ContextRef<'_>
pub fn context(&self) -> ContextRef<'_>
Get the context path part of a symbol as an ContextRef
.
sourcepub fn symbol_name(&self) -> SymbolNameRef<'_>
pub fn symbol_name(&self) -> SymbolNameRef<'_>
Get the symbol name part of a symbol as a SymbolNameRef
.
Trait Implementations§
source§impl Ord for Symbol
impl Ord for Symbol
source§impl PartialOrd<Symbol> for Symbol
impl PartialOrd<Symbol> for Symbol
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 more