pub struct ActionResult {
pub success: bool,
pub trait_updates: Vec<Trait>,
pub messages: Vec<String>,
pub data: HashMap<String, Value>,
}Expand description
Result of an action execution
Fields§
§success: boolWhether the action was successful
trait_updates: Vec<Trait>New traits to be applied
messages: Vec<String>Messages or logs from the action
data: HashMap<String, Value>Additional data returned by the action
Implementations§
Source§impl ActionResult
impl ActionResult
Sourcepub fn success_with_capacity(
trait_capacity: usize,
message_capacity: usize,
data_capacity: usize,
) -> Self
pub fn success_with_capacity( trait_capacity: usize, message_capacity: usize, data_capacity: usize, ) -> Self
Create a successful action result with pre-allocated capacity
Sourcepub fn add_trait_update(&mut self, trait_obj: Trait)
pub fn add_trait_update(&mut self, trait_obj: Trait)
Add a trait update to the result
Sourcepub fn add_trait_updates(
&mut self,
trait_updates: impl IntoIterator<Item = Trait>,
)
pub fn add_trait_updates( &mut self, trait_updates: impl IntoIterator<Item = Trait>, )
Add multiple trait updates efficiently
Sourcepub fn add_message(&mut self, message: impl Into<String>)
pub fn add_message(&mut self, message: impl Into<String>)
Add a message to the result
Sourcepub fn add_messages(&mut self, messages: impl IntoIterator<Item = String>)
pub fn add_messages(&mut self, messages: impl IntoIterator<Item = String>)
Add multiple messages efficiently
Sourcepub fn reserve_capacity(&mut self, trait_updates: usize, messages: usize)
pub fn reserve_capacity(&mut self, trait_updates: usize, messages: usize)
Reserve capacity for expected updates
Sourcepub fn is_success(&self) -> bool
pub fn is_success(&self) -> bool
Check if the action was successful
Sourcepub fn is_failure(&self) -> bool
pub fn is_failure(&self) -> bool
Check if the action failed
Sourcepub fn trait_update_count(&self) -> usize
pub fn trait_update_count(&self) -> usize
Get trait update count
Sourcepub fn message_count(&self) -> usize
pub fn message_count(&self) -> usize
Get message count
Sourcepub fn data_count(&self) -> usize
pub fn data_count(&self) -> usize
Get data count
Sourcepub fn clear_trait_updates(&mut self)
pub fn clear_trait_updates(&mut self)
Clear all trait updates
Sourcepub fn clear_messages(&mut self)
pub fn clear_messages(&mut self)
Clear all messages
Sourcepub fn clear_data(&mut self)
pub fn clear_data(&mut self)
Clear all data
Trait Implementations§
Source§impl Clone for ActionResult
impl Clone for ActionResult
Source§fn clone(&self) -> ActionResult
fn clone(&self) -> ActionResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ActionResult
impl Debug for ActionResult
Source§impl<'de> Deserialize<'de> for ActionResult
impl<'de> Deserialize<'de> for ActionResult
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ActionResult
impl RefUnwindSafe for ActionResult
impl Send for ActionResult
impl Sync for ActionResult
impl Unpin for ActionResult
impl UnwindSafe for ActionResult
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
Mutably borrows from an owned value. Read more