From 6bd7086fc23b84bf6113714aee294949e303f3ff Mon Sep 17 00:00:00 2001 From: Al Liu Date: Sat, 30 Nov 2024 22:00:33 +0800 Subject: [PATCH] future proof style external crate support (#33) --- Cargo.toml | 15 ++-- README.md | 28 +++++-- src/file_ext/async_impl.rs | 8 +- src/file_ext/async_impl/fs_err2_tokio_impl.rs | 13 ++++ src/file_ext/async_impl/fs_err3_tokio_impl.rs | 13 ++++ src/file_ext/async_impl/fs_err_tokio_impl.rs | 13 ---- src/file_ext/sync_impl.rs | 8 +- src/file_ext/sync_impl/fs_err2_impl.rs | 11 +++ src/file_ext/sync_impl/fs_err3_impl.rs | 11 +++ src/file_ext/sync_impl/fs_err_impl.rs | 11 --- src/lib.rs | 78 +++++++++++++++---- src/unix/async_impl.rs | 8 +- ...rr_tokio_impl.rs => fs_err2_tokio_impl.rs} | 6 +- src/unix/async_impl/fs_err3_tokio_impl.rs | 13 ++++ src/unix/sync_impl.rs | 8 +- .../{fs_err_impl.rs => fs_err2_impl.rs} | 6 +- src/unix/sync_impl/fs_err3_impl.rs | 12 +++ src/windows/async_impl.rs | 8 +- ...rr_tokio_impl.rs => fs_err2_tokio_impl.rs} | 6 +- src/windows/async_impl/fs_err3_tokio_impl.rs | 22 ++++++ src/windows/sync_impl.rs | 8 +- .../{fs_err_impl.rs => fs_err2_impl.rs} | 6 +- src/windows/sync_impl/fs_err3_impl.rs | 21 +++++ 23 files changed, 255 insertions(+), 78 deletions(-) create mode 100644 src/file_ext/async_impl/fs_err2_tokio_impl.rs create mode 100644 src/file_ext/async_impl/fs_err3_tokio_impl.rs delete mode 100644 src/file_ext/async_impl/fs_err_tokio_impl.rs create mode 100644 src/file_ext/sync_impl/fs_err2_impl.rs create mode 100644 src/file_ext/sync_impl/fs_err3_impl.rs delete mode 100644 src/file_ext/sync_impl/fs_err_impl.rs rename src/unix/async_impl/{fs_err_tokio_impl.rs => fs_err2_tokio_impl.rs} (61%) create mode 100644 src/unix/async_impl/fs_err3_tokio_impl.rs rename src/unix/sync_impl/{fs_err_impl.rs => fs_err2_impl.rs} (66%) create mode 100644 src/unix/sync_impl/fs_err3_impl.rs rename src/windows/async_impl/{fs_err_tokio_impl.rs => fs_err2_tokio_impl.rs} (83%) create mode 100644 src/windows/async_impl/fs_err3_tokio_impl.rs rename src/windows/sync_impl/{fs_err_impl.rs => fs_err2_impl.rs} (87%) create mode 100644 src/windows/sync_impl/fs_err3_impl.rs diff --git a/Cargo.toml b/Cargo.toml index 67f4d6c9..7490c1c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "fs4" # NB: When modifying, also modify html_root_url in lib.rs -version = "0.11.1" +version = "0.12.0" rust-version = "1.75.0" authors = ["Dan Burkert ", "Al Liu "] license = "MIT OR Apache-2.0" @@ -18,8 +18,11 @@ sync = [] async-std = ["dep:async-std"] tokio = ["dep:tokio"] smol = ["dep:smol"] -fs-err = ["dep:fs-err", "fs-err/io_safety"] -fs-err-tokio = ["fs-err", "fs-err/tokio"] +fs-err2 = ["dep:fs-err2", "fs-err2/io_safety"] +fs-err2-tokio = ["fs-err2", "fs-err2/tokio"] +fs-err3 = ["dep:fs-err3"] +fs-err3-tokio = ["fs-err3", "fs-err3/tokio"] + [target.'cfg(not(windows))'.dependencies] rustix = { version = "0.38", features = ["fs"] } @@ -30,7 +33,8 @@ features = ["Win32_Foundation", "Win32_Storage_FileSystem", "Win32_System_IO"] [dependencies] async-std = { version = "1", optional = true } -fs-err = { version = "2", optional = true } +fs-err2 = { package = "fs-err", version = "2", optional = true } +fs-err3 = { package = "fs-err", version = "3", optional = true } smol = { version = "2", optional = true } tokio = { version = "1", optional = true, default-features = false, features = [ "fs", @@ -38,7 +42,8 @@ tokio = { version = "1", optional = true, default-features = false, features = [ [dev-dependencies] async-std = { version = "1", features = ["attributes"] } -fs-err = { version = "2", features = ["io_safety", "tokio"] } +fs-err2 = { package = "fs-err", version = "2", features = ["io_safety", "tokio"] } +fs-err3 = { package = "fs-err", version = "3", features = ["tokio"] } smol-potat = "1.1" tempdir = "0.3" tokio = { version = "1", features = ["full"] } diff --git a/README.md b/README.md index 1ff90b72..3ee7d808 100644 --- a/README.md +++ b/README.md @@ -23,37 +23,49 @@ This is a fork of the [fs2-rs](https://github.com/danburkert/fs2-rs) crate, the - std ```toml [dependencies] - fs4 = { version = "0.11", features = ["sync"] } + fs4 = { version = "0.12", features = ["sync"] } ``` - [async-std runtime](https://crates.io/crates/async-std) ```toml [dependencies] - fs4 = { version = "0.11", features = ["async-std"] } + fs4 = { version = "0.12", features = ["async-std"] } ``` -- [fs-err](https://crates.io/crates/fs-err) +- [fs-err v2](https://crates.io/crates/fs-err) ```toml [dependencies] - fs4 = { version = "0.11", features = ["fs-err"] } + fs4 = { version = "0.12", features = ["fs-err2"] } ``` -- [fs-err-tokio](https://crates.io/crates/fs-err) +- [fs-err-tokio v2](https://crates.io/crates/fs-err) ```toml [dependencies] - fs4 = { version = "0.11", features = ["fs-err-tokio"] } + fs4 = { version = "0.12", features = ["fs-err2-tokio"] } + ``` + +- [fs-err v3](https://crates.io/crates/fs-err) + ```toml + [dependencies] + fs4 = { version = "0.12", features = ["fs-err3"] } + ``` + +- [fs-err-tokio v3](https://crates.io/crates/fs-err) + ```toml + [dependencies] + fs4 = { version = "0.12", features = ["fs-err3-tokio"] } ``` - [smol runtime](https://crates.io/crates/smol) ```toml [dependencies] - fs4 = { version = "0.11", features = ["smol"] } + fs4 = { version = "0.12", features = ["smol"] } ``` - [tokio runtime](https://crates.io/crates/tokio) ```toml [dependencies] - fs4 = { version = "0.11", features = ["tokio"] } + fs4 = { version = "0.12", features = ["tokio"] } ``` ## Features diff --git a/src/file_ext/async_impl.rs b/src/file_ext/async_impl.rs index 34f725bd..8b41427a 100644 --- a/src/file_ext/async_impl.rs +++ b/src/file_ext/async_impl.rs @@ -277,8 +277,12 @@ cfg_async_std! { pub(crate) mod async_std_impl; } -cfg_fs_err_tokio! { - pub(crate) mod fs_err_tokio_impl; +cfg_fs_err2_tokio! { + pub(crate) mod fs_err2_tokio_impl; +} + +cfg_fs_err3_tokio! { + pub(crate) mod fs_err3_tokio_impl; } cfg_smol! { diff --git a/src/file_ext/async_impl/fs_err2_tokio_impl.rs b/src/file_ext/async_impl/fs_err2_tokio_impl.rs new file mode 100644 index 00000000..02893c72 --- /dev/null +++ b/src/file_ext/async_impl/fs_err2_tokio_impl.rs @@ -0,0 +1,13 @@ +#[cfg(unix)] +use crate::unix::async_impl::fs_err2_tokio_impl as sys; +#[cfg(windows)] +use crate::windows::async_impl::fs_err2_tokio_impl as sys; +use fs_err2::tokio::File; + +async_file_ext!(File, "fs_err::tokio::File"); + +test_mod! { + tokio::test, + use crate::fs_err2_tokio::AsyncFileExt; + use fs_err2::tokio as fs; +} diff --git a/src/file_ext/async_impl/fs_err3_tokio_impl.rs b/src/file_ext/async_impl/fs_err3_tokio_impl.rs new file mode 100644 index 00000000..57c23452 --- /dev/null +++ b/src/file_ext/async_impl/fs_err3_tokio_impl.rs @@ -0,0 +1,13 @@ +#[cfg(unix)] +use crate::unix::async_impl::fs_err3_tokio_impl as sys; +#[cfg(windows)] +use crate::windows::async_impl::fs_err3_tokio_impl as sys; +use fs_err3::tokio::File; + +async_file_ext!(File, "fs_err::tokio::File"); + +test_mod! { + tokio::test, + use crate::fs_err3_tokio::AsyncFileExt; + use fs_err3::tokio as fs; +} diff --git a/src/file_ext/async_impl/fs_err_tokio_impl.rs b/src/file_ext/async_impl/fs_err_tokio_impl.rs deleted file mode 100644 index 9303befc..00000000 --- a/src/file_ext/async_impl/fs_err_tokio_impl.rs +++ /dev/null @@ -1,13 +0,0 @@ -#[cfg(unix)] -use crate::unix::async_impl::fs_err_tokio_impl as sys; -#[cfg(windows)] -use crate::windows::async_impl::fs_err_tokio_impl as sys; -use fs_err::tokio::File; - -async_file_ext!(File, "fs_err::tokio::File"); - -test_mod! { - tokio::test, - use crate::fs_err_tokio::AsyncFileExt; - use fs_err::tokio as fs; -} diff --git a/src/file_ext/sync_impl.rs b/src/file_ext/sync_impl.rs index 9739c847..4ce11098 100644 --- a/src/file_ext/sync_impl.rs +++ b/src/file_ext/sync_impl.rs @@ -393,6 +393,10 @@ cfg_sync! { pub(crate) mod std_impl; } -cfg_fs_err! { - pub(crate) mod fs_err_impl; +cfg_fs2_err! { + pub(crate) mod fs_err2_impl; +} + +cfg_fs3_err! { + pub(crate) mod fs_err3_impl; } diff --git a/src/file_ext/sync_impl/fs_err2_impl.rs b/src/file_ext/sync_impl/fs_err2_impl.rs new file mode 100644 index 00000000..395b95de --- /dev/null +++ b/src/file_ext/sync_impl/fs_err2_impl.rs @@ -0,0 +1,11 @@ +#[cfg(unix)] +use crate::unix::sync_impl::fs_err2_impl as sys; +#[cfg(windows)] +use crate::windows::sync_impl::fs_err2_impl as sys; +use fs_err2::File; + +file_ext!(File, "fs_err::File"); + +test_mod! { + use fs_err2 as fs; +} diff --git a/src/file_ext/sync_impl/fs_err3_impl.rs b/src/file_ext/sync_impl/fs_err3_impl.rs new file mode 100644 index 00000000..318cdf49 --- /dev/null +++ b/src/file_ext/sync_impl/fs_err3_impl.rs @@ -0,0 +1,11 @@ +#[cfg(unix)] +use crate::unix::sync_impl::fs_err3_impl as sys; +#[cfg(windows)] +use crate::windows::sync_impl::fs_err3_impl as sys; +use fs_err3::File; + +file_ext!(File, "fs_err::File"); + +test_mod! { + use fs_err3 as fs; +} diff --git a/src/file_ext/sync_impl/fs_err_impl.rs b/src/file_ext/sync_impl/fs_err_impl.rs deleted file mode 100644 index ff76b88b..00000000 --- a/src/file_ext/sync_impl/fs_err_impl.rs +++ /dev/null @@ -1,11 +0,0 @@ -#[cfg(unix)] -use crate::unix::sync_impl::fs_err_impl as sys; -#[cfg(windows)] -use crate::windows::sync_impl::fs_err_impl as sys; -use fs_err::File; - -file_ext!(File, "fs_err::File"); - -test_mod! { - use fs_err as fs; -} diff --git a/src/lib.rs b/src/lib.rs index b55ed758..5370e797 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,9 +1,9 @@ //! Extended utilities for working with files and filesystems in Rust. -#![doc(html_root_url = "https://docs.rs/fs4/0.11.0")] +#![doc(html_root_url = "https://docs.rs/fs4/0.12.0")] #![cfg_attr(test, feature(test))] #![cfg_attr(docsrs, feature(doc_cfg))] #![cfg_attr(docsrs, allow(unused_attributes))] -#![allow(unexpected_cfgs)] +#![allow(unexpected_cfgs, unstable_name_collisions)] #[cfg(windows)] extern crate windows_sys; @@ -20,21 +20,43 @@ macro_rules! cfg_async_std { // This lint is a bug, it is being used in multiple places. #[allow(unused_macros)] -macro_rules! cfg_fs_err { +macro_rules! cfg_fs_err2 { ($($item:item)*) => { $( - #[cfg(feature = "fs-err")] - #[cfg_attr(docsrs, doc(cfg(feature = "fs-err")))] + #[cfg(feature = "fs-err2")] + #[cfg_attr(docsrs, doc(cfg(feature = "fs-err2")))] $item )* } } -macro_rules! cfg_fs_err_tokio { +macro_rules! cfg_fs_err2_tokio { ($($item:item)*) => { $( - #[cfg(feature = "fs-err-tokio")] - #[cfg_attr(docsrs, doc(cfg(feature = "fs-err-tokio")))] + #[cfg(feature = "fs-err2-tokio")] + #[cfg_attr(docsrs, doc(cfg(feature = "fs-err2-tokio")))] + $item + )* + } +} + +// This lint is a bug, it is being used in multiple places. +#[allow(unused_macros)] +macro_rules! cfg_fs_err3 { + ($($item:item)*) => { + $( + #[cfg(feature = "fs-err3")] + #[cfg_attr(docsrs, doc(cfg(feature = "fs-err3")))] + $item + )* + } +} + +macro_rules! cfg_fs_err3_tokio { + ($($item:item)*) => { + $( + #[cfg(feature = "fs-err3-tokio")] + #[cfg_attr(docsrs, doc(cfg(feature = "fs-err3-tokio")))] $item )* } @@ -70,11 +92,21 @@ macro_rules! cfg_sync { } } -macro_rules! cfg_fs_err { +macro_rules! cfg_fs2_err { + ($($item:item)*) => { + $( + #[cfg(feature = "fs-err2")] + #[cfg_attr(docsrs, doc(cfg(feature = "fs-err2")))] + $item + )* + } +} + +macro_rules! cfg_fs3_err { ($($item:item)*) => { $( - #[cfg(feature = "fs-err")] - #[cfg_attr(docsrs, doc(cfg(feature = "fs-err")))] + #[cfg(feature = "fs-err3")] + #[cfg_attr(docsrs, doc(cfg(feature = "fs-err3")))] $item )* } @@ -109,9 +141,15 @@ cfg_sync!( } ); -cfg_fs_err!( - pub mod fs_err { - pub use crate::file_ext::sync_impl::fs_err_impl::FileExt; +cfg_fs_err2!( + pub mod fs_err2 { + pub use crate::file_ext::sync_impl::fs_err2_impl::FileExt; + } +); + +cfg_fs_err3!( + pub mod fs_err3 { + pub use crate::file_ext::sync_impl::fs_err3_impl::FileExt; } ); @@ -121,9 +159,15 @@ cfg_async_std!( } ); -cfg_fs_err_tokio!( - pub mod fs_err_tokio { - pub use crate::file_ext::async_impl::fs_err_tokio_impl::AsyncFileExt; +cfg_fs_err2_tokio!( + pub mod fs_err2_tokio { + pub use crate::file_ext::async_impl::fs_err2_tokio_impl::AsyncFileExt; + } +); + +cfg_fs_err3_tokio!( + pub mod fs_err3_tokio { + pub use crate::file_ext::async_impl::fs_err3_tokio_impl::AsyncFileExt; } ); diff --git a/src/unix/async_impl.rs b/src/unix/async_impl.rs index c73180b4..58430180 100644 --- a/src/unix/async_impl.rs +++ b/src/unix/async_impl.rs @@ -108,8 +108,12 @@ cfg_async_std! { pub(crate) mod async_std_impl; } -cfg_fs_err_tokio! { - pub(crate) mod fs_err_tokio_impl; +cfg_fs_err2_tokio! { + pub(crate) mod fs_err2_tokio_impl; +} + +cfg_fs_err3_tokio! { + pub(crate) mod fs_err3_tokio_impl; } cfg_smol! { diff --git a/src/unix/async_impl/fs_err_tokio_impl.rs b/src/unix/async_impl/fs_err2_tokio_impl.rs similarity index 61% rename from src/unix/async_impl/fs_err_tokio_impl.rs rename to src/unix/async_impl/fs_err2_tokio_impl.rs index 52452204..a7b06d62 100644 --- a/src/unix/async_impl/fs_err_tokio_impl.rs +++ b/src/unix/async_impl/fs_err2_tokio_impl.rs @@ -1,4 +1,4 @@ -use fs_err::tokio::File; +use fs_err2::tokio::File; use std::os::unix::fs::MetadataExt; use std::os::unix::io::AsRawFd; @@ -8,6 +8,6 @@ allocate_size!(File); test_mod! { tokio::test, - use crate::fs_err_tokio::AsyncFileExt; - use fs_err::tokio as fs; + use crate::fs_err2_tokio::AsyncFileExt; + use fs_err2::tokio as fs; } diff --git a/src/unix/async_impl/fs_err3_tokio_impl.rs b/src/unix/async_impl/fs_err3_tokio_impl.rs new file mode 100644 index 00000000..4bb79260 --- /dev/null +++ b/src/unix/async_impl/fs_err3_tokio_impl.rs @@ -0,0 +1,13 @@ +use fs_err3::tokio::File; +use std::os::unix::fs::MetadataExt; +use std::os::unix::io::AsRawFd; + +lock_impl!(File); +allocate!(File); +allocate_size!(File); + +test_mod! { + tokio::test, + use crate::fs_err3_tokio::AsyncFileExt; + use fs_err3::tokio as fs; +} diff --git a/src/unix/sync_impl.rs b/src/unix/sync_impl.rs index a44fbbe8..444e7c1c 100644 --- a/src/unix/sync_impl.rs +++ b/src/unix/sync_impl.rs @@ -106,6 +106,10 @@ cfg_sync! { pub(crate) mod std_impl; } -cfg_fs_err! { - pub(crate) mod fs_err_impl; +cfg_fs_err2! { + pub(crate) mod fs_err2_impl; +} + +cfg_fs_err3! { + pub(crate) mod fs_err3_impl; } diff --git a/src/unix/sync_impl/fs_err_impl.rs b/src/unix/sync_impl/fs_err2_impl.rs similarity index 66% rename from src/unix/sync_impl/fs_err_impl.rs rename to src/unix/sync_impl/fs_err2_impl.rs index 39ff6637..943eb92d 100644 --- a/src/unix/sync_impl/fs_err_impl.rs +++ b/src/unix/sync_impl/fs_err2_impl.rs @@ -1,4 +1,4 @@ -use fs_err::File; +use fs_err2::File; use std::os::unix::fs::MetadataExt; use std::os::unix::io::AsRawFd; @@ -7,6 +7,6 @@ allocate!(File); allocate_size!(File); test_mod! { - use crate::fs_err::FileExt; - use fs_err as fs; + use crate::fs_err2::FileExt; + use fs_err2 as fs; } diff --git a/src/unix/sync_impl/fs_err3_impl.rs b/src/unix/sync_impl/fs_err3_impl.rs new file mode 100644 index 00000000..68a0355a --- /dev/null +++ b/src/unix/sync_impl/fs_err3_impl.rs @@ -0,0 +1,12 @@ +use fs_err3::File; +use std::os::unix::fs::MetadataExt; +use std::os::unix::io::AsRawFd; + +lock_impl!(File); +allocate!(File); +allocate_size!(File); + +test_mod! { + use crate::fs_err3::FileExt; + use fs_err3 as fs; +} diff --git a/src/windows/async_impl.rs b/src/windows/async_impl.rs index 4f8d9227..7b662a55 100644 --- a/src/windows/async_impl.rs +++ b/src/windows/async_impl.rs @@ -170,8 +170,12 @@ cfg_async_std! { pub(crate) mod async_std_impl; } -cfg_fs_err_tokio! { - pub(crate) mod fs_err_tokio_impl; +cfg_fs_err2_tokio! { + pub(crate) mod fs_err2_tokio_impl; +} + +cfg_fs_err3_tokio! { + pub(crate) mod fs_err3_tokio_impl; } cfg_smol! { diff --git a/src/windows/async_impl/fs_err_tokio_impl.rs b/src/windows/async_impl/fs_err2_tokio_impl.rs similarity index 83% rename from src/windows/async_impl/fs_err_tokio_impl.rs rename to src/windows/async_impl/fs_err2_tokio_impl.rs index efaaa807..1830aba3 100644 --- a/src/windows/async_impl/fs_err_tokio_impl.rs +++ b/src/windows/async_impl/fs_err2_tokio_impl.rs @@ -9,7 +9,7 @@ use windows_sys::Win32::Storage::FileSystem::{ LOCKFILE_EXCLUSIVE_LOCK, LOCKFILE_FAIL_IMMEDIATELY, }; -use fs_err::tokio::File; +use fs_err2::tokio::File; lock_impl!(File); allocate!(File); @@ -17,6 +17,6 @@ allocate_size!(File); test_mod! { tokio::test, - use crate::fs_err_tokio::AsyncFileExt; - use fs_err::tokio as fs; + use crate::fs_err2_tokio::AsyncFileExt; + use fs_err2::tokio as fs; } diff --git a/src/windows/async_impl/fs_err3_tokio_impl.rs b/src/windows/async_impl/fs_err3_tokio_impl.rs new file mode 100644 index 00000000..116653a0 --- /dev/null +++ b/src/windows/async_impl/fs_err3_tokio_impl.rs @@ -0,0 +1,22 @@ +use std::io::{Error, Result}; +use std::mem; +use std::os::windows::io::AsRawHandle; + +use windows_sys::Win32::Foundation::HANDLE; +use windows_sys::Win32::Storage::FileSystem::{ + FileAllocationInfo, FileStandardInfo, GetFileInformationByHandleEx, LockFileEx, + SetFileInformationByHandle, UnlockFile, FILE_ALLOCATION_INFO, FILE_STANDARD_INFO, + LOCKFILE_EXCLUSIVE_LOCK, LOCKFILE_FAIL_IMMEDIATELY, +}; + +use fs_err3::tokio::File; + +lock_impl!(File); +allocate!(File); +allocate_size!(File); + +test_mod! { + tokio::test, + use crate::fs_err3_tokio::AsyncFileExt; + use fs_err3::tokio as fs; +} diff --git a/src/windows/sync_impl.rs b/src/windows/sync_impl.rs index 54c11914..da61f74a 100644 --- a/src/windows/sync_impl.rs +++ b/src/windows/sync_impl.rs @@ -166,6 +166,10 @@ cfg_sync! { pub(crate) mod std_impl; } -cfg_fs_err! { - pub(crate) mod fs_err_impl; +cfg_fs_err2! { + pub(crate) mod fs_err2_impl; +} + +cfg_fs_err3! { + pub(crate) mod fs_err3_impl; } diff --git a/src/windows/sync_impl/fs_err_impl.rs b/src/windows/sync_impl/fs_err2_impl.rs similarity index 87% rename from src/windows/sync_impl/fs_err_impl.rs rename to src/windows/sync_impl/fs_err2_impl.rs index ba88ea5f..614d0eb1 100644 --- a/src/windows/sync_impl/fs_err_impl.rs +++ b/src/windows/sync_impl/fs_err2_impl.rs @@ -9,13 +9,13 @@ use windows_sys::Win32::Storage::FileSystem::{ LOCKFILE_EXCLUSIVE_LOCK, LOCKFILE_FAIL_IMMEDIATELY, }; -use fs_err::File; +use fs_err2::File; lock_impl!(File); allocate!(File); allocate_size!(File); test_mod! { - use crate::fs_err::FileExt; - use fs_err as fs; + use crate::fs_err2::FileExt; + use fs_err2 as fs; } diff --git a/src/windows/sync_impl/fs_err3_impl.rs b/src/windows/sync_impl/fs_err3_impl.rs new file mode 100644 index 00000000..7c8eb718 --- /dev/null +++ b/src/windows/sync_impl/fs_err3_impl.rs @@ -0,0 +1,21 @@ +use std::io::{Error, Result}; +use std::mem; +use std::os::windows::io::AsRawHandle; + +use windows_sys::Win32::Foundation::HANDLE; +use windows_sys::Win32::Storage::FileSystem::{ + FileAllocationInfo, FileStandardInfo, GetFileInformationByHandleEx, LockFileEx, + SetFileInformationByHandle, UnlockFile, FILE_ALLOCATION_INFO, FILE_STANDARD_INFO, + LOCKFILE_EXCLUSIVE_LOCK, LOCKFILE_FAIL_IMMEDIATELY, +}; + +use fs_err3::File; + +lock_impl!(File); +allocate!(File); +allocate_size!(File); + +test_mod! { + use crate::fs_err3::FileExt; + use fs_err3 as fs; +}