pub enum BadProfile {
InvalidName {
name: String,
reason: BadName,
},
Missing {
name: String,
dir: PathBuf,
},
}Expand description
Why a profile name cannot be used.
Returned rather than flattened into a message so a caller wording the refusal
itself, e.g. to offer to create the profile, gets the reason and the path it
would go at instead of a sentence it would have to re-derive both from.
Travels inside Error::BadProfile out of operations that have other ways
to fail, so no such operation has to give up its single error type or its
composition to keep the reason intact.
Deliberately not #[non_exhaustive], matching super::NotRemovable: a
caller that words each refusal should stop compiling when a new reason
appears, rather than printing a generic fallback for a case nobody worded.
Error being #[non_exhaustive] does not weaken that: the wildcard arm a
client needs there is for other kinds of failure, not for other refusals.
Variants§
InvalidName
The name is refused by validate_name or, for an existing profile,
could escape the profiles directory.
Missing
No profile directory exists at dir.
Trait Implementations§
Source§impl Clone for BadProfile
impl Clone for BadProfile
Source§impl Debug for BadProfile
impl Debug for BadProfile
Source§impl Display for BadProfile
impl Display for BadProfile
impl Eq for BadProfile
Source§impl Error for BadProfile
impl Error for BadProfile
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<BadProfile> for Error
impl From<BadProfile> for Error
Source§fn from(source: BadProfile) -> Self
fn from(source: BadProfile) -> Self
Source§impl PartialEq for BadProfile
impl PartialEq for BadProfile
impl StructuralPartialEq for BadProfile
Auto Trait Implementations§
impl Forget for BadProfile
impl Freeze for BadProfile
impl Move for BadProfile
impl RefUnwindSafe for BadProfile
impl Send for BadProfile
impl Sync for BadProfile
impl Unpin for BadProfile
impl UnsafeUnpin for BadProfile
impl UnwindSafe for BadProfile
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
key and return true if they are equal.