pub struct PiRpcClient { /* private fields */ }Expand description
A running pi --mode rpc process.
Implementations§
Source§impl PiRpcClient
impl PiRpcClient
Sourcepub async fn spawn(builder: PiCliBuilder) -> Result<Self>
pub async fn spawn(builder: PiCliBuilder) -> Result<Self>
Spawn pi --mode rpc from a builder. The builder’s mode is forced
to Mode::Rpc.
Sourcepub async fn start() -> Result<Self>
pub async fn start() -> Result<Self>
Spawn with defaults: an ephemeral (--no-session) RPC server.
Sourcepub async fn request(&mut self, command: RpcCommand) -> Result<RpcResponse>
pub async fn request(&mut self, command: RpcCommand) -> Result<RpcResponse>
Send one command and wait for its response. Events that arrive in
between are buffered for next_event.
The command’s id is used for correlation; commands built without
one get a client-generated id (the wire response echoes it).
Sourcepub async fn request_ok(&mut self, command: RpcCommand) -> Result<RpcResponse>
pub async fn request_ok(&mut self, command: RpcCommand) -> Result<RpcResponse>
Convenience: send and fail on success: false.
Sourcepub async fn next_event(&mut self) -> Result<Option<PiEvent>>
pub async fn next_event(&mut self) -> Result<Option<PiEvent>>
Next streamed event: buffered ones first, then the wire. Returns
Ok(None) on clean EOF (process exit).
Auto Trait Implementations§
impl !RefUnwindSafe for PiRpcClient
impl !UnwindSafe for PiRpcClient
impl Freeze for PiRpcClient
impl Send for PiRpcClient
impl Sync for PiRpcClient
impl Unpin for PiRpcClient
impl UnsafeUnpin for PiRpcClient
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