Skip to content

Commit 27c3f93

Browse files
committed
updated readme
1 parent 0ff2a34 commit 27c3f93

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

README.md

+41-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,37 @@
1818
- [Rust Bindgen](https://rust-lang.github.io/rust-bindgen/)
1919
- [Rust FFI](https://doc.rust-lang.org/nomicon/ffi.html)
2020

21+
### Usage
22+
```rust
23+
use everything::{Everything, EverythingSort, EverythingRequestFlags};
24+
25+
let everything = Everything::new();
26+
everything.set_search("test");
27+
28+
everything.set_max_results(10);
29+
30+
everything.set_result_offset(10);
31+
32+
everything.set_request_flags(
33+
EverythingRequestFlags::FullPathAndFileName
34+
| EverythingRequestFlags::DateCreated
35+
| EverythingRequestFlags::DateModified
36+
| EverythingRequestFlags::Size
37+
| EverythingRequestFlags::Extension
38+
);
39+
40+
everything.set_sort(EverythingSort::DateCreatedDescending);
41+
42+
everything.query().unwrap();
43+
44+
let num_results = everything.get_result_count();
45+
46+
for path in everything.full_path_iter().flatten() {
47+
println!("{}", path);
48+
}
49+
50+
```
51+
2152
## Building
2253
After creating the target directory, you must copy the dll file to the target directory.
2354
The dll file can be found in the Everything SDK installation directory.
@@ -28,4 +59,13 @@ Currently the build scripts have a hardcoded path to the dll file that works on
2859
## node-everything
2960
This is a simple nodejs ffi wrapper around the Everything SDK.
3061
This is a work in progress and is not ready for use and should only be used as an example.
31-
Currently it dose not parse file paths very efficiently.
62+
Currently it dose not parse file paths very efficiently.
63+
64+
65+
## TODO
66+
- [ ] Add more tests
67+
- [ ] Add more documentation
68+
- [ ] Add more examples
69+
- [ ] Async queries
70+
- [ ] Automated build process
71+
- [ ] Publish to crates.io

everything/src/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,8 @@ impl Everything {
331331
EverythingRequestFlags::from_bits_truncate(request_flags)
332332
}
333333

334-
pub fn query(&self, wait: bool) -> Result<(), EverythingError> {
335-
let result = unsafe { Everything_QueryW(wait as BOOL) };
334+
pub fn query(&self) -> Result<(), EverythingError> {
335+
let result = unsafe { Everything_QueryW(1) };
336336
if result == 0 {
337337
Err(Everything::get_last_error())
338338
} else {
@@ -514,7 +514,7 @@ mod tests {
514514

515515
EVERYTHING.set_sort(EverythingSort::DateCreatedDescending);
516516

517-
EVERYTHING.query(true).unwrap();
517+
EVERYTHING.query().unwrap();
518518

519519
let num_results = EVERYTHING.get_result_count();
520520
assert_eq!(num_results, 10);

0 commit comments

Comments
 (0)