pub struct ScriptEventForwarder { /* private fields */ }Expand description
Bridge between core terminal observer events and the scripting JSON protocol.
Register an Arc<ScriptEventForwarder> with Terminal::add_observer().
The forwarder buffers converted events; the owner drains them via
[drain_events] and serialises them to script sub-processes.
Implementations§
Source§impl ScriptEventForwarder
impl ScriptEventForwarder
Sourcepub fn new(subscriptions: Option<HashSet<String>>) -> ScriptEventForwarder
pub fn new(subscriptions: Option<HashSet<String>>) -> ScriptEventForwarder
Create a new forwarder.
§Arguments
subscriptions- IfSome, only events whose snake_case kind name is in the set will be captured. IfNone, all events are captured.
Sourcepub fn drain_events(&self) -> Vec<ScriptEvent>
pub fn drain_events(&self) -> Vec<ScriptEvent>
Drain all buffered events, returning them and clearing the buffer.
Trait Implementations§
Source§impl TerminalObserver for ScriptEventForwarder
impl TerminalObserver for ScriptEventForwarder
Source§fn on_event(&self, event: &TerminalEvent)
fn on_event(&self, event: &TerminalEvent)
Called for ALL events (catch-all). Called after category-specific methods.
Source§fn on_zone_event(&self, _event: &TerminalEvent)
fn on_zone_event(&self, _event: &TerminalEvent)
Called for zone lifecycle events (ZoneOpened, ZoneClosed, ZoneScrolledOut)
Source§fn on_command_event(&self, _event: &TerminalEvent)
fn on_command_event(&self, _event: &TerminalEvent)
Called for command/shell integration events (ShellIntegrationEvent)
Source§fn on_environment_event(&self, _event: &TerminalEvent)
fn on_environment_event(&self, _event: &TerminalEvent)
Called for environment changes (CwdChanged, EnvironmentChanged,
RemoteHostTransition, SubShellDetected)
Source§fn on_screen_event(&self, _event: &TerminalEvent)
fn on_screen_event(&self, _event: &TerminalEvent)
Called for screen content events (BellRang, TitleChanged, SizeChanged,
ModeChanged, GraphicsAdded, HyperlinkAdded, DirtyRegion, UserVarChanged,
ProgressBarChanged, BadgeChanged, TriggerMatched)
Source§fn subscriptions(&self) -> Option<&HashSet<TerminalEventKind>>
fn subscriptions(&self) -> Option<&HashSet<TerminalEventKind>>
Which event kinds this observer is interested in (None = all)
Auto Trait Implementations§
impl !Freeze for ScriptEventForwarder
impl RefUnwindSafe for ScriptEventForwarder
impl Send for ScriptEventForwarder
impl Sync for ScriptEventForwarder
impl Unpin for ScriptEventForwarder
impl UnsafeUnpin for ScriptEventForwarder
impl UnwindSafe for ScriptEventForwarder
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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