pub struct Ref(/* private fields */);
Expand description
A Haystack Ref.
Implementations§
Source§impl Ref
impl Ref
Sourcepub fn new(s: String) -> Result<Self, ParseRefError>
pub fn new(s: String) -> Result<Self, ParseRefError>
Create a new Ref
.
§Example
use raystack_core::Ref;
let my_ref = Ref::new("@p:bigProject:r:24efe1c4-24aef280".to_string()).unwrap();
Sourcepub fn from_encoded_json_string(
json_string: &str,
) -> Result<Self, ParseRefError>
pub fn from_encoded_json_string( json_string: &str, ) -> Result<Self, ParseRefError>
Return a Ref by decoding a ref which was encoded in a JSON string. In
raw JSON strings, refs are formatted with a r:
prefix instead of
an @
sign.
§Example
use raystack_core::Ref;
let json_str = "r:p:bigProject:r:24efe1c4-24aef280";
let my_ref = Ref::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 ref, encoded with a r:
prefix instead
of with an @
sign. This representation for refs 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 ref into a string.
Sourcepub fn to_axon_code(&self) -> &str
pub fn to_axon_code(&self) -> &str
Return this ref as an Axon ref literal.
Trait Implementations§
impl Eq for Ref
impl StructuralPartialEq for Ref
Auto Trait Implementations§
impl Freeze for Ref
impl RefUnwindSafe for Ref
impl Send for Ref
impl Sync for Ref
impl Unpin for Ref
impl UnwindSafe for Ref
Blanket Implementations§
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