pub struct Client { /* private fields */ }Expand description
Main client struct for Cap’n Web protocol communication
Implementations§
Source§impl Client
impl Client
Sourcepub fn new(config: ClientConfig) -> Result<Self>
pub fn new(config: ClientConfig) -> Result<Self>
Create a new client with the given configuration
Sourcepub fn new_with_url(url: &str) -> Result<Self>
pub fn new_with_url(url: &str) -> Result<Self>
Create a new client with default configuration
Sourcepub fn batch(&self) -> BatchBuilder<'_>
pub fn batch(&self) -> BatchBuilder<'_>
Create a new batch builder for batching multiple operations
Sourcepub async fn call(
&self,
cap_id: CapId,
method: &str,
args: Vec<Value>,
) -> Result<Value>
pub async fn call( &self, cap_id: CapId, method: &str, args: Vec<Value>, ) -> Result<Value>
Perform a single RPC call
Sourcepub async fn register_capability(&self, id: CapId, cap: Value)
pub async fn register_capability(&self, id: CapId, cap: Value)
Register a capability for use in future calls
Sourcepub async fn get_capability(&self, id: CapId) -> Option<Value>
pub async fn get_capability(&self, id: CapId) -> Option<Value>
Get a registered capability
Sourcepub async fn dispose_capability(&self, id: CapId) -> Result<()>
pub async fn dispose_capability(&self, id: CapId) -> Result<()>
Dispose of a capability
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<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