Skip to main content

OutgoingEvent

Struct OutgoingEvent 

Source
pub struct OutgoingEvent {
    pub message_type: &'static str,
    pub session: String,
    pub family: String,
    pub id: String,
    pub value: Option<Value>,
    pub tag: Option<String>,
    pub modifiers: Option<KeyModifiers>,
    pub data: Option<Value>,
    pub captured: Option<bool>,
}
Expand description

An event written to stdout by the renderer.

All events share a flat struct with optional fields. There are two constructor patterns:

  • Widget events (click, input, toggle, etc.) use id to identify the source widget. Built via bare.
  • Subscription events (key_press, cursor_moved, window_opened, etc.) use tag to identify the subscription that requested them. Built via tagged. The id field is empty.

Extension authors emit custom events via extension_event.

Fields§

§message_type: &'static str

Always "event".

§session: String

Session that produced this event.

§family: String

Event type (e.g. "click", "key_press", "window_opened").

§id: String

Source widget node ID (widget events) or empty (subscription events).

§value: Option<Value>

Primary value payload (e.g. input text, slider value, selected option).

§tag: Option<String>

Subscription tag identifying which subscription requested this event.

§modifiers: Option<KeyModifiers>

Keyboard modifier state at the time of the event.

§data: Option<Value>

Flexible extra data for events that carry additional fields beyond the standard id/value/tag/modifiers shape.

§captured: Option<bool>

Whether the event was captured (consumed) by an iced widget before reaching the subscription listener. Present on keyboard, mouse, touch, and IME events; absent on widget-level events.

Implementations§

Source§

impl OutgoingEvent

Source

pub fn with_captured(self, captured: bool) -> Self

Mark the event with its capture status.

Source

pub fn with_session(self, session: impl Into<String>) -> Self

Set the session ID for this event.

Source§

impl OutgoingEvent

Source

pub fn generic( family: impl Into<String>, id: String, data: Option<Value>, ) -> Self

Generic widget event with a family string and optional data payload. Used for on_open, on_close, sort, and other events.

Source

pub fn extension_event(family: String, id: String, data: Option<Value>) -> Self

Convenience constructor for extension-emitted events.

Source

pub fn click(id: String) -> Self

Source

pub fn input(id: String, value: String) -> Self

Source

pub fn submit(id: String, value: String) -> Self

Source

pub fn toggle(id: String, checked: bool) -> Self

Source

pub fn slide(id: String, value: f64) -> Self

Source

pub fn slide_release(id: String, value: f64) -> Self

Source

pub fn select(id: String, value: String) -> Self

Source

pub fn key_press(tag: String, data: &KeyEventData) -> Self

Source

pub fn key_release(tag: String, data: &KeyEventData) -> Self

Source

pub fn modifiers_changed(tag: String, modifiers: KeyModifiers) -> Self

Source

pub fn cursor_moved(tag: String, x: f32, y: f32) -> Self

Source

pub fn cursor_entered(tag: String) -> Self

Source

pub fn cursor_left(tag: String) -> Self

Source

pub fn button_pressed(tag: String, button: String) -> Self

Source

pub fn button_released(tag: String, button: String) -> Self

Source

pub fn wheel_scrolled( tag: String, delta_x: f32, delta_y: f32, unit: &str, ) -> Self

Source

pub fn finger_pressed(tag: String, finger_id: u64, x: f32, y: f32) -> Self

Source

pub fn finger_moved(tag: String, finger_id: u64, x: f32, y: f32) -> Self

Source

pub fn finger_lifted(tag: String, finger_id: u64, x: f32, y: f32) -> Self

Source

pub fn finger_lost(tag: String, finger_id: u64, x: f32, y: f32) -> Self

Source

pub fn ime_opened(tag: String) -> Self

Source

pub fn ime_preedit( tag: String, text: String, cursor: Option<Range<usize>>, ) -> Self

Source

pub fn ime_commit(tag: String, text: String) -> Self

Source

