Skip to content

Commit

Permalink
core: remove Transport impl for Box<dyn Transport>
Browse files Browse the repository at this point in the history
Real users of Box<dyn Transport> most likely want to add other trait
bounds such as Send, which would require the use of a newtype wrapper
anyway.
  • Loading branch information
MaxVerevkin committed Apr 16, 2024
1 parent 01118ef commit 4319194
Showing 1 changed file with 0 additions and 19 deletions.
19 changes: 0 additions & 19 deletions wayrs-core/src/transport.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,6 @@ pub trait Transport {
) -> io::Result<usize>;
}

impl Transport for Box<dyn Transport> {
fn pollable_fd(&self) -> RawFd {
self.as_ref().pollable_fd()
}

fn send(&mut self, bytes: &[IoSlice], fds: &[OwnedFd], mode: IoMode) -> io::Result<usize> {
self.as_mut().send(bytes, fds, mode)
}

fn recv(
&mut self,
bytes: &mut [IoSliceMut],
fds: &mut VecDeque<OwnedFd>,
mode: IoMode,
) -> io::Result<usize> {
self.as_mut().recv(bytes, fds, mode)
}
}

impl<T: Transport> AsRawFd for BufferedSocket<T> {
fn as_raw_fd(&self) -> RawFd {
self.socket.pollable_fd()
Expand Down

0 comments on commit 4319194

Please sign in to comment.