pub struct IdentStr(/* private fields */);Expand description
A borrowed identifier.
For more details, see the module level documentation.
Implementations§
Source§impl IdentStr
impl IdentStr
pub fn new(s: &str) -> Result<&IdentStr, InvalidIdentifierError>
Sourcepub const fn cast(s: &'static str) -> &'static IdentStr
pub const fn cast(s: &'static str) -> &'static IdentStr
Compile-time validated constructor from static string slice.
§Example
Creating a valid static or const IdentStr:
use af_sui_types::IdentStr;
const VALID_IDENT: &'static IdentStr = IdentStr::cast("MyCoolIdentifier");
const THING_NAME: &'static str = "thing_name";
const THING_IDENT: &'static IdentStr = IdentStr::cast(THING_NAME);In contrast, creating an invalid IdentStr will fail at compile time:
ⓘ
use af_sui_types::IdentStr;
const INVALID_IDENT: &'static IdentStr = IdentStr::cast("123Foo"); // Fails to compile!Trait Implementations§
Source§impl Borrow<IdentStr> for Identifier
impl Borrow<IdentStr> for Identifier
impl Eq for IdentStr
Source§impl PartialOrd for IdentStr
impl PartialOrd for IdentStr
impl StructuralPartialEq for IdentStr
Source§impl ToOwned for IdentStr
impl ToOwned for IdentStr
Source§type Owned = Identifier
type Owned = Identifier
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> Identifier
fn to_owned(&self) -> Identifier
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more
Auto Trait Implementations§
impl !Sized for IdentStr
impl Freeze for IdentStr
impl RefUnwindSafe for IdentStr
impl Send for IdentStr
impl Sync for IdentStr
impl Unpin for IdentStr
impl UnsafeUnpin for IdentStr
impl UnwindSafe for IdentStr
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