Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Difference From orphanage-0.1.4 To orphanage-0.2.0
2025-04-03
| ||
00:38 | Lossy cast. check-in: de2563a827 user: jan tags: trunk | |
2025-04-02
| ||
23:43 | Add change log section. check-in: e41a571187 user: jan tags: orphanage-0.2.0, trunk | |
23:40 | Release maintenance. check-in: 9678aea121 user: jan tags: trunk | |
2025-02-21
| ||
04:00 | Update rusqlite and rand. check-in: d9acfcb640 user: jan tags: trunk | |
2024-11-22
| ||
14:23 | Release maintenance. check-in: 2b23697533 user: jan tags: orphanage-0.1.4, trunk | |
14:21 | Add 'outdated' functions to fs module, useful for driving dependency rules. check-in: 89ac2f5207 user: jan tags: trunk | |
Changes to .efiles.
1 2 3 4 5 6 7 8 9 10 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | + - - + + | Cargo.toml README.md www/index.md www/changelog.md src/err.rs src/lib.rs src/path.rs src/fs.rs src/strx.rs src/numx.rs src/buf.rs |
Changes to Cargo.toml.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | [package] name = "orphanage" |
︙ | |||
20 21 22 23 24 25 26 | 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 | - + - - - + + - + - + - - - + + + + + + + + + + + + + + - + - + | ] # https://doc.rust-lang.org/cargo/reference/manifest.html#the-badges-section [badges] maintenance = { status = "experimental" } [features] |
Added examples/diskfree.rs.
|
Changes to src/buf.rs.
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 | - + | let mut buf = Vec::with_capacity(len); // SAFETY: Presumably with_capacity() works as documented. unsafe { buf.set_len(len); } |
Added src/ffi.rs.
|
Changes to src/fs.rs.
1 2 3 4 5 6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | + + - + + | use std::{ fs, io::ErrorKind, path::{Path, PathBuf} }; #[cfg(windows)] use windows_sys::Win32::Storage::FileSystem::GetDiskFreeSpaceExA; |
︙ | |||
62 63 64 65 66 67 68 | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | - | pub fn abspath<P>(pth: P) -> Result<PathBuf, Error> where P: AsRef<Path> { Ok(pth.as_ref().canonicalize()?) } |
︙ | |||
115 116 117 118 119 120 121 122 | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | let in_mtime = in_md.modified()?; let out_mtime = out_md.modified()?; Ok(in_mtime > out_mtime) } /// Given a directory, return how much disk space is available. /// /// The directory must exist. /// /// # Errors /// [`Error::IO`] is returned if the input path is not a directory or if the /// free space could not be probed. pub fn get_free_space(path: &Path) -> Result<u64, Error> { #[cfg(unix)] let res = get_free_space_unix(path); #[cfg(windows)] let res = get_free_space_win(path); res } #[cfg(unix)] fn get_free_space_unix(path: &Path) -> Result<u64, Error> { // Make sure directory exists if !path.is_dir() { return Err(Error::IO("Not a directory".into())); } // Must construct a null-terminated C string for libc::statfs() let cstr = path_to_cstring(path); let cstr_path = cstr.as_bytes_with_nul(); let mut statfs = unsafe { std::mem::zeroed() }; let result = unsafe { libc::statfs(cstr_path.as_ptr().cast::<i8>(), &mut statfs) }; if result == 0 { Ok(statfs.f_bavail as u64 * u64::from(statfs.f_bsize)) } else { Err(Error::IO("statfs() failed".into())) } } #[cfg(windows)] fn get_free_space_win(path: &Path) -> Result<u64, Error> { // Make sure directory exists if !path.is_dir() { return Err(Error::IO("Not a directory".into())); } // Need a null-terminated string for ffi let cstr = path_to_cstring(path); let cstr_path = cstr.as_bytes_with_nul(); let mut free_bytes_available_to_caller: u64 = 0; let mut total_bytes: u64 = 0; let mut total_free_bytes: u64 = 0; let result = unsafe { GetDiskFreeSpaceExA( cstr_path.as_ptr(), &mut free_bytes_available_to_caller, &mut total_bytes, &mut total_free_bytes ) }; if result != 0 { Ok(free_bytes_available_to_caller) } else { Err(Error::IO(format!( "GetDiskFreeSpaceExW failed with code: {}", std::io::Error::last_os_error() ))) } } // vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 : |
Changes to src/iox.rs.
︙ | |||
24 25 26 27 28 29 30 | 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | - + - + | if let Some(ref mut remain) = self.0 { if *remain == 0 { // signal eof Ok(0) } else { let n = std::cmp::min(*remain, buf.len() as u64); let len = usize::try_from(n).unwrap(); |
Changes to src/lib.rs.
1 2 3 4 5 6 7 8 9 10 11 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | + + - - - - - - - - | #![cfg_attr(docsrs, feature(doc_cfg))] pub mod buf; mod err; pub mod ffi; pub mod fs; pub mod futures; pub mod iox; pub mod numx; pub mod path; pub mod setops; pub mod strx; |
Added src/numx.rs.