Skip to content

Commit

Permalink
rename to_socket -> as_socket
Browse files Browse the repository at this point in the history
  • Loading branch information
taiki-e committed Dec 31, 2021
1 parent 68cd47a commit fdd5865
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions tokio/src/net/tcp/stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ impl TcpStream {
/// # }
/// ```
pub fn linger(&self) -> io::Result<Option<Duration>> {
let socket = self.to_socket();
let socket = self.as_socket();
socket.linger()
}

Expand All @@ -1116,11 +1116,11 @@ impl TcpStream {
/// # }
/// ```
pub fn set_linger(&self, dur: Option<Duration>) -> io::Result<()> {
let socket = self.to_socket();
let socket = self.as_socket();
socket.set_linger(dur)
}

fn to_socket(&self) -> socket2::SockRef<'_> {
fn as_socket(&self) -> socket2::SockRef<'_> {
socket2::SockRef::from(self)
}

Expand Down
6 changes: 3 additions & 3 deletions tokio/src/net/udp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1528,7 +1528,7 @@ impl UdpSocket {
))))
)]
pub fn tos(&self) -> io::Result<u32> {
self.to_socket().tos()
self.as_socket().tos()
}

/// Sets the value for the `IP_TOS` option on this socket.
Expand All @@ -1555,10 +1555,10 @@ impl UdpSocket {
))))
)]
pub fn set_tos(&self, tos: u32) -> io::Result<()> {
self.to_socket().set_tos(tos)
self.as_socket().set_tos(tos)
}

fn to_socket(&self) -> socket2::SockRef<'_> {
fn as_socket(&self) -> socket2::SockRef<'_> {
socket2::SockRef::from(self)
}

Expand Down

0 comments on commit fdd5865

Please sign in to comment.