pub enum ModeActivationError {
NotRegistered(ModeId),
MissingCapability {
mode: ModeId,
missing: CapabilitySet,
},
Conflict {
mode: ModeId,
active: ModeId,
},
UnregisteredDependency {
mode: ModeId,
dep: ModeId,
},
WrongKind {
mode: ModeId,
},
LifecycleFailed {
mode: ModeId,
reason: String,
},
WrongOwnerMode {
current: ModeId,
local: &'static str,
owner: &'static str,
},
}Expand description
Why an activation failed.
Two routes, and they reach different places. The registry validates
registration, kind, capabilities, conflicts and dependency presence
synchronously before any lifecycle hook runs: those variants are the
Err of activate_major / activate_minor, nothing ran, nothing was
published, and the active set is unchanged. An error returned by
on_activate (normally LifecycleFailed)
arrives after the activate call has already returned Ok; it is
published as ModeEvent::ModeActivationFailed
and the host rolls back.
Variants§
NotRegistered(ModeId)
mode is not in the registry. Either typo’d or not
registered yet.
MissingCapability
Buffer lacks one or more capabilities the mode requires.
missing is the bitfield of the absent capabilities
(i.e. mode.required_capabilities() - buffer_capabilities).
Fields
missing: CapabilitySetThe required capabilities the buffer does not offer.
Conflict
Activating mode would conflict with active – a
declared conflicts_with entry on either side. Raised when
activating a minor (directly or via an implies cascade); the
registry never auto-deactivates the other mode, so the caller
must deactivate it and retry if the swap is wanted.
Fields
UnregisteredDependency
mode declares an implies dependency on dep, but
dep is not registered. Indicates a build-config bug
(a feature crate registered the parent without its
dependency).
Fields
WrongKind
Wrong kind: caller invoked activate_major on a minor
mode or vice versa. Indicates a type-bug in the caller;
the trait’s kind() answers what’s expected.
LifecycleFailed
A mode’s on_activate failed. The variant a mode constructs
itself (with its own id and a human-readable reason) when setup
cannot complete — return it rather than panicking.
WrongOwnerMode
A mode tried to write a buffer-local owned by a
different mode (M.3.2.a). Reserved for the checked
ModeContext::set_local / remove_local surface the design
describes (comparing T::OWNER_MODE against the activating mode’s
id); that surface is not implemented, so nothing constructs this
variant today. See BufferLocal.
Trait Implementations§
Source§impl Clone for ModeActivationError
impl Clone for ModeActivationError
Source§fn clone(&self) -> ModeActivationError
fn clone(&self) -> ModeActivationError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ModeActivationError
impl Debug for ModeActivationError
Source§impl Display for ModeActivationError
impl Display for ModeActivationError
impl Eq for ModeActivationError
Source§impl Error for ModeActivationError
impl Error for ModeActivationError
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 PartialEq for ModeActivationError
impl PartialEq for ModeActivationError
impl StructuralPartialEq for ModeActivationError
Auto Trait Implementations§
impl Freeze for ModeActivationError
impl RefUnwindSafe for ModeActivationError
impl Send for ModeActivationError
impl Sync for ModeActivationError
impl Unpin for ModeActivationError
impl UnsafeUnpin for ModeActivationError
impl UnwindSafe for ModeActivationError
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.