Skip to main content

MaaEvent

Enum MaaEvent 

Source
pub enum MaaEvent {
Show 28 variants ResourceLoadingStarting(ResourceLoadingDetail), ResourceLoadingSucceeded(ResourceLoadingDetail), ResourceLoadingFailed(ResourceLoadingDetail), ControllerActionStarting(ControllerActionDetail), ControllerActionSucceeded(ControllerActionDetail), ControllerActionFailed(ControllerActionDetail), TaskerTaskStarting(TaskerTaskDetail), TaskerTaskSucceeded(TaskerTaskDetail), TaskerTaskFailed(TaskerTaskDetail), NodePipelineNodeStarting(NodePipelineNodeDetail), NodePipelineNodeSucceeded(NodePipelineNodeDetail), NodePipelineNodeFailed(NodePipelineNodeDetail), NodeRecognitionStarting(NodeRecognitionDetail), NodeRecognitionSucceeded(NodeRecognitionDetail), NodeRecognitionFailed(NodeRecognitionDetail), NodeActionStarting(NodeActionDetail), NodeActionSucceeded(NodeActionDetail), NodeActionFailed(NodeActionDetail), NodeNextListStarting(NodeNextListDetail), NodeNextListSucceeded(NodeNextListDetail), NodeNextListFailed(NodeNextListDetail), NodeRecognitionNodeStarting(NodePipelineNodeDetail), NodeRecognitionNodeSucceeded(NodePipelineNodeDetail), NodeRecognitionNodeFailed(NodePipelineNodeDetail), NodeActionNodeStarting(NodePipelineNodeDetail), NodeActionNodeSucceeded(NodePipelineNodeDetail), NodeActionNodeFailed(NodePipelineNodeDetail), Unknown { msg: String, raw_json: String, err: Option<String>, },
}
Expand description

Unified event enum for all framework notifications.

This enum encapsulates all possible event types emitted by the framework, providing a type-safe way to handle notifications from Tasker, Controller, or Resource. Each variant wraps a detailed structure containing relevant information about the event.

§See Also

Variants§

§

ResourceLoadingStarting(ResourceLoadingDetail)

Triggered when a resource starts loading.

§

ResourceLoadingSucceeded(ResourceLoadingDetail)

Triggered when a resource is successfully loaded.

§

ResourceLoadingFailed(ResourceLoadingDetail)

Triggered when resource loading fails.

§

ControllerActionStarting(ControllerActionDetail)

Triggered before a controller performs an action (e.g., click, swipe).

§

ControllerActionSucceeded(ControllerActionDetail)

Triggered after a controller action completes successfully.

§

ControllerActionFailed(ControllerActionDetail)

Triggered if a controller action fails.

§

TaskerTaskStarting(TaskerTaskDetail)

Triggered when a task begins execution.

§

TaskerTaskSucceeded(TaskerTaskDetail)

Triggered when a task completes successfully.

§

TaskerTaskFailed(TaskerTaskDetail)

Triggered when a task fails.

§

NodePipelineNodeStarting(NodePipelineNodeDetail)

Triggered when a node in the pipeline starts execution.

§

NodePipelineNodeSucceeded(NodePipelineNodeDetail)

Triggered when a node in the pipeline completes successfully.

§

NodePipelineNodeFailed(NodePipelineNodeDetail)

Triggered when a node in the pipeline fails.

§

NodeRecognitionStarting(NodeRecognitionDetail)

Triggered when image recognition begins for a node.

§

NodeRecognitionSucceeded(NodeRecognitionDetail)

Triggered when image recognition succeeds.

§

NodeRecognitionFailed(NodeRecognitionDetail)

Triggered when image recognition fails.

§

NodeActionStarting(NodeActionDetail)

Triggered before a node action is executed.

§

NodeActionSucceeded(NodeActionDetail)

Triggered after a node action completes successfully.

§

NodeActionFailed(NodeActionDetail)

Triggered if a node action fails.

§

NodeNextListStarting(NodeNextListDetail)

Triggered when processing the “next” list for a node.

§

NodeNextListSucceeded(NodeNextListDetail)

Triggered when the “next” list processing succeeds.

§

NodeNextListFailed(NodeNextListDetail)

Triggered when the “next” list processing fails.

§

NodeRecognitionNodeStarting(NodePipelineNodeDetail)

Trace event: Recognition node starting.

§

NodeRecognitionNodeSucceeded(NodePipelineNodeDetail)

Trace event: Recognition node succeeded.

§

NodeRecognitionNodeFailed(NodePipelineNodeDetail)

Trace event: Recognition node failed.

§

NodeActionNodeStarting(NodePipelineNodeDetail)

Trace event: Action node starting.

§

NodeActionNodeSucceeded(NodePipelineNodeDetail)

Trace event: Action node succeeded.

§

NodeActionNodeFailed(NodePipelineNodeDetail)

Trace event: Action node failed.

§

Unknown

Represents an unknown or unparsable event.

This variant is used as a fallback when the event message is not recognized or if JSON deserialization fails.

Fields

§msg: String

The raw message string.

§raw_json: String

The raw JSON detail string.

Implementations§

Source§

impl MaaEvent

Source

pub fn from_json(msg: &str, details: &str) -> Self

Parses a notification message and detail string into a MaaEvent.

This function handles the conversion from the raw C-string values provided by the framework callback into safe, typed Rust structures.

§Arguments
  • msg - The notification type identifier (e.g., “Resource.Loading.Starting”).
  • details - The JSON string containing event details.

Trait Implementations§

Source§

impl Clone for MaaEvent

Source§

fn clone(&self) -> MaaEvent

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 MaaEvent

Source§

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

Formats the value using the given formatter. 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> 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<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> 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.