mirror of
https://github.com/sharkdp/hexyl.git
synced 2026-10-26 20:16:31 +00:00
Replace libc with rustix
This commit is contained in:
1 parent
fcd09fffac
commit
571312dd6e
3 files changed
+5
-4
No files matched your search
Generated
+1
-1
@@ -194,9 +194,9 @@ dependencies = [
|
|||||||
"clap",
|
"clap",
|
||||||
"const_format",
|
"const_format",
|
||||||
"is-terminal",
|
"is-terminal",
|
||||||
"libc",
|
|
||||||
"predicates",
|
"predicates",
|
||||||
"pretty_assertions",
|
"pretty_assertions",
|
||||||
|
"rustix",
|
||||||
"terminal_size",
|
"terminal_size",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
]
|
]
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@ anstyle = "0.2"
|
|||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
const_format = "0.2"
|
const_format = "0.2"
|
||||||
is-terminal = "0.4"
|
is-terminal = "0.4"
|
||||||
libc = "0.2"
|
rustix = "0.36"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
terminal_size = "0.2"
|
terminal_size = "0.2"
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -2,6 +2,8 @@ use std::convert::TryFrom;
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::{self, copy, sink, Read, Seek, SeekFrom};
|
use std::io::{self, copy, sink, Read, Seek, SeekFrom};
|
||||||
|
|
||||||
|
use rustix::io::Errno;
|
||||||
|
|
||||||
pub enum Input<'a> {
|
pub enum Input<'a> {
|
||||||
File(fs::File),
|
File(fs::File),
|
||||||
Stdin(io::StdinLock<'a>),
|
Stdin(io::StdinLock<'a>),
|
||||||
@@ -35,8 +37,7 @@ impl<'a> Seek for Input<'a> {
|
|||||||
match *self {
|
match *self {
|
||||||
Input::File(ref mut file) => {
|
Input::File(ref mut file) => {
|
||||||
let seek_res = file.seek(pos);
|
let seek_res = file.seek(pos);
|
||||||
if let Err(Some(libc::ESPIPE)) = seek_res.as_ref().map_err(|err| err.raw_os_error())
|
if let Err(Some(Errno::SPIPE)) = seek_res.as_ref().map_err(Errno::from_io_error) {
|
||||||
{
|
|
||||||
try_skip(
|
try_skip(
|
||||||
file,
|
file,
|
||||||
pos,
|
pos,
|
||||||
|
|||||||
Reference in new issue
Block a user