From f62059fbf238faa1c6cb595c16a10f842786090d Mon Sep 17 00:00:00 2001 From: LesterEvSe Date: Fri, 27 Mar 2026 20:12:05 +0200 Subject: [PATCH] feat: implement `From<&str>` and `AsRef` for `Identifier` --- src/str.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/str.rs b/src/str.rs index c06c33dd..f49592df 100644 --- a/src/str.rs +++ b/src/str.rs @@ -118,6 +118,18 @@ impl<'a> arbitrary::Arbitrary<'a> for FunctionName { #[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] pub struct Identifier(Arc); +impl From<&str> for Identifier { + fn from(s: &str) -> Self { + Self(Arc::from(s)) + } +} + +impl AsRef for Identifier { + fn as_ref(&self) -> &str { + &self.0 + } +} + wrapped_string!(Identifier, "variable identifier"); impl_arbitrary_lowercase_alpha!(Identifier);