Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
reedHam committed May 6, 2023
1 parent 0ff2a34 commit 27c3f93
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,37 @@
- [Rust Bindgen](https://rust-lang.github.io/rust-bindgen/)
- [Rust FFI](https://doc.rust-lang.org/nomicon/ffi.html)

### Usage
```rust
use everything::{Everything, EverythingSort, EverythingRequestFlags};

let everything = Everything::new();
everything.set_search("test");

everything.set_max_results(10);

everything.set_result_offset(10);

everything.set_request_flags(
EverythingRequestFlags::FullPathAndFileName
| EverythingRequestFlags::DateCreated
| EverythingRequestFlags::DateModified
| EverythingRequestFlags::Size
| EverythingRequestFlags::Extension
);

everything.set_sort(EverythingSort::DateCreatedDescending);

everything.query().unwrap();

let num_results = everything.get_result_count();

for path in everything.full_path_iter().flatten() {
println!("{}", path);
}

```

## Building
After creating the target directory, you must copy the dll file to the target directory.
The dll file can be found in the Everything SDK installation directory.
Expand All @@ -28,4 +59,13 @@ Currently the build scripts have a hardcoded path to the dll file that works on
## node-everything
This is a simple nodejs ffi wrapper around the Everything SDK.
This is a work in progress and is not ready for use and should only be used as an example.
Currently it dose not parse file paths very efficiently.
Currently it dose not parse file paths very efficiently.


## TODO
- [ ] Add more tests
- [ ] Add more documentation
- [ ] Add more examples
- [ ] Async queries
- [ ] Automated build process
- [ ] Publish to crates.io
6 changes: 3 additions & 3 deletions everything/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,8 +331,8 @@ impl Everything {
EverythingRequestFlags::from_bits_truncate(request_flags)
}

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

EVERYTHING.set_sort(EverythingSort::DateCreatedDescending);

EVERYTHING.query(true).unwrap();
EVERYTHING.query().unwrap();

let num_results = EVERYTHING.get_result_count();
assert_eq!(num_results, 10);
Expand Down

0 comments on commit 27c3f93

Please sign in to comment.