pub enum TabEvent {
Opened(TabId),
Closed(TabId),
ActiveChanged {
previous: Option<TabId>,
current: Option<TabId>,
},
NavStateChanged(TabId),
}Expand description
One tab lifecycle or navigation event, carried alongside each
TabsSnapshot published to subscribers.
Variants§
Opened(TabId)
Closed(TabId)
A BACKGROUND tab closed.
Closing the ACTIVE tab publishes TabEvent::ActiveChanged instead,
with previous: Some(id) naming the tab that went — see that variant.
One mutation carries exactly one event, because this rides a watch,
whose send overwrites: two publishes from inside a single close()
would leave the first provably unobservable (nothing can be scheduled
between them — close is synchronous and holds the registry’s write
lock throughout), so this is a contract to state rather than a second
event to emit.
A consumer that needs “which tab closed” for either case reads
previous on ActiveChanged and this id here; one that needs to tell a
close from a plain switch cannot, and that is the residual — stated
here rather than left to be discovered.
ActiveChanged
The active tab changed — by an explicit switch, or because the
previously active tab was closed and a neighbor took over (current: None if it was the last tab — the well-defined empty state).
Trait Implementations§
impl Copy for TabEvent
impl Eq for TabEvent
impl StructuralPartialEq for TabEvent
Auto Trait Implementations§
impl Freeze for TabEvent
impl RefUnwindSafe for TabEvent
impl Send for TabEvent
impl Sync for TabEvent
impl Unpin for TabEvent
impl UnsafeUnpin for TabEvent
impl UnwindSafe for TabEvent
Blanket Implementations§
impl<T> Boilerplate for T
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,
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.impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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