1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
//! # pathkit
//!
//! A Rust library that provides a `Path` structure similar to Python's pathlib,
//! with both synchronous and asynchronous file manipulation methods.
//!
//! ## Features
//!
//! - **Path Operations**: Extended path manipulation methods beyond `std::path::Path`
//! - **Synchronous I/O**: Blocking file system operations via [`SyncFsOps`] trait
//! - **Asynchronous I/O**: Non-blocking file system operations via `AsyncFsOps` trait (requires `async-fs-ops` feature)
//! - **SeaORM Integration**: Use `Path` as a model field (requires `sea-orm` feature)
//! - **Serde Support**: Serialize and deserialize Path with `#[derive(Serialize, Deserialize)]`
//! - **Path Joining**: Use `/` operator for intuitive path composition
//!
//! ## Installation
//!
//! Add to your `Cargo.toml`:
//!
//! ```bash
//! cargo add pathkit
//! ```
//!
//! For async support:
//!
//! ```bash
//! cargo add pathkit --features async-fs-ops
//! ```
//!
//! For SeaORM support:
//!
//! ```bash
//! cargo add pathkit --features sea-orm
//! ```
//!
//! ## Usage
//!
//! ### Basic Path Operations
//!
//! ```rust
//! use pathkit::Path;
//!
//! // Create a new path
//! let path = Path::new("/home/user/project");
//!
//! // Join paths
//! let config = path.join("config.json");
//!
//! // Using / operator (note: this consumes the path)
//! let nested = Path::new("/home/user") / "project" / "subdir";
//!
//! // Get path components
//! let parent = path.parent();
//! let file_name = path.file_name();
//! let extension = path.extension();
//! ```
//!
//! ### Synchronous File Operations
//!
//! ```rust,ignore
//! use pathkit::{Path, SyncFsOps};
//!
//! let path = Path::new("/tmp/test.txt");
//!
//! // Read/write files
//! path.write_sync(b"Hello, world!")?;
//! let content = path.read_sync()?;
//!
//! // Check existence and type
//! if path.exists_sync()? {
//! println!("File size: {}", path.get_file_size_sync()?);
//! }
//!
//! // Create directories
//! Path::new("/tmp/new_project").create_dir_all_sync()?;
//!
//! // Read JSON
//! #[derive(Deserialize)]
//! struct Config { name: String }
//! let config: Config = path.read_json_sync()?;
//! ```
//!
//! ### Asynchronous File Operations
//!
//! ```rust,ignore
//! use pathkit::{Path, AsyncFsOps};
//!
//! let path = Path::new("/tmp/test.txt");
//!
//! // Async read/write
//! path.write(b"Hello, world!").await?;
//! let content = path.read().await?;
//!
//! // Async directory operations
//! Path::new("/tmp/new_project").create_dir_all().await?;
//! ```
//!
//! ### SeaORM Integration
//!
//! ```rust,ignore
//! use sea_orm::entity::prelude::*;
//! use pathkit::Path;
//!
//! #[derive(Clone, Debug, DeriveEntityModel)]
//! #[sea_orm(table_name = "files")]
//! struct Model {
//! #[sea_orm(primary_key)]
//! id: i32,
//! path: Path,
//! }
//! ```
//!
//! ## Feature Flags
//!
//! | Feature | Description |
//! |---------|-------------|
//! | `async-fs-ops` | Enable async file system operations (requires tokio) |
//! | `sea-orm` | Enable SeaORM integration for using `Path` as a model field |
//! | `full` | Enable all features |
//!
//! ## Platform Support
//!
//! - **Unix/Linux/macOS**: Full support including `chmod`, `chown`, and special file type checks
//! - **Windows**: Core functionality supported; some Unix-specific features are conditionally compiled out
pub use crateAsyncFsOps;
pub use crate::;