pub struct DbName(/* private fields */);Expand description
A validated database name — the only thing a workspace resolves.
Construct it with DbName::parse; there is no other way in, which is what
makes “a name is not a path” a property of the type rather than a rule
somebody has to remember at every call site.
Implementations§
Source§impl DbName
impl DbName
Sourcepub fn parse(s: &str) -> Result<Self, WorkspaceError>
pub fn parse(s: &str) -> Result<Self, WorkspaceError>
Validates s as a database name.
The rule: ASCII, first character [a-z0-9], the rest [a-z0-9_-],
length 1..=MAX_DB_NAME.
§Errors
WorkspaceError::BadName carrying the specific NameProblem.
Trait Implementations§
impl Eq for DbName
Source§impl Ord for DbName
impl Ord for DbName
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for DbName
impl PartialOrd for DbName
impl StructuralPartialEq for DbName
Auto Trait Implementations§
impl Freeze for DbName
impl RefUnwindSafe for DbName
impl Send for DbName
impl Sync for DbName
impl Unpin for DbName
impl UnsafeUnpin for DbName
impl UnwindSafe for DbName
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.