File tree Expand file tree Collapse file tree
src/uucore/src/lib/features Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99//! used by utilities to work around the limitations of Rust's `fs::copy` which
1010//! does not handle copying special files (e.g pipes, character/block devices).
1111
12- pub mod common;
13-
1412#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
1513pub mod linux;
1614#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
Original file line number Diff line number Diff line change @@ -9,26 +9,22 @@ use crate::error::UError;
99#[ derive( Debug ) ]
1010pub enum Error {
1111 Io ( std:: io:: Error ) ,
12- WriteError ( String ) ,
12+ }
13+
14+ impl From < rustix:: io:: Errno > for Error {
15+ fn from ( value : rustix:: io:: Errno ) -> Self {
16+ Self :: Io ( value. into ( ) )
17+ }
1318}
1419
1520impl std:: fmt:: Display for Error {
1621 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
1722 match self {
18- Self :: WriteError ( msg) => write ! ( f, "splice() write error: {msg}" ) ,
1923 Self :: Io ( err) => write ! ( f, "I/O error: {err}" ) ,
2024 }
2125 }
2226}
2327
2428impl std:: error:: Error for Error { }
2529
26- impl UError for Error {
27- fn code ( & self ) -> i32 {
28- 1
29- }
30-
31- fn usage ( & self ) -> bool {
32- false
33- }
34- }
30+ impl UError for Error { }
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ use std::{
1313 os:: fd:: { AsFd , AsRawFd } ,
1414} ;
1515
16- use super :: common :: Error ;
16+ use super :: error :: Error ;
1717
1818/// A readable file descriptor.
1919pub trait FdReadable : Read + AsRawFd + AsFd { }
@@ -25,13 +25,6 @@ pub trait FdWritable: Write + AsFd + AsRawFd {}
2525
2626impl < T > FdWritable for T where T : Write + AsFd + AsRawFd { }
2727
28- /// Conversion from a `rustix::io::Errno` into our `Error` which implements `UError`.
29- impl From < rustix:: io:: Errno > for Error {
30- fn from ( error : rustix:: io:: Errno ) -> Self {
31- Self :: Io ( std:: io:: Error :: from ( error) )
32- }
33- }
34-
3528/// Copy data from `Read` implementor `source` into a `Write` implementor
3629/// `dest`. This works by reading a chunk of data from `source` and writing the
3730/// data to `dest` in a loop.
You can’t perform that action at this time.
0 commit comments