pub struct Client { /* private fields */ }Expand description
A client for the server part of bunbun-worker
Implementations§
Source§impl Client
impl Client
Sourcepub async fn new(address: &str) -> Result<Self, Error>
pub async fn new(address: &str) -> Result<Self, Error>
Creates an bunbun-worker client.
§Examples
// Create a client and send a message
use bunbun_worker::client::Client;
let client = Client::new("amqp://127.0.0.1:5672");Sourcepub async fn rpc_call<T>(
&self,
data: T,
options: BasicCallOptions,
) -> Result<Result<T::Result, T::ErroredResult>, ClientError>
pub async fn rpc_call<T>( &self, data: T, options: BasicCallOptions, ) -> Result<Result<T::Result, T::ErroredResult>, ClientError>
A method to call for a RPC
Arguments
dataThe job that will be sent to the queue, must implement Deserialize and SerializeoptionsBasicCallOptions, used to control the timeout and message version
Sourcepub async fn call<T>(
&self,
data: T,
options: BasicCallOptions,
) -> Result<(), ClientError>where
T: Serialize + DeserializeOwned,
pub async fn call<T>(
&self,
data: T,
options: BasicCallOptions,
) -> Result<(), ClientError>where
T: Serialize + DeserializeOwned,
Sends a basic Task to the queue
Arguments
dataThe job that will be sent to the queue, must implement Deserialize and SerializeoptionsBasicCallOptions, used to control the timeout and message version
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl !UnwindSafe for Client
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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