Update to latest rustix

This commit is contained in:
Aode (lion) 2022-07-22 17:38:02 -05:00
parent dc3f8bd0e5
commit cf88cef839
3 changed files with 9 additions and 5 deletions

View file

@ -6,7 +6,11 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rustix = "0.34.0"
rustix = { version = "0.35.0", default-features = false, features = [
"fs",
"net",
"std",
] }
[dev-dependencies]
read-write-buf = { git = "https://git.asonix.dog/safe-async/read-write-buf" }

View file

@ -69,7 +69,7 @@ pub fn try_ready<A: AsFd>(fd: &A, interest: Readiness) -> Result<Nonblocking<Rea
pub(crate) fn in_progress<T>(res: rustix::io::Result<T>) -> Result<InProgress<T>> {
match res {
Ok(t) => Ok(InProgress::Ready(t)),
Err(e) if e == rustix::io::Error::INPROGRESS => Ok(InProgress::InProgress),
Err(e) if e == rustix::io::Errno::INPROGRESS => Ok(InProgress::InProgress),
Err(e) => Err(e.into()),
}
}
@ -77,7 +77,7 @@ pub(crate) fn in_progress<T>(res: rustix::io::Result<T>) -> Result<InProgress<T>
pub(crate) fn nonblocking<T>(res: rustix::io::Result<T>) -> Result<Nonblocking<T>> {
match res {
Ok(t) => Ok(Nonblocking::Ready(t)),
Err(e) if e == rustix::io::Error::WOULDBLOCK || e == rustix::io::Error::AGAIN => {
Err(e) if e == rustix::io::Errno::WOULDBLOCK || e == rustix::io::Errno::AGAIN => {
Ok(Nonblocking::WouldBlock)
}
Err(e) => Err(e.into()),

View file

@ -198,7 +198,7 @@ impl PollManager {
let mut buf = [0; 16];
loop {
if let Err(e) = rustix::io::read(&self.notify, &mut buf) {
if e == rustix::io::Error::AGAIN || e == rustix::io::Error::WOULDBLOCK {
if e == rustix::io::Errno::AGAIN || e == rustix::io::Errno::WOULDBLOCK {
break;
}
}
@ -402,7 +402,7 @@ impl<'a> Poller<'a> {
impl NotifyToken {
pub fn notify(self) -> io::Result<Self> {
if let Err(e) = rustix::io::write(&*self.free, &[0]) {
if e == rustix::io::Error::AGAIN || e == rustix::io::Error::WOULDBLOCK {
if e == rustix::io::Errno::AGAIN || e == rustix::io::Errno::WOULDBLOCK {
return Ok(self);
}