Add documentation

This commit is contained in:
link2xt
2023-01-27 23:09:26 +00:00
parent 7d3a591139
commit ae564ef702
9 changed files with 111 additions and 8 deletions

View File

@@ -27,12 +27,14 @@ impl Default for Events {
}
impl Events {
/// Creates a new event channel.
pub fn new() -> Self {
let (sender, receiver) = channel::bounded(1_000);
Self { receiver, sender }
}
/// Emits an event.
pub fn emit(&self, event: Event) {
match self.sender.try_send(event) {
Ok(()) => {}