Skip to content

Commit

Permalink
feat(ingestion_stream): implement into for Result<Vec<IngestionNode>>
Browse files Browse the repository at this point in the history
  • Loading branch information
timonv committed Jun 26, 2024
1 parent d285874 commit 926cc0c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions swiftide/src/ingestion/ingestion_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ impl Into<IngestionStream> for Vec<Result<IngestionNode>> {
}
}

impl Into<IngestionStream> for Result<Vec<IngestionNode>> {
fn into(self) -> IngestionStream {
match self {
Ok(nodes) => IngestionStream::iter(nodes.into_iter().map(Ok)),
Err(err) => IngestionStream::iter(vec![Err(err)]),
}
}
}

impl Into<IngestionStream> for Pin<Box<dyn Stream<Item = Result<IngestionNode>> + Send>> {
fn into(self) -> IngestionStream {
IngestionStream { inner: self }
Expand Down

0 comments on commit 926cc0c

Please sign in to comment.