Skip to content

Commit

Permalink
Fix doctests
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Oct 10, 2023
1 parent dbeeb14 commit 1978f9d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
4 changes: 1 addition & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ license = "MIT OR Apache-2.0"
readme = "README.md"

[patch.crates-io]
esp-idf-sys = { git = "https://github.com/esp-rs/esp-idf-sys" }
esp-idf-hal = { git = "https://github.com/esp-rs/esp-idf-hal" }
async-task = { git = "https://github.com/ivmarkov/async-task" }

[features]
Expand All @@ -22,7 +20,7 @@ unbounded = []
portable-atomic = ["dep:portable-atomic", "portable-atomic-util", "atomic-waker/portable-atomic", "async-task/portable-atomic"]

[dependencies]
heapless = { version = "0.7", default-featgures = false, features = ["cas"], optional = true }
heapless = { version = "0.7", default-features = false, features = ["cas"], optional = true }
portable-atomic = { version = "1.4", features = ["critical-section"], optional = true }
portable-atomic-util = { version = "0.1", default-features = false, features = ["alloc"], optional = true }
crossbeam-queue = { version = "0.3", default-features = false, features = ["alloc"] }
Expand Down
26 changes: 13 additions & 13 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ pub use futures_lite::future::block_on;
///
/// A multi-threaded executor:
///
/// ```
/// ```ignore
/// use async_channel::unbounded;
/// use easy_parallel::Parallel;
///
/// use edge_executor::{Executor, block_on};
///
/// let ex = Executor::new();
/// let ex: Executor = Default::default();
/// let (signal, shutdown) = unbounded::<()>();
///
/// Parallel::new()
Expand Down Expand Up @@ -74,7 +74,7 @@ impl<'a, const C: usize> Executor<'a, C> {
/// ```
/// use edge_executor::Executor;
///
/// let ex = Executor::new();
/// let ex: Executor = Default::default();
/// ```
pub fn new() -> Self {
Self {
Expand All @@ -96,7 +96,7 @@ impl<'a, const C: usize> Executor<'a, C> {
/// ```
/// use edge_executor::Executor;
///
/// let ex = Executor::new();
/// let ex: Executor = Default::default();
///
/// let task = ex.spawn(async {
/// println!("Hello world");
Expand All @@ -123,7 +123,7 @@ impl<'a, const C: usize> Executor<'a, C> {
/// ```
/// use edge_executor::Executor;
///
/// let ex = Executor::new();
/// let ex: Executor = Default::default();
/// assert!(!ex.try_tick()); // no tasks to run
///
/// let task = ex.spawn(async {
Expand Down Expand Up @@ -152,7 +152,7 @@ impl<'a, const C: usize> Executor<'a, C> {
/// ```
/// use edge_executor::{Executor, block_on};
///
/// let ex = LocalExecutor::new();
/// let ex: Executor = Default::default();
///
/// let task = ex.spawn(async {
/// println!("Hello world");
Expand All @@ -170,7 +170,7 @@ impl<'a, const C: usize> Executor<'a, C> {
/// ```
/// use edge_executor::{Executor, block_on};
///
/// let ex = Executor::new();
/// let ex: Executor = Default::default();
///
/// let task = ex.spawn(async { 1 + 2 });
/// let res = block_on(ex.run(async { task.await * 2 }));
Expand Down Expand Up @@ -291,7 +291,7 @@ unsafe impl<'a, const C: usize> Sync for Executor<'a, C> {}
/// ```
/// use edge_executor::{LocalExecutor, block_on};
///
/// let local_ex = LocalExecutor::new();
/// let local_ex: LocalExecutor = Default::default();
///
/// block_on(local_ex.run(async {
/// println!("Hello world!");
Expand All @@ -311,7 +311,7 @@ impl<'a, const C: usize> LocalExecutor<'a, C> {
/// ```
/// use edge_executor::LocalExecutor;
///
/// let local_ex = LocalExecutor::new();
/// let local_ex: LocalExecutor = Default::default();
/// ```
pub fn new() -> Self {
Self {
Expand All @@ -327,7 +327,7 @@ impl<'a, const C: usize> LocalExecutor<'a, C> {
/// ```
/// use edge_executor::LocalExecutor;
///
/// let local_ex = LocalExecutor::new();
/// let local_ex: LocalExecutor = Default::default();
///
/// let task = local_ex.spawn(async {
/// println!("Hello world");
Expand All @@ -354,7 +354,7 @@ impl<'a, const C: usize> LocalExecutor<'a, C> {
/// ```
/// use edge_executor::LocalExecutor;
///
/// let local_ex = LocalExecutor::new();
/// let local_ex: LocalExecutor = Default::default();
/// assert!(!local_ex.try_tick()); // no tasks to run
///
/// let task = local_ex.spawn(async {
Expand All @@ -377,7 +377,7 @@ impl<'a, const C: usize> LocalExecutor<'a, C> {
/// ```
/// use edge_executor::{LocalExecutor, block_on};
///
/// let local_ex = LocalExecutor::new();
/// let local_ex: LocalExecutor = Default::default();
///
/// let task = local_ex.spawn(async {
/// println!("Hello world");
Expand All @@ -395,7 +395,7 @@ impl<'a, const C: usize> LocalExecutor<'a, C> {
/// ```
/// use edge_executor::{LocalExecutor, block_on};
///
/// let local_ex = LocalExecutor::new();
/// let local_ex: LocalExecutor = Default::default();
///
/// let task = local_ex.spawn(async { 1 + 2 });
/// let res = block_on(local_ex.run(async { task.await * 2 }));
Expand Down

0 comments on commit 1978f9d

Please sign in to comment.