pub enum ActionInput {
Show 21 variants
None,
RouteChanged {
location: RouteLocation,
},
JobOk {
job_name: String,
req_id: u64,
payload: Vec<u8>,
},
JobErr {
job_name: String,
req_id: u64,
payload: Option<Vec<u8>>,
message: Option<String>,
},
ServiceStarted {
service_name: String,
slot_key: String,
instance_id: u64,
},
ServiceStartFailed {
service_name: String,
slot_key: String,
payload: Option<Vec<u8>>,
message: Option<String>,
},
ServiceEvent {
service_name: String,
slot_key: String,
instance_id: u64,
payload: Vec<u8>,
},
ServiceStopped {
service_name: String,
slot_key: String,
instance_id: u64,
},
ServiceCommandOk {
service_name: String,
slot_key: String,
instance_id: u64,
req_id: u64,
payload: Option<Vec<u8>>,
},
ServiceCommandErr {
service_name: String,
slot_key: String,
instance_id: u64,
req_id: u64,
payload: Option<Vec<u8>>,
message: Option<String>,
},
CapabilityOk {
capability: String,
req_id: u64,
payload: Vec<u8>,
},
CapabilityErr {
capability: String,
req_id: u64,
payload: Option<Vec<u8>>,
message: Option<String>,
},
TimerTick {
payload: Vec<u8>,
},
Pointer {
x: f32,
y: f32,
delta_x: f32,
delta_y: f32,
},
TextChanged(UpdateTextInput),
TextSelectionChanged(UpdateTextSelection),
ViewportInteraction(ViewportInteraction),
CanvasInteraction(CanvasInteraction),
Drop {
paths: Vec<String>,
x: f32,
y: f32,
modifiers: u8,
},
InternalDrop {
payload: Vec<u8>,
x: f32,
y: f32,
modifiers: u8,
},
ScopedRaw {
scope_id: u128,
target: WidgetId,
input: Box<ActionInput>,
},
}Expand description
Extra input data passed alongside an action dispatch.
When the platform delivers an effect result or a drag-and-drop event, it
attaches an ActionInput so the reducer can access the associated data
without encoding it in the action payload.
§Example
fn on_file_loaded(
state: &mut MyState,
_action: FileLoaded,
ctx: &mut ReducerContext<MyState>,
) {
if let Some(bytes) = ctx.input.as_bytes() {
state.file_contents = String::from_utf8_lossy(bytes).into_owned();
}
}Variants§
None
No extra input.
RouteChanged
The host shell delivered a route/navigation change.
Fields
location: RouteLocationJobOk
A typed async job completed successfully.
JobErr
A typed async job failed.
ServiceStarted
A service slot started successfully.
ServiceStartFailed
A service slot failed to start.
ServiceEvent
A running service emitted an event.
ServiceStopped
A running service stopped.
ServiceCommandOk
A service command completed successfully.
ServiceCommandErr
A service command failed.
Fields
CapabilityOk
A typed capability operation succeeded.
CapabilityErr
A typed capability operation failed.
TimerTick
A timer resource fired.
Pointer
Pointer coordinates and deltas (used by drag/gesture handlers).
TextChanged(UpdateTextInput)
Runtime details accompanying a text-input action.
The action envelope retains the application-defined payload, while this input carries the edited value and selection independently.
TextSelectionChanged(UpdateTextSelection)
Runtime details accompanying a selection/caret-only action.
ViewportInteraction(ViewportInteraction)
Runtime details accompanying an interactive viewport action.
CanvasInteraction(CanvasInteraction)
Runtime details accompanying an InfiniteCanvas action.
Drop
External file drop (e.g. from the OS file manager).
Fields
InternalDrop
Internal drag-and-drop with an opaque byte payload.
Fields
ScopedRaw
The action was dispatched from a subtree with a raw action scope.
Implementations§
Source§impl ActionInput
impl ActionInput
Sourcepub fn encode_opaque(&self) -> Result<Vec<u8>, ActionInputCodecError>
pub fn encode_opaque(&self) -> Result<Vec<u8>, ActionInputCodecError>
Encodes this runtime input into an opaque representation suitable for storage or transport.
Sourcepub fn decode_opaque(bytes: &[u8]) -> Result<Self, ActionInputCodecError>
pub fn decode_opaque(bytes: &[u8]) -> Result<Self, ActionInputCodecError>
Decodes an input previously produced by Self::encode_opaque.
pub fn scoped_raw(scope_id: u128, target: WidgetId, input: ActionInput) -> Self
pub fn action_scope_id(&self) -> Option<u128>
pub fn scoped_target(&self) -> Option<WidgetId>
pub fn unscoped(&self) -> &ActionInput
pub fn as_bytes(&self) -> Option<&[u8]>
pub fn as_pointer(&self) -> Option<(f32, f32, f32, f32)>
Sourcepub fn text_change(&self) -> Option<&UpdateTextInput>
pub fn text_change(&self) -> Option<&UpdateTextInput>
Returns the edit accompanying a text-input action.
Scoped actions are unwrapped automatically, matching the other typed input accessors.
pub fn text_selection_change(&self) -> Option<&UpdateTextSelection>
Sourcepub fn viewport_interaction(&self) -> Option<&ViewportInteraction>
pub fn viewport_interaction(&self) -> Option<&ViewportInteraction>
Returns the camera change accompanying an interactive-viewport action.
Sourcepub fn canvas_interaction(&self) -> Option<&CanvasInteraction>
pub fn canvas_interaction(&self) -> Option<&CanvasInteraction>
Returns the node, edge, resize, or marquee change for a canvas action.
pub fn as_drop_paths(&self) -> Option<&[String]>
pub fn as_internal_drop(&self) -> Option<&[u8]>
Sourcepub fn as_drop_modifiers(&self) -> Option<u8>
pub fn as_drop_modifiers(&self) -> Option<u8>
Modifier bitmask active during a drop action.
This lets app reducers choose copy/move/link semantics without binding that product rule into the drag runtime itself.
pub fn job_ok<J: JobSpec>(&self, job: JobRef<J>) -> Option<J::Ok>
pub fn job_err<J: JobSpec>(&self, job: JobRef<J>) -> Option<J::Err>
pub fn job_error_message<J: JobSpec>(&self, job: JobRef<J>) -> Option<&str>
pub fn capability_ok<C: OperationCapability>( &self, capability: CapabilityType<C>, ) -> Option<C::Ok>
pub fn capability_error<C: OperationCapability>( &self, capability: CapabilityType<C>, ) -> Option<C::Err>
pub fn capability_error_message<C: OperationCapability>( &self, capability: CapabilityType<C>, ) -> Option<&str>
pub fn service_event<S: ServiceSpec>( &self, service: ServiceType<S>, ) -> Option<S::Event>
pub fn service_start_err<S: ServiceSpec>( &self, service: ServiceType<S>, ) -> Option<S::StartErr>
pub fn service_start_error_message<S: ServiceSpec>( &self, service: ServiceType<S>, ) -> Option<&str>
pub fn service_command_ok<S: ServiceSpec>( &self, service: ServiceType<S>, ) -> Option<S::CommandOk>
pub fn service_command_err<S: ServiceSpec>( &self, service: ServiceType<S>, ) -> Option<S::CommandErr>
pub fn timer_tick<T: DeserializeOwned>(&self) -> Option<T>
pub fn service_slot_key(&self) -> Option<&str>
pub fn service_instance_id(&self) -> Option<u64>
Trait Implementations§
Source§impl Clone for ActionInput
impl Clone for ActionInput
Source§fn clone(&self) -> ActionInput
fn clone(&self) -> ActionInput
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ActionInput
impl Debug for ActionInput
Source§impl<'de> Deserialize<'de> for ActionInput
impl<'de> Deserialize<'de> for ActionInput
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ActionInput
impl PartialEq for ActionInput
Source§impl Serialize for ActionInput
impl Serialize for ActionInput
impl StructuralPartialEq for ActionInput
Auto Trait Implementations§
impl Freeze for ActionInput
impl RefUnwindSafe for ActionInput
impl Send for ActionInput
impl Sync for ActionInput
impl Unpin for ActionInput
impl UnsafeUnpin for ActionInput
impl UnwindSafe for ActionInput
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.