Skip to content

Commit

Permalink
Merge pull request #4 from leshow/update_sock2
Browse files Browse the repository at this point in the history
update socket2 & other deps
  • Loading branch information
leshow authored Apr 21, 2024
2 parents 60b63cb + a80d595 commit 4b1e816
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "unix-udp-sock"
version = "0.7.0"
version = "0.7.1"
edition = "2021"
license = "MIT OR Apache-2.0"
repository = "https://github.com/leshow/unix-udp-sock"
Expand All @@ -10,15 +10,15 @@ categories = ["network-programming", "asynchronous"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
libc = "0.2.126"
socket2 = "0.4"
tracing = "0.1.35"
tokio = { version = "1.19", features = ["net"] }
tokio-util = { version = "0.7.0", features = [ "codec", "net" ] }
libc = "0.2.153"
socket2 = "0.5.6"
tracing = "0.1.40"
tokio = { version = "1.37.0", features = ["net"] }
tokio-util = { version = "0.7.10", features = ["codec", "net"] }
bytes = "1.1.0"
futures-core = "0.3.0"
futures-sink = "0.3.0"
pin-project-lite = "0.2.0"
futures-core = "0.3.30"
futures-sink = "0.3.30"
pin-project-lite = "0.2.14"

# [dev-dependencies]
# nix = "0.26"
11 changes: 8 additions & 3 deletions src/unix.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#![allow(clippy::unnecessary_cast)]
use std::{
io,
io::IoSliceMut,
io::{self, IoSliceMut},
mem::{self, MaybeUninit},
net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6},
os::unix::io::AsRawFd,
os::{fd::AsFd, unix::io::AsRawFd},
sync::atomic::AtomicUsize,
task::{Context, Poll},
time::Instant,
Expand Down Expand Up @@ -41,6 +40,12 @@ impl AsRawFd for UdpSocket {
}
}

impl AsFd for UdpSocket {
fn as_fd(&self) -> std::os::unix::prelude::BorrowedFd<'_> {
self.io.as_fd()
}
}

impl UdpSocket {
/// Creates a new UDP socket from a previously created `std::net::UdpSocket`
pub fn from_std(socket: std::net::UdpSocket) -> io::Result<UdpSocket> {
Expand Down

0 comments on commit 4b1e816

Please sign in to comment.