pub struct Symbol(/* private fields */);Expand description
A Haystack Symbol.
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub fn new(s: String) -> Result<Symbol, ParseSymbolError>
pub fn new(s: String) -> Result<Symbol, ParseSymbolError>
Create a new Symbol.
§Example
use raystack_core::Symbol;
let my_symbol = Symbol::new("^steam-boiler".to_string()).unwrap();Sourcepub fn from_encoded_json_string(
json_string: &str,
) -> Result<Symbol, ParseSymbolError>
pub fn from_encoded_json_string( json_string: &str, ) -> Result<Symbol, ParseSymbolError>
Return a Symbol by decoding a symbol which was encoded in a JSON string. In
raw JSON strings, symbols are formatted with a y: prefix instead of
an ^ character.
§Example
use raystack_core::Symbol;
let json_str = "y:steam-boiler"; // ^steam-boiler
let my_symbol = Symbol::from_encoded_json_string(json_str).unwrap();Sourcepub fn to_encoded_json_string(&self) -> String
pub fn to_encoded_json_string(&self) -> String
Return a string containing this symbol, encoded with a y: prefix instead
of with an ^ character. This representation for symbols is used in raw
JSON strings sent to and from a Haystack server.
Sourcepub fn into_string(self) -> String
pub fn into_string(self) -> String
Convert this symbol into a string.
Sourcepub fn to_axon_code(&self) -> &str
pub fn to_axon_code(&self) -> &str
Return this symbol as an Axon symbol literal.
Trait Implementations§
impl Eq for Symbol
impl StructuralPartialEq for Symbol
Auto Trait Implementations§
impl Freeze for Symbol
impl RefUnwindSafe for Symbol
impl Send for Symbol
impl Sync for Symbol
impl Unpin for Symbol
impl UnwindSafe for Symbol
Blanket Implementations§
Source§impl<T> AsUncased for T
impl<T> AsUncased for T
Source§fn as_uncased(&self) -> &UncasedStr
fn as_uncased(&self) -> &UncasedStr
Convert
self to an UncasedStr.Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.