Protocols and operators mostly

This commit is contained in:
2026-01-21 22:22:58 +01:00
parent 75b05a2965
commit f38193edcc
33 changed files with 578 additions and 147 deletions

View File

@@ -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)) }