make_shared_writer

Function make_shared_writer 

Source
pub fn make_shared_writer(
    writer: Box<dyn AsyncWrite + Unpin + Send>,
) -> Arc<Mutex<Box<dyn AsyncWrite + Unpin + Send>>>
Expand description

Wrap a boxed writer into a SharedWriter. Used by tests + ipc::server to coerce a concrete WriteHalf into the trait object the HostPipe stores.

Implementation note: we go through an intermediate Arc<Mutex<Box<dyn AsyncWrite + ...>>> and then move the inner Box out at write time. This avoids relying on Arc<Mutex<Concrete>>-to-Arc<Mutex<dyn>> unsizing coercion, which is unstable across MSRVs for tokio::sync::Mutex.