forked from Orchid/orchid
Protocols and operators mostly
This commit is contained in:
@@ -202,6 +202,11 @@ impl Sym {
|
||||
pub async fn parse(s: &str) -> Result<Self, EmptyNameError> {
|
||||
Ok(Sym(iv(&VName::parse(s).await?.into_vec()).await))
|
||||
}
|
||||
/// Read a `::` separated namespaced name from a static string where.
|
||||
pub async fn literal(s: &'static str) -> Self {
|
||||
assert!(!s.is_empty(), "Literal cannot be empty");
|
||||
Self::parse(s).await.unwrap()
|
||||
}
|
||||
/// Assert that a token isn't empty, and wrap it in a [Sym]
|
||||
pub fn from_tok(t: IStrv) -> Result<Self, EmptyNameError> {
|
||||
if t.is_empty() { Err(EmptyNameError) } else { Ok(Self(t)) }
|
||||
|
||||
Reference in New Issue
Block a user