Update rustix
This commit is contained in:
parent
32e103a470
commit
e16509cc8f
|
@ -6,9 +6,11 @@ edition = "2021"
|
|||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
rustix = { version = "0.36.3", default-features = false, features = [
|
||||
rustix = { version = "0.38.8", default-features = false, features = [
|
||||
"event",
|
||||
"fs",
|
||||
"net",
|
||||
"pipe",
|
||||
"std",
|
||||
] }
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::Readiness;
|
||||
use rustix::{fd::AsFd, io::PollFd};
|
||||
use rustix::{event::PollFd, fd::AsFd};
|
||||
use std::num::NonZeroUsize;
|
||||
|
||||
pub use std::io::{Error, Result};
|
||||
|
@ -54,7 +54,7 @@ impl From<ReadBytes> for usize {
|
|||
|
||||
pub fn try_ready<A: AsFd>(fd: &A, interest: Readiness) -> Result<Nonblocking<Readiness>> {
|
||||
let mut fds = [PollFd::new(fd, interest.into())];
|
||||
rustix::io::poll(&mut fds, 0)?;
|
||||
rustix::event::poll(&mut fds, 0)?;
|
||||
let revents: Readiness = fds[0].revents().into();
|
||||
|
||||
let out = revents & interest;
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
use rustix::io::{PipeFlags, PollFd, PollFlags};
|
||||
use rustix::{
|
||||
event::{PollFd, PollFlags},
|
||||
pipe::PipeFlags,
|
||||
};
|
||||
use std::{
|
||||
borrow::Borrow,
|
||||
collections::HashMap,
|
||||
|
@ -66,7 +69,7 @@ pub struct NotifyToken {
|
|||
}
|
||||
|
||||
pub fn notify_pair() -> io::Result<(Notify, NotifyToken)> {
|
||||
let (registered, free) = rustix::io::pipe_with(PipeFlags::NONBLOCK | PipeFlags::CLOEXEC)?;
|
||||
let (registered, free) = rustix::pipe::pipe_with(PipeFlags::NONBLOCK | PipeFlags::CLOEXEC)?;
|
||||
|
||||
Ok((
|
||||
Notify { registered },
|
||||
|
@ -377,7 +380,7 @@ impl<'a> Poller<'a> {
|
|||
pub fn poll(mut self) -> io::Result<Vec<(usize, Readiness)>> {
|
||||
let timeout = self.timeout.unwrap_or(-1);
|
||||
|
||||
let n = rustix::io::poll(&mut self.fds, timeout)?;
|
||||
let n = rustix::event::poll(&mut self.fds, timeout)?;
|
||||
|
||||
Ok(self
|
||||
.fds
|
||||
|
|
13
src/net.rs
13
src/net.rs
|
@ -1,10 +1,7 @@
|
|||
use crate::io::{in_progress, nonblocking, InProgress, Nonblocking, ReadBytes, Result};
|
||||
use rustix::{
|
||||
fd::{AsFd, OwnedFd},
|
||||
net::{
|
||||
AcceptFlags, AddressFamily, Protocol, RecvFlags, SendFlags, SocketAddrAny, SocketFlags,
|
||||
SocketType,
|
||||
},
|
||||
net::{AddressFamily, RecvFlags, SendFlags, SocketAddrAny, SocketFlags, SocketType},
|
||||
};
|
||||
use std::net::{IpAddr, SocketAddr};
|
||||
|
||||
|
@ -49,7 +46,7 @@ impl UdpSocket {
|
|||
family,
|
||||
SocketType::DGRAM,
|
||||
SocketFlags::NONBLOCK | SocketFlags::CLOEXEC,
|
||||
Protocol::UDP,
|
||||
Some(rustix::net::ipproto::UDP),
|
||||
)?;
|
||||
|
||||
rustix::net::sockopt::set_socket_reuseaddr(&sock, true)?;
|
||||
|
@ -105,7 +102,7 @@ impl UdpSocketBuilder {
|
|||
impl TcpListener {
|
||||
pub fn try_accept(&self) -> Result<Nonblocking<(TcpStream, Option<SocketAddr>)>> {
|
||||
nonblocking(
|
||||
rustix::net::acceptfrom_with(&self.fd, AcceptFlags::NONBLOCK | AcceptFlags::CLOEXEC)
|
||||
rustix::net::acceptfrom_with(&self.fd, SocketFlags::NONBLOCK | SocketFlags::CLOEXEC)
|
||||
.map(|(fd, addr)| {
|
||||
(
|
||||
TcpStream { fd },
|
||||
|
@ -136,7 +133,7 @@ impl TcpListener {
|
|||
family,
|
||||
SocketType::STREAM,
|
||||
SocketFlags::NONBLOCK | SocketFlags::CLOEXEC,
|
||||
Protocol::TCP,
|
||||
Some(rustix::net::ipproto::TCP),
|
||||
)?;
|
||||
|
||||
rustix::net::sockopt::set_socket_reuseaddr(&sock, true)?;
|
||||
|
@ -169,7 +166,7 @@ impl TcpStream {
|
|||
family,
|
||||
SocketType::STREAM,
|
||||
SocketFlags::NONBLOCK | SocketFlags::CLOEXEC,
|
||||
Protocol::TCP,
|
||||
Some(rustix::net::ipproto::TCP),
|
||||
)?;
|
||||
|
||||
Ok(TcpStreamBuilder {
|
||||
|
|
Loading…
Reference in a new issue