iroh_n0des/
n0des.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::future::Future;

use anyhow::Result;
use iroh::Endpoint;

/// A trait for nodes that can be spawned and shut down
pub trait N0de: 'static + Send {
    fn spawn(endpoint: Endpoint) -> impl Future<Output = Result<Self>> + Send
    where
        Self: Sized;

    /// Asynchronously shut down the node
    fn shutdown(&mut self) -> impl Future<Output = Result<()>> + Send;
}