The single-threaded companion to async-oneshot.
Features:
- Fast and small, with easy to understand code.
- Only one dependency, which is also my library.
- Complete
no_std
support (withalloc
forRc
). - No
unsafe
!
#[test]
fn success_one_thread() {
let (s,r) = oneshot::<bool>();
assert_eq!((), s.send(true).unwrap());
assert_eq!(Ok(true), future::block_on(r));
}
Crap numbers from my shitty 2015 macbook pro:
test create ... bench: 91 ns/iter (+/- 11)
test create_send ... bench: 88 ns/iter (+/- 14)
test create_send_recv ... bench: 100 ns/iter (+/- 4)
Copyright (c) 2020 James Laver, async-oneshot-local contributors.
This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.