pub struct TempestStr<'a>(/* private fields */);Expand description
A validated, potentially borrowed string for use as a Tempest identifier (database name, table name, etc.).
Null bytes are rejected at construction time, since they are reserved as terminators in the lexical key encoding scheme. This keeps the encoding layer simple - identifier components can be written as raw bytes with no escaping required.
Borrows the input when possible (Cow::Borrowed) to avoid unnecessary
allocations. Use into_owned to promote to a 'static lifetime.
Implementations§
Source§impl<'a> TempestStr<'a>
impl<'a> TempestStr<'a>
Sourcepub fn from_borrowed(s: &'a str) -> Result<TempestStr<'a>, TempestStrError>
pub fn from_borrowed(s: &'a str) -> Result<TempestStr<'a>, TempestStrError>
Constructs a TempestStr borrowing from s.
§Errors
Returns TempestStrError::InputContainsNullByte if s contains a null byte.
Sourcepub const unsafe fn from_borrowed_unchecked(s: &'a str) -> TempestStr<'a>
pub const unsafe fn from_borrowed_unchecked(s: &'a str) -> TempestStr<'a>
Constructs a TempestStr borrowing from s.
§Safety
The caller must ensure that s does not contain any null byte.
Sourcepub fn from_owned(s: String) -> Result<TempestStr<'static>, TempestStrError>
pub fn from_owned(s: String) -> Result<TempestStr<'static>, TempestStrError>
Constructs a TempestStr from an owned String, yielding a 'static lifetime.
§Errors
Returns TempestStrError::InputContainsNullByte if s contains a null byte.
Sourcepub fn into_owned(self) -> TempestStr<'static>
pub fn into_owned(self) -> TempestStr<'static>
Converts this TempestStr into an owned 'static version, allocating
if the inner value is currently borrowed. No-op if it is already owned.
Trait Implementations§
Source§impl<'a> Clone for TempestStr<'a>
impl<'a> Clone for TempestStr<'a>
Source§fn clone(&self) -> TempestStr<'a>
fn clone(&self) -> TempestStr<'a>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more