Struct HookDecision
pub struct HookDecision {
pub point: String,
pub verdict: String,
pub reason: Option<String>,
pub plugin: Option<String>,
}Expand description
One decision a hook set made about a call, as the call’s step records it (ADR 0050, decision 2).
The point and the verdict are words, not closed enums, because the journal is read by whatever
build finds it: a later build that adds a verdict or a point writes a record this one reads as
“some hook decided”, instead of failing the replay that reads it. Only a verdict other than
Continue is recorded; a rewrite is recorded as the arguments the call ran with
(HookedOutput::args) or as the output it produced.
Fields§
§point: StringThe point the hook ran at: TOOL_BEFORE or TOOL_AFTER.
verdict: String§reason: Option<String>Why, as a person reads it. Absent when the verdict carries no words.
plugin: Option<String>The plugin that could not decide, for a failed decision. Absent otherwise:
HookSet answers a verdict without saying which plugin gave it.
Implementations§
§impl HookDecision
impl HookDecision
pub const TOOL_BEFORE: &'static str = "tool.before"
pub const TOOL_BEFORE: &'static str = "tool.before"
The point before the call runs.
pub const TOOL_AFTER: &'static str = "tool.after"
pub const TOOL_AFTER: &'static str = "tool.after"
The point after the tool answered.
pub const MESSAGE_RECEIVED: &'static str = adam_plugin::MESSAGE_RECEIVED
pub const MESSAGE_RECEIVED: &'static str = adam_plugin::MESSAGE_RECEIVED
The point where a person’s message is about to reach a model (ADR 0050, decision 9).
pub const ASK: &'static str = "ask"
pub const ASK: &'static str = "ask"
A person is asked first (ADR 0050, decision 12, slice H8). A record written since H8 says
so in HookedOutput::approval too, and the run parks on the question; a record written
before it (no approval) left the call unrun, and a replay reads it the same way.
pub const FAILED: &'static str = "failed"
pub const FAILED: &'static str = "failed"
The hook could not decide: the call is denied, or the result becomes an error. Never a pass.
pub fn new(point: &str, verdict: &str, reason: Option<&str>) -> HookDecision
pub fn new(point: &str, verdict: &str, reason: Option<&str>) -> HookDecision
A decision at point that said verdict.
pub fn by(self, plugin: &str) -> HookDecision
pub fn by(self, plugin: &str) -> HookDecision
The same decision, naming the plugin that could not decide.
Trait Implementations§
§impl Clone for HookDecision
impl Clone for HookDecision
§fn clone(&self) -> HookDecision
fn clone(&self) -> HookDecision
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for HookDecision
impl Debug for HookDecision
§impl<'de> Deserialize<'de> for HookDecision
impl<'de> Deserialize<'de> for HookDecision
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<HookDecision, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<HookDecision, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for HookDecision
§impl PartialEq for HookDecision
impl PartialEq for HookDecision
§impl Serialize for HookDecision
impl Serialize for HookDecision
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for HookDecision
Auto Trait Implementations§
impl Freeze for HookDecision
impl RefUnwindSafe for HookDecision
impl Send for HookDecision
impl Sync for HookDecision
impl Unpin for HookDecision
impl UnsafeUnpin for HookDecision
impl UnwindSafe for HookDecision
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<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].