pub fn ime_closed(tag: String) -> Self

Source

pub fn window_opened( tag: String, window_id: String, position: Option<(f32, f32)>, width: f32, height: f32, scale_factor: f32, ) -> Self

Source

pub fn window_closed(tag: String, window_id: String) -> Self

Source

pub fn window_close_requested(tag: String, window_id: String) -> Self

Source

pub fn window_moved(tag: String, window_id: String, x: f32, y: f32) -> Self

Source

pub fn window_resized( tag: String, window_id: String, width: f32, height: f32, ) -> Self

Source

pub fn window_focused(tag: String, window_id: String) -> Self

Source

pub fn window_unfocused(tag: String, window_id: String) -> Self

Source

pub fn window_rescaled( tag: String, window_id: String, scale_factor: f32, ) -> Self

Source

pub fn file_hovered(tag: String, window_id: String, path: String) -> Self

Source

pub fn file_dropped(tag: String, window_id: String, path: String) -> Self

Source

pub fn files_hovered_left(tag: String, window_id: String) -> Self

Source

pub fn animation_frame(tag: String, timestamp_millis: u128) -> Self

Source

pub fn theme_changed(tag: String, mode: String) -> Self

Source

pub fn sensor_resize(id: String, width: f32, height: f32) -> Self

Source

pub fn canvas_press(id: String, x: f32, y: f32, button: String) -> Self

Source

pub fn canvas_release(id: String, x: f32, y: f32, button: String) -> Self

Source

pub fn canvas_move(id: String, x: f32, y: f32) -> Self

Source

pub fn canvas_scroll( id: String, x: f32, y: f32, delta_x: f32, delta_y: f32, ) -> Self

Source

pub fn mouse_right_press(id: String) -> Self

Source

pub fn mouse_right_release(id: String) -> Self

Source

pub fn mouse_middle_press(id: String) -> Self

Source

pub fn mouse_middle_release(id: String) -> Self

Source

pub fn mouse_double_click(id: String) -> Self

Source

pub fn mouse_enter(id: String) -> Self

Source

pub fn mouse_exit(id: String) -> Self

Source

pub fn mouse_area_move(id: String, x: f32, y: f32) -> Self

Source

pub fn mouse_area_scroll(id: String, delta_x: f32, delta_y: f32) -> Self

Source

pub fn pane_resized(id: String, split: String, ratio: f32) -> Self

Source

pub fn pane_dragged( id: String, kind: &str, pane: String, target: Option<String>, region: Option<&str>, edge: Option<&str>, ) -> Self

Source

pub fn pane_clicked(id: String, pane: String) -> Self

Source

pub fn pane_focus_cycle(id: String, pane: String) -> Self

Source

pub fn paste(id: String, text: String) -> Self

Source

pub fn scripting_key_press(key: String, modifiers_json: Value) -> Self

Key press event from scripting (no full KeyEventData).

Source

pub fn scripting_key_release(key: String, modifiers_json: Value) -> Self

Key release event from scripting (no full KeyEventData).

Source

pub fn scripting_cursor_moved(x: f64, y: f64) -> Self

Cursor moved event from scripting.

Source

pub fn scripting_scroll(delta_x: f64, delta_y: f64) -> Self

Scroll event from scripting.

Source

pub fn option_hovered(id: String, value: String) -> Self

Source

pub fn scroll( id: String, abs_x: f32, abs_y: f32, rel_x: f32, rel_y: f32, bounds_w: f32, bounds_h: f32, content_w: f32, content_h: f32, ) -> Self

Trait Implementations§

Source§

impl Debug for OutgoingEvent

Source§

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

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

impl Serialize for OutgoingEvent

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> 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> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

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>

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)

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)

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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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<State, Message> IntoBoot<State, Message> for State

Source§

fn into_boot(self) -> (State, Task<Message>)

Turns some type into the initial state of some Application.
Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> MaybeClone for T

Source§

impl<T> MaybeDebug for T

Source§

impl<T> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,