pub struct Product {
pub id: ProductId,
pub name: String,
pub price: f64,
pub quantity: u32,
}Fields§
§id: ProductId§name: String§price: f64§quantity: u32Implementations§
Trait Implementations§
Source§impl ActorClient<Product> for ProductClient
impl ActorClient<Product> for ProductClient
Source§type Error = ProductError
type Error = ProductError
The resource-specific error type.
Source§fn map_error(e: FrameworkError) -> Self::Error
fn map_error(e: FrameworkError) -> Self::Error
Map framework errors to the specific resource error type.
Source§impl ActorEntity for Product
impl ActorEntity for Product
Source§fn from_create_params(
id: ProductId,
params: ProductCreate,
) -> Result<Self, Self::Error>
fn from_create_params( id: ProductId, params: ProductCreate, ) -> Result<Self, Self::Error>
Creates a new Product from creation parameters.
Source§fn on_update<'life0, 'life1, 'async_trait>(
&'life0 mut self,
update: ProductUpdate,
_ctx: &'life1 Self::Context,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn on_update<'life0, 'life1, 'async_trait>(
&'life0 mut self,
update: ProductUpdate,
_ctx: &'life1 Self::Context,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles updates to the Product entity.
§Fields Updated
price: Product pricequantity: Available stock quantity
Source§fn handle_action<'life0, 'life1, 'async_trait>(
&'life0 mut self,
action: ProductAction,
_ctx: &'life1 Self::Context,
) -> Pin<Box<dyn Future<Output = Result<ProductActionResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn handle_action<'life0, 'life1, 'async_trait>(
&'life0 mut self,
action: ProductAction,
_ctx: &'life1 Self::Context,
) -> Pin<Box<dyn Future<Output = Result<ProductActionResult, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Handles custom actions for the Product entity.
§Actions
CheckStock: Returns true if requested quantity is availableReserveStock: Decrements stock if available, returns true on success
Source§type Id = ProductId
type Id = ProductId
The unique identifier for this entity (e.g., String, Uuid, u64).
Must be convertible from u32 for automatic ID generation.
Source§type Create = ProductCreate
type Create = ProductCreate
The data required to create a new instance (DTO - Data Transfer Object).
Source§type Update = ProductUpdate
type Update = ProductUpdate
The data required to update an existing instance.
Source§type Action = ProductAction
type Action = ProductAction
Enum representing resource-specific operations (e.g.,
ReserveStock).Source§type ActionResult = ProductActionResult
type ActionResult = ProductActionResult
The result type returned by custom actions.
Source§type Context = ()
type Context = ()
The runtime context (dependencies) injected into the actor.
Use
() if no dependencies are needed.Source§type Error = ProductError
type Error = ProductError
The error type for this entity.
Must implement std::error::Error for proper error propagation. Read more
§fn on_create<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 Self::Context,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn on_create<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_ctx: &'life1 Self::Context,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Called immediately after the entity is created and initialized.
Use this hook to perform validation or side effects (e.g., checking other actors).
§fn on_delete<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 Self::Context,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn on_delete<'life0, 'life1, 'async_trait>(
&'life0 self,
_ctx: &'life1 Self::Context,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Called immediately before the entity is removed from the system.
Auto Trait Implementations§
impl Freeze for Product
impl RefUnwindSafe for Product
impl Send for Product
impl Sync for Product
impl Unpin for Product
impl UnwindSafe for Product
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