Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* quick and dirty fix for infinite loop in state machine * use the type system to make it harder for this bug to occur * update tests and examples to target .NET 6
- Loading branch information
1 parent
056c6bb
commit 7f997f9
Showing
11 changed files
with
80 additions
and
54 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use crate::Shutdown; | ||
|
||
/// wrap a Tokio receiver and only provide a recv() that returns a Result<T, Shutdown> | ||
/// that makes it harder to misuse. | ||
pub(crate) struct Receiver<T>(tokio::sync::mpsc::Receiver<T>); | ||
|
||
impl<T> From<tokio::sync::mpsc::Receiver<T>> for Receiver<T> { | ||
fn from(value: tokio::sync::mpsc::Receiver<T>) -> Self { | ||
Self(value) | ||
} | ||
} | ||
|
||
impl<T> Receiver<T> { | ||
pub(crate) async fn recv(&mut self) -> Result<T, Shutdown> { | ||
self.0.recv().await.ok_or(Shutdown) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters