pub struct WorkspaceId(/* private fields */);Expand description
The name a workspace has on disk: lower-case ASCII letters and digits, separated by -.
Generated from a display name with from_display_name and read
back from disk with parse. Every identifier is also a legal folder name, a
legal container name and a legal volume name, so the same string names the workspace
everywhere.
Implementations§
Source§impl WorkspaceId
impl WorkspaceId
Sourcepub const MAX_LEN: usize = 64
pub const MAX_LEN: usize = 64
The longest an identifier may be, in characters.
The identifier is part of qcode-home-<workspace>-<profile>, of a folder name below the
store and of a volume name; 64 leaves room for all of them inside the 255 characters
the strictest of them allows.
Sourcepub fn from_display_name(name: &str) -> Result<Self, WorkspaceIdError>
pub fn from_display_name(name: &str) -> Result<Self, WorkspaceIdError>
Builds the identifier of a workspace the user named name.
Letters fold to ASCII, everything else becomes a single -, and leading and trailing
separators — which is where a trailing dot or space ends up — are removed. A name a
device is called by is moved out of the way. The result never depends on the locale.
§Errors
WorkspaceIdError::Empty when nothing in name can be part of an identifier.
Sourcepub fn parse(text: &str) -> Result<Self, WorkspaceIdError>
pub fn parse(text: &str) -> Result<Self, WorkspaceIdError>
Reads an identifier that is already stored: a folder name, a key in the config or the
id of a workspace.qcode.
§Errors
Says which rule the text breaks, so the caller can point at it.
Sourcepub fn clashes_with(&self, name: &str) -> bool
pub fn clashes_with(&self, name: &str) -> bool
Whether a file system that ignores case would see name as this workspace’s folder.
Folding is ASCII only on purpose: an identifier holds nothing else, and a locale-aware fold would answer differently in a Turkish locale.
Trait Implementations§
Source§impl Clone for WorkspaceId
impl Clone for WorkspaceId
Source§impl Debug for WorkspaceId
impl Debug for WorkspaceId
Source§impl Display for WorkspaceId
impl Display for WorkspaceId
impl Eq for WorkspaceId
Source§impl Hash for WorkspaceId
impl Hash for WorkspaceId
Source§impl Ord for WorkspaceId
impl Ord for WorkspaceId
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for WorkspaceId
impl PartialEq for WorkspaceId
Source§impl PartialOrd for WorkspaceId
impl PartialOrd for WorkspaceId
impl StructuralPartialEq for WorkspaceId
Auto Trait Implementations§
impl Freeze for WorkspaceId
impl RefUnwindSafe for WorkspaceId
impl Send for WorkspaceId
impl Sync for WorkspaceId
impl Unpin for WorkspaceId
impl UnsafeUnpin for WorkspaceId
impl UnwindSafe for WorkspaceId
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
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more