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 — stored verbatim, no validation.
Any string is accepted: a fully-qualified "System`Plus", a
context-less "Plus", or anything else. What goes into a symbol is the
caller’s business — we don’t police WL symbol syntax. A name the kernel
can’t make sense of is the caller’s problem, not ours.
let expr = Expr::normal(Symbol::new("MyPackage`Foo"), vec![]);Use Symbol::try_new if you want to validate the name first.
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.