Smelling Salts
Start a thread to wake an async executor when the OS's I/O event notifier gathers that the hardware is ready.
If you're writing a Rust library to handle hardware asynchronously, you should use this crate. This library automatically wakes futures by registering a waker with a device that you construct with a file descriptor.
Currently Supported Platforms
- Linux (epoll)
Planned Platforms
- Windows
- MacOS
- BSD
- Various Bare Metal?
- Others?
Table of Contents
Getting Started
Add the following to your Cargo.toml
.
[]
= "0.1"
# Only include pasts for applications, don't use in libraries.
= "0.1"
Example
use pasts;
use ;
use TryInto;
use Future;
use mem;
use raw;
use Pin;
use ;
type c_ssize = isize; // True for most unix
type c_size = usize; // True for most unix
const MAGIC_NUMBER: u32 = 0xDEAD_BEEF;
// From fcntl.h
const O_CLOEXEC: c_int = 0o2000000;
const O_NONBLOCK: c_int = 0o0004000;
const O_DIRECT: c_int = 0o0040000;
extern "C"
// Convert a C error (negative on error) into a result.
// Create the sender and receiver for a pipe.
;
;
async
API
API documentation can be found on docs.rs.
Features
There are no optional features.
Upgrade
You can use the changelog to facilitate upgrading this crate as a dependency.
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- Zlib License, (LICENSE-ZLIB or https://opensource.org/licenses/Zlib)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Contributors are always welcome (thank you for being interested!), whether it be a bug report, bug fix, feature request, feature implementation or whatever. Don't be shy about getting involved. I always make time to fix bugs, so usually a patched version of the library will be out a few days after a report. Features requests will not complete as fast. If you have any questions, design critques, or want me to find you something to work on based on your skill level, you can email me at jeronlau@plopgrizzly.com. Otherwise, here's a link to the issues on GitHub. Before contributing, check out the contribution guidelines, and, as always, make sure to follow the code of conduct.