rufio 0.33.0 → 0.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,346 +0,0 @@
1
- # This file is automatically @generated by Cargo.
2
- # It is not intended for manual editing.
3
- version = 4
4
-
5
- [[package]]
6
- name = "aho-corasick"
7
- version = "1.1.4"
8
- source = "registry+https://github.com/rust-lang/crates.io-index"
9
- checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
10
- dependencies = [
11
- "memchr",
12
- ]
13
-
14
- [[package]]
15
- name = "bindgen"
16
- version = "0.69.5"
17
- source = "registry+https://github.com/rust-lang/crates.io-index"
18
- checksum = "271383c67ccabffb7381723dea0672a673f292304fcb45c01cc648c7a8d58088"
19
- dependencies = [
20
- "bitflags",
21
- "cexpr",
22
- "clang-sys",
23
- "itertools",
24
- "lazy_static",
25
- "lazycell",
26
- "proc-macro2",
27
- "quote",
28
- "regex",
29
- "rustc-hash",
30
- "shlex",
31
- "syn",
32
- ]
33
-
34
- [[package]]
35
- name = "bitflags"
36
- version = "2.10.0"
37
- source = "registry+https://github.com/rust-lang/crates.io-index"
38
- checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"
39
-
40
- [[package]]
41
- name = "cexpr"
42
- version = "0.6.0"
43
- source = "registry+https://github.com/rust-lang/crates.io-index"
44
- checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
45
- dependencies = [
46
- "nom",
47
- ]
48
-
49
- [[package]]
50
- name = "cfg-if"
51
- version = "1.0.4"
52
- source = "registry+https://github.com/rust-lang/crates.io-index"
53
- checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
54
-
55
- [[package]]
56
- name = "clang-sys"
57
- version = "1.8.1"
58
- source = "registry+https://github.com/rust-lang/crates.io-index"
59
- checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
60
- dependencies = [
61
- "glob",
62
- "libc",
63
- "libloading",
64
- ]
65
-
66
- [[package]]
67
- name = "either"
68
- version = "1.15.0"
69
- source = "registry+https://github.com/rust-lang/crates.io-index"
70
- checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"
71
-
72
- [[package]]
73
- name = "glob"
74
- version = "0.3.3"
75
- source = "registry+https://github.com/rust-lang/crates.io-index"
76
- checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
77
-
78
- [[package]]
79
- name = "itertools"
80
- version = "0.12.1"
81
- source = "registry+https://github.com/rust-lang/crates.io-index"
82
- checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569"
83
- dependencies = [
84
- "either",
85
- ]
86
-
87
- [[package]]
88
- name = "itoa"
89
- version = "1.0.17"
90
- source = "registry+https://github.com/rust-lang/crates.io-index"
91
- checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"
92
-
93
- [[package]]
94
- name = "lazy_static"
95
- version = "1.5.0"
96
- source = "registry+https://github.com/rust-lang/crates.io-index"
97
- checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
98
-
99
- [[package]]
100
- name = "lazycell"
101
- version = "1.3.0"
102
- source = "registry+https://github.com/rust-lang/crates.io-index"
103
- checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
104
-
105
- [[package]]
106
- name = "libc"
107
- version = "0.2.178"
108
- source = "registry+https://github.com/rust-lang/crates.io-index"
109
- checksum = "37c93d8daa9d8a012fd8ab92f088405fb202ea0b6ab73ee2482ae66af4f42091"
110
-
111
- [[package]]
112
- name = "libloading"
113
- version = "0.8.9"
114
- source = "registry+https://github.com/rust-lang/crates.io-index"
115
- checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
116
- dependencies = [
117
- "cfg-if",
118
- "windows-link",
119
- ]
120
-
121
- [[package]]
122
- name = "magnus"
123
- version = "0.7.1"
124
- source = "registry+https://github.com/rust-lang/crates.io-index"
125
- checksum = "3d87ae53030f3a22e83879e666cb94e58a7bdf31706878a0ba48752994146dab"
126
- dependencies = [
127
- "magnus-macros",
128
- "rb-sys",
129
- "rb-sys-env",
130
- "seq-macro",
131
- ]
132
-
133
- [[package]]
134
- name = "magnus-macros"
135
- version = "0.6.0"
136
- source = "registry+https://github.com/rust-lang/crates.io-index"
137
- checksum = "5968c820e2960565f647819f5928a42d6e874551cab9d88d75e3e0660d7f71e3"
138
- dependencies = [
139
- "proc-macro2",
140
- "quote",
141
- "syn",
142
- ]
143
-
144
- [[package]]
145
- name = "memchr"
146
- version = "2.7.6"
147
- source = "registry+https://github.com/rust-lang/crates.io-index"
148
- checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273"
149
-
150
- [[package]]
151
- name = "minimal-lexical"
152
- version = "0.2.1"
153
- source = "registry+https://github.com/rust-lang/crates.io-index"
154
- checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
155
-
156
- [[package]]
157
- name = "nom"
158
- version = "7.1.3"
159
- source = "registry+https://github.com/rust-lang/crates.io-index"
160
- checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
161
- dependencies = [
162
- "memchr",
163
- "minimal-lexical",
164
- ]
165
-
166
- [[package]]
167
- name = "proc-macro2"
168
- version = "1.0.104"
169
- source = "registry+https://github.com/rust-lang/crates.io-index"
170
- checksum = "9695f8df41bb4f3d222c95a67532365f569318332d03d5f3f67f37b20e6ebdf0"
171
- dependencies = [
172
- "unicode-ident",
173
- ]
174
-
175
- [[package]]
176
- name = "quote"
177
- version = "1.0.42"
178
- source = "registry+https://github.com/rust-lang/crates.io-index"
179
- checksum = "a338cc41d27e6cc6dce6cefc13a0729dfbb81c262b1f519331575dd80ef3067f"
180
- dependencies = [
181
- "proc-macro2",
182
- ]
183
-
184
- [[package]]
185
- name = "rb-sys"
186
- version = "0.9.123"
187
- source = "registry+https://github.com/rust-lang/crates.io-index"
188
- checksum = "45fb1a185af97ee456f1c9e56dbe6e2e662bec4fdeaf83c4c28e0e6adfb18816"
189
- dependencies = [
190
- "rb-sys-build",
191
- ]
192
-
193
- [[package]]
194
- name = "rb-sys-build"
195
- version = "0.9.123"
196
- source = "registry+https://github.com/rust-lang/crates.io-index"
197
- checksum = "a58ebd02d7a6033e6a5f6f8d150c1e9f16506039092b84a73e6bedce6d3adf41"
198
- dependencies = [
199
- "bindgen",
200
- "lazy_static",
201
- "proc-macro2",
202
- "quote",
203
- "regex",
204
- "shell-words",
205
- "syn",
206
- ]
207
-
208
- [[package]]
209
- name = "rb-sys-env"
210
- version = "0.1.2"
211
- source = "registry+https://github.com/rust-lang/crates.io-index"
212
- checksum = "a35802679f07360454b418a5d1735c89716bde01d35b1560fc953c1415a0b3bb"
213
-
214
- [[package]]
215
- name = "regex"
216
- version = "1.12.2"
217
- source = "registry+https://github.com/rust-lang/crates.io-index"
218
- checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
219
- dependencies = [
220
- "aho-corasick",
221
- "memchr",
222
- "regex-automata",
223
- "regex-syntax",
224
- ]
225
-
226
- [[package]]
227
- name = "regex-automata"
228
- version = "0.4.13"
229
- source = "registry+https://github.com/rust-lang/crates.io-index"
230
- checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
231
- dependencies = [
232
- "aho-corasick",
233
- "memchr",
234
- "regex-syntax",
235
- ]
236
-
237
- [[package]]
238
- name = "regex-syntax"
239
- version = "0.8.8"
240
- source = "registry+https://github.com/rust-lang/crates.io-index"
241
- checksum = "7a2d987857b319362043e95f5353c0535c1f58eec5336fdfcf626430af7def58"
242
-
243
- [[package]]
244
- name = "rufio_native"
245
- version = "0.1.0"
246
- dependencies = [
247
- "magnus",
248
- "serde",
249
- "serde_json",
250
- ]
251
-
252
- [[package]]
253
- name = "rustc-hash"
254
- version = "1.1.0"
255
- source = "registry+https://github.com/rust-lang/crates.io-index"
256
- checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
257
-
258
- [[package]]
259
- name = "seq-macro"
260
- version = "0.3.6"
261
- source = "registry+https://github.com/rust-lang/crates.io-index"
262
- checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
263
-
264
- [[package]]
265
- name = "serde"
266
- version = "1.0.228"
267
- source = "registry+https://github.com/rust-lang/crates.io-index"
268
- checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
269
- dependencies = [
270
- "serde_core",
271
- "serde_derive",
272
- ]
273
-
274
- [[package]]
275
- name = "serde_core"
276
- version = "1.0.228"
277
- source = "registry+https://github.com/rust-lang/crates.io-index"
278
- checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
279
- dependencies = [
280
- "serde_derive",
281
- ]
282
-
283
- [[package]]
284
- name = "serde_derive"
285
- version = "1.0.228"
286
- source = "registry+https://github.com/rust-lang/crates.io-index"
287
- checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
288
- dependencies = [
289
- "proc-macro2",
290
- "quote",
291
- "syn",
292
- ]
293
-
294
- [[package]]
295
- name = "serde_json"
296
- version = "1.0.148"
297
- source = "registry+https://github.com/rust-lang/crates.io-index"
298
- checksum = "3084b546a1dd6289475996f182a22aba973866ea8e8b02c51d9f46b1336a22da"
299
- dependencies = [
300
- "itoa",
301
- "memchr",
302
- "serde",
303
- "serde_core",
304
- "zmij",
305
- ]
306
-
307
- [[package]]
308
- name = "shell-words"
309
- version = "1.1.1"
310
- source = "registry+https://github.com/rust-lang/crates.io-index"
311
- checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
312
-
313
- [[package]]
314
- name = "shlex"
315
- version = "1.3.0"
316
- source = "registry+https://github.com/rust-lang/crates.io-index"
317
- checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
318
-
319
- [[package]]
320
- name = "syn"
321
- version = "2.0.112"
322
- source = "registry+https://github.com/rust-lang/crates.io-index"
323
- checksum = "21f182278bf2d2bcb3c88b1b08a37df029d71ce3d3ae26168e3c653b213b99d4"
324
- dependencies = [
325
- "proc-macro2",
326
- "quote",
327
- "unicode-ident",
328
- ]
329
-
330
- [[package]]
331
- name = "unicode-ident"
332
- version = "1.0.22"
333
- source = "registry+https://github.com/rust-lang/crates.io-index"
334
- checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"
335
-
336
- [[package]]
337
- name = "windows-link"
338
- version = "0.2.1"
339
- source = "registry+https://github.com/rust-lang/crates.io-index"
340
- checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
341
-
342
- [[package]]
343
- name = "zmij"
344
- version = "1.0.8"
345
- source = "registry+https://github.com/rust-lang/crates.io-index"
346
- checksum = "317f17ff091ac4515f17cc7a190d2769a8c9a96d227de5d64b500b01cda8f2cd"
@@ -1,18 +0,0 @@
1
- [package]
2
- name = "rufio_native"
3
- version = "0.1.0"
4
- edition = "2021"
5
-
6
- [lib]
7
- crate-type = ["cdylib"]
8
-
9
- [dependencies]
10
- magnus = "0.7"
11
- serde = { version = "1.0", features = ["derive"] }
12
- serde_json = "1.0"
13
-
14
- [profile.release]
15
- lto = true
16
- codegen-units = 1
17
- opt-level = 3
18
- strip = true
@@ -1,46 +0,0 @@
1
- use std::process::Command;
2
-
3
- fn main() {
4
- // Rubyのlibdirを取得
5
- let output = Command::new("ruby")
6
- .args(&["-e", "puts RbConfig::CONFIG['libdir']"])
7
- .output()
8
- .expect("Failed to execute ruby command");
9
-
10
- let lib_dir = String::from_utf8(output.stdout)
11
- .expect("Invalid UTF-8")
12
- .trim()
13
- .to_string();
14
-
15
- // Rubyのヘッダーディレクトリを取得
16
- let output = Command::new("ruby")
17
- .args(&["-e", "puts RbConfig::CONFIG['rubyhdrdir']"])
18
- .output()
19
- .expect("Failed to execute ruby command");
20
-
21
- let hdr_dir = String::from_utf8(output.stdout)
22
- .expect("Invalid UTF-8")
23
- .trim()
24
- .to_string();
25
-
26
- // archディレクトリも取得
27
- let output = Command::new("ruby")
28
- .args(&["-e", "puts RbConfig::CONFIG['rubyarchhdrdir']"])
29
- .output()
30
- .expect("Failed to execute ruby command");
31
-
32
- let arch_dir = String::from_utf8(output.stdout)
33
- .expect("Invalid UTF-8")
34
- .trim()
35
- .to_string();
36
-
37
- // リンカーに情報を渡す
38
- println!("cargo:rustc-link-search=native={}", lib_dir);
39
- println!("cargo:rustc-link-lib=dylib=ruby.3.4");
40
- println!("cargo:rerun-if-changed=build.rs");
41
-
42
- // デバッグ出力
43
- eprintln!("Ruby lib_dir: {}", lib_dir);
44
- eprintln!("Ruby hdr_dir: {}", hdr_dir);
45
- eprintln!("Ruby arch_dir: {}", arch_dir);
46
- }
@@ -1,197 +0,0 @@
1
- use magnus::{define_module, function, prelude::*, Error, RHash, Ruby, Value};
2
- use std::fs;
3
- use std::os::unix::fs::PermissionsExt;
4
- use std::path::Path;
5
-
6
- /// ディレクトリエントリ情報
7
- #[derive(Debug)]
8
- struct DirEntry {
9
- name: String,
10
- is_dir: bool,
11
- size: u64,
12
- mtime: i64,
13
- executable: bool,
14
- hidden: bool,
15
- }
16
-
17
- /// ディレクトリをスキャンしてエントリを取得
18
- fn scan_directory_impl(path: &str) -> Result<Vec<DirEntry>, std::io::Error> {
19
- let dir_path = Path::new(path);
20
-
21
- if !dir_path.is_dir() {
22
- return Err(std::io::Error::new(
23
- std::io::ErrorKind::NotFound,
24
- format!("Directory does not exist: {}", path),
25
- ));
26
- }
27
-
28
- let mut entries = Vec::new();
29
-
30
- for entry in fs::read_dir(dir_path)? {
31
- let entry = entry?;
32
- let metadata = entry.metadata()?;
33
- let file_name = entry.file_name();
34
- let name = file_name.to_string_lossy().to_string();
35
-
36
- // "." と ".." は除外
37
- if name == "." || name == ".." {
38
- continue;
39
- }
40
-
41
- let is_hidden = name.starts_with('.');
42
- let is_dir = metadata.is_dir();
43
- let size = metadata.len();
44
-
45
- // mtimeを取得
46
- let mtime = metadata
47
- .modified()
48
- .ok()
49
- .and_then(|t| t.duration_since(std::time::UNIX_EPOCH).ok())
50
- .map(|d| d.as_secs() as i64)
51
- .unwrap_or(0);
52
-
53
- // 実行可能フラグ(Unixのみ)
54
- let executable = {
55
- #[cfg(unix)]
56
- {
57
- let permissions = metadata.permissions();
58
- permissions.mode() & 0o111 != 0
59
- }
60
- #[cfg(not(unix))]
61
- {
62
- false
63
- }
64
- };
65
-
66
- entries.push(DirEntry {
67
- name,
68
- is_dir,
69
- size,
70
- mtime,
71
- executable,
72
- hidden: is_hidden,
73
- });
74
- }
75
-
76
- Ok(entries)
77
- }
78
-
79
- /// Rubyから呼び出されるscan_directory関数
80
- fn scan_directory(ruby: &Ruby, path: String) -> Result<Value, Error> {
81
- let entries = scan_directory_impl(&path)
82
- .map_err(|e| Error::new(ruby.exception_runtime_error(), e.to_string()))?;
83
-
84
- // Ruby配列を作成
85
- let ary = ruby.ary_new_capa(entries.len());
86
-
87
- for entry in entries {
88
- // Rubyハッシュを作成
89
- let hash = RHash::new();
90
- hash.aset(ruby.to_symbol("name"), entry.name)?;
91
- hash.aset(ruby.to_symbol("is_dir"), entry.is_dir)?;
92
- hash.aset(ruby.to_symbol("size"), entry.size)?;
93
- hash.aset(ruby.to_symbol("mtime"), entry.mtime)?;
94
- hash.aset(ruby.to_symbol("executable"), entry.executable)?;
95
- hash.aset(ruby.to_symbol("hidden"), entry.hidden)?;
96
-
97
- ary.push(hash)?;
98
- }
99
-
100
- Ok(ary.as_value())
101
- }
102
-
103
- /// 高速スキャン(エントリ数制限付き)
104
- fn scan_directory_fast(ruby: &Ruby, path: String, max_entries: usize) -> Result<Value, Error> {
105
- let dir_path = Path::new(&path);
106
-
107
- if !dir_path.is_dir() {
108
- return Err(Error::new(
109
- ruby.exception_runtime_error(),
110
- format!("Directory does not exist: {}", path),
111
- ));
112
- }
113
-
114
- let ary = ruby.ary_new_capa(max_entries.min(100));
115
- let mut count = 0;
116
-
117
- for entry in fs::read_dir(dir_path)
118
- .map_err(|e| Error::new(ruby.exception_runtime_error(), e.to_string()))?
119
- {
120
- if count >= max_entries {
121
- break;
122
- }
123
-
124
- let entry = entry.map_err(|e| Error::new(ruby.exception_runtime_error(), e.to_string()))?;
125
- let metadata = entry
126
- .metadata()
127
- .map_err(|e| Error::new(ruby.exception_runtime_error(), e.to_string()))?;
128
-
129
- let file_name = entry.file_name();
130
- let name = file_name.to_string_lossy().to_string();
131
-
132
- if name == "." || name == ".." {
133
- continue;
134
- }
135
-
136
- let is_hidden = name.starts_with('.');
137
- let is_dir = metadata.is_dir();
138
- let size = metadata.len();
139
-
140
- let mtime = metadata
141
- .modified()
142
- .ok()
143
- .and_then(|t| t.duration_since(std::time::UNIX_EPOCH).ok())
144
- .map(|d| d.as_secs() as i64)
145
- .unwrap_or(0);
146
-
147
- let executable = {
148
- #[cfg(unix)]
149
- {
150
- let permissions = metadata.permissions();
151
- permissions.mode() & 0o111 != 0
152
- }
153
- #[cfg(not(unix))]
154
- {
155
- false
156
- }
157
- };
158
-
159
- let hash = RHash::new();
160
- hash.aset(ruby.to_symbol("name"), name)?;
161
- hash.aset(ruby.to_symbol("is_dir"), is_dir)?;
162
- hash.aset(ruby.to_symbol("size"), size)?;
163
- hash.aset(ruby.to_symbol("mtime"), mtime)?;
164
- hash.aset(ruby.to_symbol("executable"), executable)?;
165
- hash.aset(ruby.to_symbol("hidden"), is_hidden)?;
166
-
167
- ary.push(hash)?;
168
- count += 1;
169
- }
170
-
171
- Ok(ary.as_value())
172
- }
173
-
174
- /// バージョン情報
175
- fn get_version(_ruby: &Ruby) -> Result<String, Error> {
176
- Ok("1.0.0-magnus".to_string())
177
- }
178
-
179
- /// Ruby拡張の初期化
180
- #[magnus::init]
181
- fn init(ruby: &Ruby) -> Result<(), Error> {
182
- // Rufioモジュールを取得または作成
183
- let rufio_module = match ruby.class_object().const_get::<_, magnus::RModule>("Rufio") {
184
- Ok(module) => module,
185
- Err(_) => define_module("Rufio")?,
186
- };
187
-
188
- // NativeScannerMagnusクラスを定義
189
- let scanner_class = rufio_module.define_class("NativeScannerMagnus", ruby.class_object())?;
190
-
191
- // クラスメソッドを定義
192
- scanner_class.define_singleton_method("scan_directory", function!(scan_directory, 1))?;
193
- scanner_class.define_singleton_method("scan_directory_fast", function!(scan_directory_fast, 2))?;
194
- scanner_class.define_singleton_method("version", function!(get_version, 0))?;
195
-
196
- Ok(())
197
- }