pub struct Connection { /* private fields */ }Expand description
An established Unix domain socket connection to a walrus-gateway.
Not Clone — one connection per session. Use super::WalrusClient::connect
to create a connection.
Implementations§
Source§impl Connection
impl Connection
Sourcepub async fn connect(socket_path: &Path) -> Result<Self>
pub async fn connect(socket_path: &Path) -> Result<Self>
Connect to a gateway at the given socket path.
Sourcepub async fn send(&mut self, msg: ClientMessage) -> Result<ServerMessage>
pub async fn send(&mut self, msg: ClientMessage) -> Result<ServerMessage>
Send a message and wait for a single response.
Sourcepub fn stream(
&mut self,
msg: ClientMessage,
) -> impl Stream<Item = Result<ServerMessage>> + '_
pub fn stream( &mut self, msg: ClientMessage, ) -> impl Stream<Item = Result<ServerMessage>> + '_
Send a message and return a stream of server responses.
The stream yields messages until StreamEnd is received or the
connection closes. The StreamEnd message itself is not yielded.
Sourcepub fn download_stream(
&mut self,
msg: ClientMessage,
) -> impl Stream<Item = Result<ServerMessage>> + '_
pub fn download_stream( &mut self, msg: ClientMessage, ) -> impl Stream<Item = Result<ServerMessage>> + '_
Send a download request and return a stream of progress messages.
The stream yields messages until DownloadEnd or Error is received.
Auto Trait Implementations§
impl Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
impl UnwindSafe for Connection
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