pub struct ProductClient {
inner: ResourceClient<Product>,
}Expand description
Client for interacting with the Product actor.
Fields§
§inner: ResourceClient<Product>Implementations§
Source§impl ProductClient
impl ProductClient
pub async fn create_product( &self, params: ProductCreate, ) -> Result<ProductId, ProductError>
Sourcepub async fn check_stock(&self, id: ProductId) -> Result<u32, ProductError>
pub async fn check_stock(&self, id: ProductId) -> Result<u32, ProductError>
Check the current stock level for a product.
Returns the quantity available.
Sourcepub async fn reserve_stock(
&self,
id: ProductId,
quantity: u32,
) -> Result<(), ProductError>
pub async fn reserve_stock( &self, id: ProductId, quantity: u32, ) -> Result<(), ProductError>
Reserve a specific amount of stock for a product.
Returns Ok(()) if successful, or an error if insufficient stock.
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 Clone for ProductClient
impl Clone for ProductClient
Source§fn clone(&self) -> ProductClient
fn clone(&self) -> ProductClient
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 moreAuto Trait Implementations§
impl Freeze for ProductClient
impl RefUnwindSafe for ProductClient
impl Send for ProductClient
impl Sync for ProductClient
impl Unpin for ProductClient
impl UnwindSafe for ProductClient
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