Skip to content

Commit

Permalink
fixup router docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dignifiedquire committed Nov 28, 2024
1 parent 172c282 commit 03f8f4e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions iroh/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
//! # async fn test_compile() -> Result<()> {
//! let endpoint = Endpoint::builder().discovery_n0().bind().await?;
//!
//! const ALPN: &[u8] = b"/my/alpn";
//! let router = Router::builder(endpoint)
//! .accept(ALPN.to_vec(), Arc::new(Echo))
//! .accept(&ALPN, Arc::new(Echo))
//! .spawn()
//! .await?;
//! # Ok(())
Expand All @@ -27,7 +28,7 @@
//! Box::pin(async move {
//! let connection = connecting.await?;
//! let (mut send, mut recv) = connection.accept_bi().await?;
//!
//!
//! // Echo any bytes received back directly.
//! let bytes_sent = tokio::io::copy(&mut recv, &mut send).await?;
//!
Expand Down Expand Up @@ -70,13 +71,13 @@ use crate::{endpoint::Connecting, Endpoint};
/// # use std::sync::Arc;
/// # use anyhow::Result;
/// # use futures_lite::future::Boxed as BoxedFuture;
/// # use iroh::{endpoint::Connecting, protocol::ProtocolHandler, router::Router, Endpoint, NodeAddr};
/// # use iroh::{endpoint::Connecting, protocol::{ProtocolHandler, Router}, Endpoint, NodeAddr};
/// #
/// # async fn test_compile() -> Result<()> {
/// let endpoint = Endpoint::builder().discovery_n0().bind().await?;
///
/// let router = Router::builder(endpoint)
/// // .accept(ALPN.to_vec(), <something>)
/// // .accept(&ALPN, <something>)
/// .spawn()
/// .await?;
///
Expand All @@ -85,7 +86,6 @@ use crate::{endpoint::Connecting, Endpoint};
/// router.shutdown().await?;
/// # Ok(())
/// # }
///
/// ```
#[derive(Clone, Debug)]
pub struct Router {
Expand Down

0 comments on commit 03f8f4e

Please sign in to comment.