pub struct Symbol {
pub namespace: Option<Arc<str>>,
pub name: Arc<str>,
pub version: Option<Arc<str>>,
}Expand description
An interned Clojure symbol, optionally namespace-qualified, optionally
pinned to a git commit via the @<hash> suffix syntax.
"foo" → Symbol { namespace: None, name: "foo", version: None }
"ns/name" → Symbol { namespace: Some("ns"), name: "name", version: None }
"my-fn@abc1234" → Symbol { namespace: None, name: "my-fn", version: Some("abc1234") }
"ns/fn@abc1234" → Symbol { namespace: Some("ns"), name: "fn", version: Some("abc1234") }
Fields§
§namespace: Option<Arc<str>>§name: Arc<str>§version: Option<Arc<str>>Git commit hash suffix, present when the symbol was written as name@hash.
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub fn qualified(ns: impl Into<Arc<str>>, name: impl Into<Arc<str>>) -> Self
pub fn qualified(ns: impl Into<Arc<str>>, name: impl Into<Arc<str>>) -> Self
Namespace-qualified, unversioned symbol.
Sourcepub fn parse(s: &str) -> Self
pub fn parse(s: &str) -> Self
Parse a symbol from a string of the form "ns/name", "name",
"name@hash", or "ns/name@hash".
The @ version suffix is detected in the name portion (after any /
split). A bare "/" remains an unqualified symbol as before.
Sourcepub fn full_name(&self) -> String
pub fn full_name(&self) -> String
The unversioned, fully-qualified string: "ns/name" or "name".
Sourcepub fn versioned_name(&self) -> String
pub fn versioned_name(&self) -> String
The display string including the version suffix if present:
"ns/name@hash" or "name@hash" or "name".