Code Monkey home page Code Monkey logo

cluflock's People

Contributors

denisandroid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cluflock's Issues

Range-based locks?

Any plans on extending the API to support range-based locks? Both fcntl & LockFileEx support this I think so all platforms should be doable.

Compatibility with async_std?

If I have an async_std::fs::File object, how do I use this API to acquire a lock? It seems like it operates on the actual std::fs::File object rather than on AsRawFd/AsRawHandle traits?

`FlockElement` and `WaitFlockUnlock` not implemented for `File` for `wasm32-unknown-unknown` build target

When using cluFlock on a wasm32-unknown-unknown build target I receive the errors

error[E0277]: the trait bound `File: FlockElement` is not satisfied.
error[E0277]: the trait bound `File: WaitFlockUnlock` is not satisfied. 

Context

I am using the settings_manager crate in a Tauri application. settings_manager depends on cluFlock. When building the application, which depends on settings_manager, to a wasm32-unknown-unknown target I receive the errors. However, when building to other targets (specifically x86_64-unknown-linux-gnu) everything builds fine.

Dependency graph
cluFlock <- settings_manager <- Tauri application

I wasn't sure what the most useful info to provide here was, so tried to give an overview. If there is anything else that would be useful, please let me know.

Make compatible with anyhow

I'm using the anyhow crate for error handling, and when I declare a function to use the anyhow::Result type, I can't get with_context and ? to work properly with functions from this crate here. For example:

SharedFlock::wait_lock(&lock_file)?

generates an error:

error[E0277]: the trait bound `FlockError<&std::fs::File>: StdError` is not satisfied
   --> src\config_file.rs:65:47
    |
65  |             SharedFlock::wait_lock(&lock_file)?
    |                                               ^ the trait `StdError` is not implemented for `FlockError<&std::fs::File>`
    |
    = note: required because of the requirements on the impl of `From<FlockError<&std::fs::File>>` for `anyhow::Error`
    = note: required because of the requirements on the impl of `FromResidual<Result<Infallible, FlockError<&std::fs::File>>>` for `Result<JuliaupConfig, anyhow::Error>`
note: required by `from_residual`
   --> C:\Users\david\.rustup\toolchains\stable-x86_64-pc-windows-msvc\lib/rustlib/src/rust\library\core\src\ops\try_trait.rs:339:5
    |
339 |     fn from_residual(residual: R) -> Self;
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0277`.

Not entirely clear to me what the problem is, maybe the error struct in cluFlock just needs to formally implement the std::Error trait? https://crates.io/crates/anyhow might have some info that someone with more Rust experience than me might be able to understand :)

Great package, thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.