pub struct TreeChanged {
pub model: String,
pub change: TreeChange,
pub key: Option<String>,
}Expand description
Dispatched after a write to a tree commits, so a listener can drop a cached menu or category list:
use laravel::event::{Event, listener};
use laravel_nestedset::TreeChanged;
#[listener]
async fn forget_the_menu(event: Event<TreeChanged>) {
if event.is_for::<Category>() {
// Drop the cached category menu...
}
}Fields§
§model: StringThe model’s name, M::META.name.
change: TreeChangeWhat happened.
key: Option<String>The key of the node that was created, moved, or deleted, as text. None for
TreeChange::Arranged and TreeChange::Fixed, which touch many nodes.
Implementations§
Source§impl TreeChanged
impl TreeChanged
Sourcepub fn dispatch(self) -> impl Future<Output = Result<()>> + Send
pub fn dispatch(self) -> impl Future<Output = Result<()>> + Send
Dispatch this event to its listeners, awaiting each listener in turn.
To learn more, see laravel::event::dispatch.
Sourcepub fn dispatch_background(self) -> Result<()>
pub fn dispatch_background(self) -> Result<()>
Dispatch this event in a background task, without waiting for its listeners.
To learn more, see laravel::event::dispatch_background.
Trait Implementations§
Source§impl Clone for TreeChanged
impl Clone for TreeChanged
Source§impl Debug for TreeChanged
impl Debug for TreeChanged
impl Eq for TreeChanged
Source§impl PartialEq for TreeChanged
impl PartialEq for TreeChanged
impl StructuralPartialEq for TreeChanged
Auto Trait Implementations§
impl Forget for TreeChanged
impl Freeze for TreeChanged
impl Move for TreeChanged
impl RefUnwindSafe for TreeChanged
impl Send for TreeChangedwhere
RawVecInner: Send,
impl Sync for TreeChangedwhere
RawVecInner: Sync,
impl Unpin for TreeChanged
impl UnsafeUnpin for TreeChanged
impl UnwindSafe for TreeChangedwhere
RawVecInner: UnwindSafe,
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
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
Compare self to
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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