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
sourceimpl 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 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
sourceimpl Ord for Symbol
impl Ord for Symbol
sourceimpl PartialOrd<Symbol> for Symbol
impl PartialOrd<Symbol> for Symbol
sourcefn partial_cmp(&self, other: &Symbol) -> Option<Ordering>
fn partial_cmp(&self, other: &Symbol) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for Symbol
impl StructuralEq for Symbol
impl StructuralPartialEq for Symbol
Auto Trait Implementations
impl RefUnwindSafe for Symbol
impl Send for Symbol
impl Sync for Symbol
impl Unpin for Symbol
impl UnwindSafe for Symbol
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more