distant_net/server/ref/
windows.rs1use std::ffi::{OsStr, OsString};
2use std::future::Future;
3use std::ops::{Deref, DerefMut};
4use std::pin::Pin;
5use std::task::{Context, Poll};
6
7use tokio::task::JoinError;
8
9use super::ServerRef;
10
11pub struct WindowsPipeServerRef {
13 pub(crate) addr: OsString,
14 pub(crate) inner: ServerRef,
15}
16
17impl WindowsPipeServerRef {
18 pub fn new(addr: OsString, inner: ServerRef) -> Self {
19 Self { addr, inner }
20 }
21
22 pub fn addr(&self) -> &OsStr {
24 &self.addr
25 }
26
27 pub fn into_inner(self) -> ServerRef {
29 self.inner
30 }
31}
32
33impl Future for WindowsPipeServerRef {
34 type Output = Result<(), JoinError>;
35
36 fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
37 Pin::new(&mut self.inner.task).poll(cx)
38 }
39}
40
41impl Deref for WindowsPipeServerRef {
42 type Target = ServerRef;
43
44 fn deref(&self) -> &Self::Target {
45 &self.inner
46 }
47}
48
49impl DerefMut for WindowsPipeServerRef {
50 fn deref_mut(&mut self) -> &mut Self::Target {
51 &mut self.inner
52 }
53}