mirror of
https://github.com/bertptrs/beul.git
synced 2025-12-28 05:50:32 +01:00
Compare commits
9 Commits
48ec49a4f1
...
v1.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69cce123bf | ||
| 50b9489481 | |||
| 90e6a53024 | |||
|
|
b46631fda3 | ||
| b7e0f8e252 | |||
| 44fe3f0e76 | |||
|
|
a0966f70e9 | ||
| d2990202bd | |||
| 1533071426 |
52
.github/workflows/ci.yml
vendored
52
.github/workflows/ci.yml
vendored
@@ -17,34 +17,17 @@ jobs:
|
|||||||
- stable
|
- stable
|
||||||
- beta
|
- beta
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: dtolnay/rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
|
||||||
toolchain: ${{ matrix.rust }}
|
toolchain: ${{ matrix.rust }}
|
||||||
override: true
|
|
||||||
components: rustfmt, clippy
|
components: rustfmt, clippy
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
- run: cargo build --all-targets
|
||||||
with:
|
- run: cargo test
|
||||||
command: build
|
- run: cargo fmt --all -- --check
|
||||||
# --all-targets ensures that we also build tests
|
- run: cargo clippy --all-targets -- -D warnings
|
||||||
args: --all-features --all-targets
|
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: test
|
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: fmt
|
|
||||||
args: --all -- --check
|
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
|
||||||
with:
|
|
||||||
command: clippy
|
|
||||||
args: --all-targets -- -D warnings
|
|
||||||
|
|
||||||
# Reduced build for the Minimum Supported Rust Version. It does not include the lints as some of
|
# Reduced build for the Minimum Supported Rust Version. It does not include the lints as some of
|
||||||
# them are out-of-date and result in false positives on the codebase, e.g. mutex_atomic.
|
# them are out-of-date and result in false positives on the codebase, e.g. mutex_atomic.
|
||||||
@@ -52,33 +35,24 @@ jobs:
|
|||||||
name: MSRV
|
name: MSRV
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: dtolnay/rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
toolchain: "1.68"
|
||||||
toolchain: "1.51"
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
- run: cargo test
|
||||||
with:
|
|
||||||
command: test
|
|
||||||
|
|
||||||
miri:
|
miri:
|
||||||
name: Miri
|
name: Miri
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
- uses: actions-rs/toolchain@v1
|
- uses: dtolnay/rust-toolchain@v1
|
||||||
with:
|
with:
|
||||||
profile: minimal
|
|
||||||
toolchain: nightly
|
toolchain: nightly
|
||||||
override: true
|
|
||||||
components: miri, rust-src
|
components: miri, rust-src
|
||||||
|
|
||||||
- uses: actions-rs/cargo@v1
|
- run: cargo miri test
|
||||||
with:
|
|
||||||
command: miri
|
|
||||||
args: test
|
|
||||||
|
|||||||
14
CHANGELOG.md
14
CHANGELOG.md
@@ -6,6 +6,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## [1.0.0] - 2023-04-17
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Use dynamic dispatch internally to save on code gen. External API unchanged.
|
||||||
|
- No longer heap-allocate futures.
|
||||||
|
|
||||||
|
### Breaking
|
||||||
|
|
||||||
|
- Minimum supported Rust version bumped to 1.68.
|
||||||
|
|
||||||
## [0.1.1] - 2022-09-05
|
## [0.1.1] - 2022-09-05
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
@@ -16,6 +27,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- Initial release
|
- Initial release
|
||||||
|
|
||||||
[Unreleased]: https://github.com/bertptrs/beul/compare/v0.1.1...HEAD
|
[Unreleased]: https://github.com/bertptrs/beul/compare/v1.0.0...HEAD
|
||||||
|
[1.0.0]: https://github.com/bertptrs/beul/compare/v0.1.1...v1.0.0
|
||||||
[0.1.1]: https://github.com/bertptrs/beul/compare/v0.1.0...v0.1.1
|
[0.1.1]: https://github.com/bertptrs/beul/compare/v0.1.0...v0.1.1
|
||||||
[0.1.0]: https://github.com/bertptrs/beul/releases/tag/v0.1.0
|
[0.1.0]: https://github.com/bertptrs/beul/releases/tag/v0.1.0
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "beul"
|
name = "beul"
|
||||||
version = "0.1.1"
|
version = "1.0.0"
|
||||||
# Edition 2021 is not available in MSRV
|
edition = "2021"
|
||||||
edition = "2018"
|
|
||||||
license = "MIT OR Apache-2.0"
|
license = "MIT OR Apache-2.0"
|
||||||
description = "It executes futures"
|
description = "It executes futures"
|
||||||
repository = "https://github.com/bertptrs/beul/"
|
repository = "https://github.com/bertptrs/beul/"
|
||||||
rust-version = "1.51"
|
rust-version = "1.68"
|
||||||
authors = [
|
authors = [
|
||||||
"Bert Peters",
|
"Bert Peters",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2022 Bert Peters
|
Copyright (c) 2023 Bert Peters
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
12
README.md
12
README.md
@@ -1,6 +1,9 @@
|
|||||||
# Beul
|
# Beul
|
||||||
|
|
||||||
Beul is a minimalistic futures executor. No dependencies, no unsafe rust.
|
Beul is a minimalistic futures executor. No dependencies, no unsafe rust. It simply executes
|
||||||
|
futures.
|
||||||
|
|
||||||
|
"Beul" is Dutch for executioner. It's a pun.
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
@@ -12,8 +15,9 @@ beul::execute(async {});
|
|||||||
|
|
||||||
### Backwards compatibility
|
### Backwards compatibility
|
||||||
|
|
||||||
This crate requires at least Rust 1.51, due to its reliance on [Wake]. Increases in this version
|
This crate requires at least Rust 1.68, due to its reliance on [std::pin::pin!]. Increases in this
|
||||||
will be considered breaking changes. This crate follows semantic versioning.
|
version will be considered breaking changes and will be avoided if possible. The minimum supported
|
||||||
|
Rust version will only be bumped in major or minor versions. This crate follows semantic versioning.
|
||||||
|
|
||||||
### Limitations
|
### Limitations
|
||||||
|
|
||||||
@@ -37,4 +41,4 @@ work by you, as defined in the Apache-2.0 license, shall be dual licensed as abo
|
|||||||
additional terms or conditions.
|
additional terms or conditions.
|
||||||
|
|
||||||
[Tokio]: https://tokio.rs/
|
[Tokio]: https://tokio.rs/
|
||||||
[Wake]: https://doc.rust-lang.org/std/task/trait.Wake.html
|
[std::pin::pin!]: https://doc.rust-lang.org/std/pin/macro.pin.html
|
||||||
|
|||||||
10
src/lib.rs
10
src/lib.rs
@@ -16,6 +16,7 @@
|
|||||||
//! ```
|
//! ```
|
||||||
#![forbid(unsafe_code)]
|
#![forbid(unsafe_code)]
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
|
use std::pin::Pin;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::Condvar;
|
use std::sync::Condvar;
|
||||||
use std::sync::Mutex;
|
use std::sync::Mutex;
|
||||||
@@ -60,10 +61,15 @@ impl Wake for CondvarWake {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Block on specified [`Future`].
|
/// Block on specified [`Future`].
|
||||||
|
///
|
||||||
|
/// The future will be polled until completion on the current thread.
|
||||||
pub fn execute<T>(f: impl Future<Output = T>) -> T {
|
pub fn execute<T>(f: impl Future<Output = T>) -> T {
|
||||||
// TODO: replace with std::pin::pin once it gets stabilized
|
// Use dynamic dispatch to save on codegen
|
||||||
let mut pinned = Box::pin(f);
|
poll(std::pin::pin!(f))
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Poll a future until completion.
|
||||||
|
fn poll<T>(mut pinned: Pin<&mut dyn Future<Output = T>>) -> T {
|
||||||
let wake = Arc::new(CondvarWake::default());
|
let wake = Arc::new(CondvarWake::default());
|
||||||
let waker = Waker::from(Arc::clone(&wake));
|
let waker = Waker::from(Arc::clone(&wake));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user