pub struct Symbol(/* private fields */);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.