Skip to main content

EventData

Enum EventData 

Source
pub enum EventData {
    None,
    Text(String),
    Uri(String),
    FocusState {
        is_focused: bool,
    },
    Dimensions {
        cols: u16,
        rows: u16,
    },
    TitleChange {
        old: String,
        new: String,
    },
    UserVar {
        name: String,
        value: String,
    },
    Selection {
        text: String,
        start: (u16, u16),
        end: (u16, u16),
    },
    ExitCode(i32),
    Binary(Vec<u8>),
}
Expand description

Event-specific data payload

Different events carry different types of data. This enum provides type-safe access to event payloads.

Variants§

§

None

No data

§

Text(String)

Plain text data (for output, input, etc.)

§

Uri(String)

URI/URL data (for OpenUri events)

§

FocusState

Focus state change

Fields

§is_focused: bool

Whether the object now has focus

§

Dimensions

Dimension change (for resize events)

Fields

§cols: u16

New width in columns

§rows: u16

New height in rows

§

TitleChange

Title change event

Fields

§old: String

Previous title

§new: String

New title

§

UserVar

User variable change (OSC 1337)

Fields

§name: String

Variable name

§value: String

Variable value

§

Selection

Text selection data

Fields

§text: String

Selected text content

§start: (u16, u16)

Selection start position (col, row)

§end: (u16, u16)

Selection end position (col, row)

§

ExitCode(i32)

Process exit code

§

Binary(Vec<u8>)

Raw binary data (for legacy hooks)

Implementations§

Source§

impl EventData

Source

pub fn as_text(&self) -> Option<&str>

Try to extract text data

Source

pub fn as_uri(&self) -> Option<&str>

Try to extract URI data

Source

pub fn as_focus_state(&self) -> Option<bool>

Try to extract focus state

Source

pub fn as_dimensions(&self) -> Option<(u16, u16)>

Try to extract dimensions

Source

pub fn as_title_change(&self) -> Option<(&str, &str)>

Try to extract title change data

Source

pub fn as_user_var(&self) -> Option<(&str, &str)>

Try to extract user variable data

Source

pub fn as_selection(&self) -> Option<(&str, (u16, u16), (u16, u16))>

Try to extract selection data

Source

pub fn as_exit_code(&self) -> Option<i32>

Try to extract exit code

Source

pub fn as_binary(&self) -> Option<&[u8]>

Try to extract binary data

Source

pub fn is_none(&self) -> bool

Check if this is empty/none data

Trait Implementations§

Source§

impl Clone for EventData

Source§

fn clone(&self) -> EventData

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EventData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EventData

Source§

fn default() -> EventData

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V