Skip to content

Commit 3ca2720

Browse files
committed
feat: N0de trait
1 parent c0c41ce commit 3ca2720

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
mod client;
2+
mod n0des;
23
mod protocol;
34

45
pub mod caps;
56

67
pub use self::{
78
client::{Client, ClientBuilder},
9+
n0des::N0de,
810
protocol::{ClientMessage, ServerMessage, ALPN},
911
};

src/n0des.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
use anyhow::Result;
2+
use iroh::Endpoint;
3+
use n0_future::Future;
4+
5+
pub trait N0de: 'static + Send {
6+
fn spawn(endpoint: Endpoint) -> impl Future<Output = Result<Self>> + Send
7+
where
8+
Self: Sized;
9+
fn shutdown(&mut self) -> impl Future<Output = Result<()>> + Send;
10+
}

0 commit comments

Comments
 (0)