Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update socket2 & other deps #4

Merged
merged 1 commit into from
Apr 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading