1#![deny(missing_docs)]
21#![deny(clippy::all)]
22
23#[cfg(all(feature = "runtime-async-std", feature = "runtime-tokio"))]
24compile_error!(
25 "Features `runtime-async-std` and `runtime-tokio` are mutually exclusive. Please enable only one."
26);
27
28#[cfg(not(any(feature = "runtime-async-std", feature = "runtime-tokio")))]
29compile_error!("Either `runtime-async-std` or `runtime-tokio` feature must be enabled.");
30
31use std::io::Error;
32
33pub use crate::{
34 archive::{Archive, ArchiveBuilder, Entries},
35 builder::Builder,
36 entry::{Entry, Unpacked},
37 entry_type::EntryType,
38 header::{
39 GnuExtSparseHeader, GnuHeader, GnuSparseHeader, Header, HeaderMode, OldHeader, UstarHeader,
40 },
41 pax::{PaxExtension, PaxExtensions},
42};
43
44mod archive;
45mod builder;
46mod entry;
47mod entry_type;
48mod error;
49mod header;
50mod pax;
51
52#[cfg(test)]
53#[macro_use]
54extern crate static_assertions;
55
56fn other(msg: &str) -> Error {
57 Error::other(msg)
58}
59
60#[cfg(feature = "runtime-async-std")]
61pub(crate) async fn fs_canonicalize(
62 path: &async_std::path::Path,
63) -> async_std::io::Result<async_std::path::PathBuf> {
64 path.canonicalize().await
65}
66#[cfg(feature = "runtime-tokio")]
67pub(crate) async fn fs_canonicalize(
68 path: &std::path::Path,
69) -> tokio::io::Result<std::path::PathBuf> {
70 tokio::fs::canonicalize(path).await
71}
72
73#[cfg(feature = "runtime-async-std")]
74async fn symlink_metadata(
75 p: &async_std::path::Path,
76) -> async_std::io::Result<async_std::fs::Metadata> {
77 p.symlink_metadata().await
78}
79#[cfg(feature = "runtime-tokio")]
80async fn symlink_metadata(p: &std::path::Path) -> tokio::io::Result<std::fs::Metadata> {
81 tokio::fs::symlink_metadata(p).await
82}
83
84#[cfg(feature = "runtime-async-std")]
85async fn metadata(p: &async_std::path::Path) -> async_std::io::Result<async_std::fs::Metadata> {
86 p.metadata().await
87}
88#[cfg(feature = "runtime-tokio")]
89async fn metadata(p: &std::path::Path) -> tokio::io::Result<std::fs::Metadata> {
90 tokio::fs::metadata(p).await
91}