INNER CODE UNIT · Rust
from_stream
ilya-zlobintsev/LACT · lact-client/src/lib.rs:71
pub fn from_stream(stream: UnixStream, embedded: bool) -> anyhow::Result<Self> {
let connection = UnixConnection::try_from(stream)?;
Ok(Self {
stream: Rc::new(Mutex::new(Box::new(connection))),
embedded,
reconnect: false,
status_tx: broadcast::Sender::new(STATUS_MSG_CHANNEL_SIZE),
})
}
pub fn status_receiver(&self) -> broadcast::Receiver<ConnectionStatusMsg> {
self.status_tx.subscribe()
}
fn make_request<'a, T: DeserializeOwned>(
&'a self,
request: Request<'a>,
) -> Pin<Box<dyn Future<Output = anyhow::Result<T>> + 'a>> {