[[example]]
name = "pxarcmd"
path = "examples/pxarcmd.rs"
-required-features = [ "anyhow" ]
[[example]]
name = "mk-format-hashes"
name = "simple"
path = "tests/simple/main.rs"
test = true
-required-features = [ "anyhow", "test-harness" ]
+required-features = [ "test-harness" ]
[[test]]
name = "compat"
endian_trait = { version = "0.6", features = ["arrays"] }
siphasher = "0.3"
-anyhow = { version = "1.0", optional = true }
tokio = { version = "1.0", optional = true, default-features = false }
[target.'cfg(target_os = "linux")'.dependencies]
full = [ "tokio-fs"]
async-example = [
- "anyhow",
"tokio-io",
"tokio-fs",
"tokio/rt-multi-thread",
use std::os::unix::ffi::OsStrExt;
use std::path::{Path, PathBuf};
-use anyhow::{bail, format_err, Error};
-
use pxar::accessor::Accessor;
use pxar::encoder::{Encoder, LinkOffset, SeqWrite};
use pxar::Metadata;
+macro_rules! format_err {
+ ($($msg:tt)+) => {
+ std::io::Error::new(std::io::ErrorKind::Other, format!($($msg)+))
+ };
+}
+
+macro_rules! bail {
+ ($($msg:tt)+) => {{
+ return Err(format_err!($($msg)+).into());
+ }};
+}
+
+type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
+
fn main() -> Result<(), Error> {
let mut args = std::env::args_os();
let _ = args.next();
use std::io::Read;
use std::path::{Path, PathBuf};
-use anyhow::{bail, format_err, Error};
-
use pxar::decoder::sync as decoder;
use pxar::decoder::SeqRead;
use pxar::encoder::sync as encoder;
use pxar::EntryKind as PxarEntryKind;
use pxar::Metadata;
+use crate::Error;
+
/// Hardlink information we use while encoding pxar archives.
pub struct HardlinkInfo {
link: LinkOffset,
use std::io::Read;
use std::path::Path;
-use anyhow::{bail, Error};
-
use pxar::accessor::sync as accessor;
use pxar::decoder::sync as decoder;
use pxar::encoder::sync as encoder;
use pxar::encoder::SeqWrite;
use pxar::EntryKind as PxarEntryKind;
+macro_rules! format_err {
+ ($($msg:tt)+) => {
+ std::io::Error::new(std::io::ErrorKind::Other, format!($($msg)+))
+ };
+}
+
+macro_rules! bail {
+ ($($msg:tt)+) => {{
+ return Err(format_err!($($msg)+).into());
+ }};
+}
+
+pub type Error = Box<dyn std::error::Error + Send + Sync + 'static>;
+
mod fs;
fn encode_directory<T: SeqWrite>(