pub struct FrameClient { /* private fields */ }Expand description
Blocking request/response client for a backend daemon’s frame lane.
use running_process::broker::backend_sdk::FrameClient;
use running_process::broker::protocol::Endpoint;
let endpoint = Endpoint::unix_socket("my-daemon", "/tmp/my-daemon.sock")?;
let mut client = FrameClient::connect(&endpoint)?;
let response = client.request(0x7A63, b"ping".to_vec())?;
assert_eq!(response.payload, b"pong");Implementations§
Source§impl FrameClient
impl FrameClient
Sourcepub fn connect(endpoint: &Endpoint) -> Result<Self, FrameClientError>
pub fn connect(endpoint: &Endpoint) -> Result<Self, FrameClientError>
Connect to a backend endpoint using the platform local-socket name type (bare pipe name on Windows, filesystem path on Unix).
Sourcepub fn from_stream(stream: Stream) -> Self
pub fn from_stream(stream: Stream) -> Self
Wrap an already-connected local-socket stream (e.g. one opened
through a verified
BackendHandle).
Sourcepub fn request(
&mut self,
payload_protocol: u32,
payload: Vec<u8>,
) -> Result<Frame, FrameClientError>
pub fn request( &mut self, payload_protocol: u32, payload: Vec<u8>, ) -> Result<Frame, FrameClientError>
Send one request frame and block until its response arrives.
Assigns the next request id, sends
Frame::request(payload_protocol, payload), then reads frames
until one echoes the id. The returned frame is validated to be a
RESPONSE on the same payload protocol.
Sourcepub fn next_request_id(&self) -> u64
pub fn next_request_id(&self) -> u64
The request id the next Self::request call will use.
Auto Trait Implementations§
impl Freeze for FrameClient
impl RefUnwindSafe for FrameClient
impl Send for FrameClient
impl Sync for FrameClient
impl Unpin for FrameClient
impl UnsafeUnpin for FrameClient
impl UnwindSafe for FrameClient
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more