pub struct HookResult {
pub handled: bool,
pub prevent_default: bool,
pub stop_propagation: bool,
pub value: Option<Value>,
pub error: Option<String>,
pub notices: Vec<Notice>,
pub plugin: Option<String>,
}Expand description
Result returned by a plugin hook handler.
Fields§
§handled: boolWhether the hook was handled.
prevent_default: boolWhether to prevent default behavior.
stop_propagation: boolWhether to stop propagation to other plugins.
value: Option<Value>Return value from the hook (if any).
error: Option<String>Error message (if hook failed).
notices: Vec<Notice>Messages the plugin asked the explorer to show.
plugin: Option<String>The plugin that produced this result, filled in by the manager.
Implementations§
Source§impl HookResult
impl HookResult
Sourcepub fn with_value(value: impl Into<Value>) -> Self
pub fn with_value(value: impl Into<Value>) -> Self
Create a result with a return value.
Sourcepub fn prevent_default(self) -> Self
pub fn prevent_default(self) -> Self
Mark this result as preventing default behavior.
Sourcepub fn stop_propagation(self) -> Self
pub fn stop_propagation(self) -> Self
Mark this result as stopping propagation.
Trait Implementations§
Source§impl Clone for HookResult
impl Clone for HookResult
Source§impl Debug for HookResult
impl Debug for HookResult
Source§impl Default for HookResult
impl Default for HookResult
Source§impl<'de> Deserialize<'de> for HookResult
impl<'de> Deserialize<'de> for HookResult
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HookResult
impl RefUnwindSafe for HookResult
impl Send for HookResult
impl Sync for HookResult
impl Unpin for HookResult
impl UnsafeUnpin for HookResult
impl UnwindSafe for HookResult
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
Mutably borrows from an owned value. Read more
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
Converts
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> ⓘ
Converts
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