pub enum ActionInput {
Show 16 variants
None,
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,
},
Drop {
paths: Vec<String>,
x: f32,
y: f32,
},
InternalDrop {
payload: Vec<u8>,
x: f32,
y: f32,
},
ScopedRaw {
scope_id: u128,
target: NodeId,
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.
JobOk
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).
Drop
External file drop (e.g. from the OS file manager).
InternalDrop
Internal drag-and-drop with an opaque byte payload.
ScopedRaw
The action was dispatched from a subtree with a raw action scope.
Implementations§
Source§impl ActionInput
impl ActionInput
pub fn scoped_raw(scope_id: u128, target: NodeId, input: ActionInput) -> Self
pub fn action_scope_id(&self) -> Option<u128>
pub fn scoped_target(&self) -> Option<NodeId>
pub fn unscoped(&self) -> &ActionInput
pub fn as_bytes(&self) -> Option<&[u8]>
pub fn as_pointer(&self) -> Option<(f32, f32, f32, f32)>
pub fn as_drop_paths(&self) -> Option<&[String]>
pub fn as_internal_drop(&self) -> Option<&[u8]>
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 PartialEq for ActionInput
impl PartialEq for ActionInput
Source§fn eq(&self, other: &ActionInput) -> bool
fn eq(&self, other: &ActionInput) -> bool
self and other values to be equal, and is used by ==.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,
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.