pub enum OnFailure {
Deny,
Allow,
}Expand description
What to do when a hook cannot answer.
The default is Self::Deny. A hook exists to have a say over whether a
call happens and in what form, so a configured hook is by construction
something whose opinion the operator wanted; when it cannot speak, nobody
knows what it would have said. The two failure modes are not symmetric:
allowing on a broken guard quietly removes a control the operator believes
is in place, while denying on a broken observer produces a loud failure that
gets fixed within the minute. Prefer the failure that announces itself.
Self::Allow is there because “observer” is a real use — a hook that logs
or notifies has no business stopping a turn when its network call times out.
It is a per-hook choice, and it is written down in the file rather than
inferred.
The in-process binding has no equivalent and needs none: an
Interceptor that would rather be ignored returns
HookOutcome::Allow itself, in code it already
owns. Failing is what a host cannot describe from inside a crash, and that
is the case this enum answers.
Variants§
Deny
Treat a broken hook as a refusal.
What a refusal costs depends on when the hook was asked. Before the call it does not run; afterwards it already has, so the model is shown the failure in place of the output. Both are the same ruling — a guard that could not speak has not cleared anything — and after the call it is the only part of it still available.
Allow
Treat a broken hook as no opinion, and carry on.
Trait Implementations§
impl Copy for OnFailure
Source§impl<'de> Deserialize<'de> for OnFailure
impl<'de> Deserialize<'de> for OnFailure
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for OnFailure
impl StructuralPartialEq for OnFailure
Auto Trait Implementations§
impl Freeze for OnFailure
impl RefUnwindSafe for OnFailure
impl Send for OnFailure
impl Sync for OnFailure
impl Unpin for OnFailure
impl UnsafeUnpin for OnFailure
impl UnwindSafe for OnFailure
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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.