pub struct MockIpcServer { /* private fields */ }
Available on crate feature
mock
only.Expand description
Mock IPC server.
Currently unix socket only, due to use of namedtempfile.
§Example:
use alloy_transport_ipc::MockIpcServer;
// Instantiate a new mock server.
let mut server = MockIpcServer::new();
// Get the path to the socket.
let path = server.path();
// Add a reply to the server. Can also use `add_raw_reply` to add a raw
// byte vector, or `add_response` to add a json-rpc response.
server.add_reply("hello");
// Run the server. The first request will get "hello" as a response.
MockIpcServer::new().spawn();
Implementations§
Source§impl MockIpcServer
impl MockIpcServer
Sourcepub fn add_raw_reply(&mut self, reply: Vec<u8>)
pub fn add_raw_reply(&mut self, reply: Vec<u8>)
Add a raw reply to the server.
Sourcepub fn add_response<S: Serialize>(&mut self, response: Response<S>)
pub fn add_response<S: Serialize>(&mut self, response: Response<S>)
Add a json-rpc response to the server.
Trait Implementations§
Source§impl Debug for MockIpcServer
impl Debug for MockIpcServer
Auto Trait Implementations§
impl Freeze for MockIpcServer
impl RefUnwindSafe for MockIpcServer
impl Send for MockIpcServer
impl Sync for MockIpcServer
impl Unpin for MockIpcServer
impl UnwindSafe for MockIpcServer
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