iroh-node-util 0.35.0

Utilities to build binaries containing an iroh endpoint
Documentation
//! Client to interact with iroh nodes and endpoints.
use anyhow::Result;
use futures_lite::{Stream, StreamExt};

pub mod net;
pub mod node;

fn flatten<T, E1, E2>(
    s: impl Stream<Item = Result<Result<T, E1>, E2>>,
) -> impl Stream<Item = Result<T>>
where
    E1: std::error::Error + Send + Sync + 'static,
    E2: std::error::Error + Send + Sync + 'static,
{
    s.map(|res| match res {
        Ok(Ok(res)) => Ok(res),
        Ok(Err(err)) => Err(err.into()),
        Err(err) => Err(err.into()),
    })
}