forked from a16z/magi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement AsyncIterator and PurgeableAsyncIterator (#27)
* super simple implementation * fix test * extend down stack and with specular batches * fix linting * missed unused import * final lints that were missed * really final lint fix * fix issues clippy brought up
- Loading branch information
1 parent
ea7f8a5
commit b053c0d
Showing
10 changed files
with
115 additions
and
76 deletions.
There are no files selected for viewing
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,8 @@ | ||
use async_trait::async_trait; | ||
|
||
#[async_trait] | ||
pub trait AsyncIterator { | ||
type Item; | ||
|
||
async fn next(&mut self) -> Option<Self::Item>; | ||
} |
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 |
---|---|---|
@@ -1,4 +1,8 @@ | ||
/// Iterator that can purge itself | ||
pub trait PurgeableIterator: Iterator { | ||
fn purge(&mut self); | ||
use crate::derive::async_iterator::AsyncIterator; | ||
use async_trait::async_trait; | ||
|
||
/// AsyncIterator that can purge itself | ||
#[async_trait] | ||
pub trait PurgeableAsyncIterator: AsyncIterator { | ||
async fn purge(&mut self); | ||
} |
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
Oops, something went wrong.