From 926cc0cca46023bcc3097a97b10ce03ae1fc3cc2 Mon Sep 17 00:00:00 2001 From: Timon Vonk Date: Wed, 26 Jun 2024 21:28:21 +0200 Subject: [PATCH] feat(ingestion_stream): implement into for Result> --- swiftide/src/ingestion/ingestion_stream.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/swiftide/src/ingestion/ingestion_stream.rs b/swiftide/src/ingestion/ingestion_stream.rs index 1feefa15..ea97667c 100644 --- a/swiftide/src/ingestion/ingestion_stream.rs +++ b/swiftide/src/ingestion/ingestion_stream.rs @@ -42,6 +42,15 @@ impl Into for Vec> { } } +impl Into for Result> { + fn into(self) -> IngestionStream { + match self { + Ok(nodes) => IngestionStream::iter(nodes.into_iter().map(Ok)), + Err(err) => IngestionStream::iter(vec![Err(err)]), + } + } +} + impl Into for Pin> + Send>> { fn into(self) -> IngestionStream { IngestionStream { inner: self }