From 132e50f03e22e4e6310a84dfcfae5835f43f5c8a Mon Sep 17 00:00:00 2001 From: Frando Date: Mon, 20 Oct 2025 21:17:52 +0000 Subject: [PATCH] deploy: f547f84baed8ece5b8a7140178ab3801391a6585 --- .../docs/iroh/endpoint/enum.BindError.html | 4 +- pr/3561/docs/iroh/index.html | 4 +- .../docs/iroh_dns_server/config/index.html | 2 +- .../iroh_dns_server/config/struct.Config.html | 8 +- .../iroh_dns_server/http/enum.CertMode.html | 10 +- pr/3561/docs/iroh_dns_server/http/index.html | 2 +- .../http/struct.HttpConfig.html | 6 +- .../http/struct.HttpServer.html | 12 +- .../http/struct.HttpsConfig.html | 6 +- pr/3561/docs/iroh_dns_server/index.html | 2 +- .../docs/search.index/path/9b8788cabd79.js | 1 + .../docs/search.index/path/eb6d0f5c7521.js | 1 - pr/3561/docs/search.index/root.js | 2 +- pr/3561/docs/src/bulk/bulk.rs.html | 2 +- pr/3561/docs/src/iroh/discovery.rs.html | 20 +- pr/3561/docs/src/iroh/discovery/mdns.rs.html | 10 +- .../iroh/discovery/static_provider.rs.html | 6 +- pr/3561/docs/src/iroh/endpoint.rs.html | 16 +- .../docs/src/iroh/endpoint/presets.rs.html | 2 +- pr/3561/docs/src/iroh/lib.rs.html | 12 +- pr/3561/docs/src/iroh/magicsock.rs.html | 44 +- pr/3561/docs/src/iroh_bench/iroh.rs.html | 18 +- pr/3561/docs/src/iroh_bench/lib.rs.html | 2 +- pr/3561/docs/src/iroh_bench/quinn.rs.html | 18 +- .../docs/src/iroh_dns_server/config.rs.html | 168 ++-- pr/3561/docs/src/iroh_dns_server/dns.rs.html | 2 +- .../dns/node_authority.rs.html | 387 ++++---- pr/3561/docs/src/iroh_dns_server/http.rs.html | 499 +++++----- .../docs/src/iroh_dns_server/http/doh.rs.html | 2 +- .../iroh_dns_server/http/doh/response.rs.html | 264 +++--- .../src/iroh_dns_server/http/error.rs.html | 4 +- .../docs/src/iroh_dns_server/http/tls.rs.html | 349 ++++--- pr/3561/docs/src/iroh_dns_server/lib.rs.html | 147 +-- .../docs/src/iroh_dns_server/server.rs.html | 2 +- .../docs/src/iroh_dns_server/store.rs.html | 2 +- .../store/signed_packets.rs.html | 505 +++++------ pr/3561/docs/src/iroh_dns_server/util.rs.html | 8 +- .../docs/src/iroh_relay/server/client.rs.html | 849 +++++++++--------- .../trait.impl/core/marker/trait.Freeze.js | 4 +- .../docs/type.impl/alloc/boxed/struct.Box.js | 4 +- 40 files changed, 1706 insertions(+), 1700 deletions(-) create mode 100644 pr/3561/docs/search.index/path/9b8788cabd79.js delete mode 100644 pr/3561/docs/search.index/path/eb6d0f5c7521.js diff --git a/pr/3561/docs/iroh/endpoint/enum.BindError.html b/pr/3561/docs/iroh/endpoint/enum.BindError.html index 185fa27b9d..0e766c5506 100644 --- a/pr/3561/docs/iroh/endpoint/enum.BindError.html +++ b/pr/3561/docs/iroh/endpoint/enum.BindError.html @@ -1,4 +1,4 @@ -BindError in iroh::endpoint - Rust

BindError

Enum BindError 

Source
#[non_exhaustive]
pub enum BindError { +BindError in iroh::endpoint - Rust

BindError

Enum BindError 

Source
#[non_exhaustive]
pub enum BindError { MagicSpawn { source: CreateHandleError, meta: Meta, @@ -9,7 +9,7 @@ }, }

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

MagicSpawn

Fields

§source: CreateHandleError
§meta: Meta

Captured call-site metadata

§

Discovery

Fields

§meta: Meta

Captured call-site metadata

-

Trait Implementations§

Source§

impl Debug for BindError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for BindError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for BindError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<BindError> for AnyError

Source§

fn from(value: BindError) -> AnyError

Converts to this type from the input type.
Source§

impl From<IntoDiscoveryError> for BindError

Source§

fn from(source: IntoDiscoveryError) -> Self

Converts to this type from the input type.
Source§

impl StackError for BindError

Source§

fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

Returns this error as a std error reference.
Source§

fn as_dyn(&self) -> &dyn StackError

Returns this error as a dyn StackError.
Source§

fn meta(&self) -> Option<&Meta>

Returns metadata captured at creation time, if available.
Source§

fn source(&self) -> Option<ErrorRef<'_>>

Returns the next source in the chain, if any.
Source§

fn is_transparent(&self) -> bool

Returns whether this error is transparent and should be skipped in reports.
§

fn as_ref(&self) -> ErrorRef<'_>

Returns this error as an [ErrorRef]. Read more
§

fn stack(&self) -> Chain<'_>

Returns an iterator over this error followed by its sources.
§

fn sources(&self) -> Chain<'_>

Returns an iterator over sources of this error (skipping self).
§

fn report(&self) -> Report<'_>

Returns a [Report] to output the error with configurable formatting.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where +

Trait Implementations§

Source§

impl Debug for BindError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for BindError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for BindError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<BindError> for AnyError

Source§

fn from(value: BindError) -> AnyError

Converts to this type from the input type.
Source§

impl From<IntoDiscoveryError> for BindError

Source§

fn from(source: IntoDiscoveryError) -> Self

Converts to this type from the input type.
Source§

impl StackError for BindError

Source§

fn as_std(&self) -> &(dyn Error + Send + Sync + 'static)

Returns this error as a std error reference.
Source§

fn as_dyn(&self) -> &dyn StackError

Returns this error as a dyn StackError.
Source§

fn meta(&self) -> Option<&Meta>

Returns metadata captured at creation time, if available.
Source§

fn source(&self) -> Option<ErrorRef<'_>>

Returns the next source in the chain, if any.
Source§

fn is_transparent(&self) -> bool

Returns whether this error is transparent and should be skipped in reports.
§

fn as_ref(&self) -> ErrorRef<'_>

Returns this error as an [ErrorRef]. Read more
§

fn stack(&self) -> Chain<'_>

Returns an iterator over this error followed by its sources.
§

fn sources(&self) -> Chain<'_>

Returns an iterator over sources of this error (skipping self).
§

fn report(&self) -> Report<'_>

Returns a [Report] to output the error with configurable formatting.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> AsErrorSource for T
where T: Error + 'static,

§

fn as_error_source(&self) -> &(dyn Error + 'static)

For maximum effectiveness, this needs to be called as a method to benefit from Rust’s automatic dereferencing of method diff --git a/pr/3561/docs/iroh/index.html b/pr/3561/docs/iroh/index.html index 8ec2235d25..3ea3742c4b 100644 --- a/pr/3561/docs/iroh/index.html +++ b/pr/3561/docs/iroh/index.html @@ -128,7 +128,7 @@ connecting using only the Endpoint, which allows you to connect to other endpoints:

use iroh::{Endpoint, EndpointAddr};
-use n0_snafu::{Result, ResultExt};
+use n0_error::{Result, StackResultExt};
 
 async fn connect(addr: EndpointAddr) -> Result<()> {
     // The Endpoint is the central object that manages an iroh node.
@@ -151,7 +151,7 @@ connecting using only the 
use iroh::{Endpoint, EndpointAddr};
 use n0_future::StreamExt;
-use n0_snafu::{Result, ResultExt};
+use n0_error::{Result, StackResultExt};
 
 async fn accept() -> Result<()> {
     // To accept connections at least one ALPN must be configured.
diff --git a/pr/3561/docs/iroh_dns_server/config/index.html b/pr/3561/docs/iroh_dns_server/config/index.html
index c7f87fe392..7a806fdf29 100644
--- a/pr/3561/docs/iroh_dns_server/config/index.html
+++ b/pr/3561/docs/iroh_dns_server/config/index.html
@@ -1,2 +1,2 @@
-iroh_dns_server::config - Rust

Module config

Module config 

Source
Expand description

Configuration for the server

+iroh_dns_server::config - Rust

Module config

Module config 

Source
Expand description

Configuration for the server

Structs§

Config
Server configuration
MainlineConfig
The config for the metrics server.
MetricsConfig
The config for the metrics server.
StoreConfig
The config for the store.

Enums§

BootstrapOption
Configure the bootstrap servers for mainline DHT resolution.
\ No newline at end of file diff --git a/pr/3561/docs/iroh_dns_server/config/struct.Config.html b/pr/3561/docs/iroh_dns_server/config/struct.Config.html index 6594f3ed0a..6d45f8db58 100644 --- a/pr/3561/docs/iroh_dns_server/config/struct.Config.html +++ b/pr/3561/docs/iroh_dns_server/config/struct.Config.html @@ -21,10 +21,10 @@ and testing.

§mainline: Option<MainlineConfig>

Config for the mainline lookup.

§zone_store: Option<StoreConfig>

Config for the zone store.

§pkarr_put_rate_limit: RateLimitConfig

Config for pkarr rate limit

-

Implementations§

Source§

impl Config

Source

pub async fn load(path: impl AsRef<Path>) -> Result<Config>

Load the config from a file.

-
Source

pub fn data_dir() -> Result<PathBuf>

Get the data directory.

-
Source

pub fn signed_packet_store_path() -> Result<PathBuf>

Get the path to the store database file.

-

Trait Implementations§

Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Config

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where +

Implementations§

Source§

impl Config

Source

pub async fn load(path: impl AsRef<Path>) -> Result<Config>

Load the config from a file.

+
Source

pub fn data_dir() -> Result<PathBuf>

Get the data directory.

+
Source

pub fn signed_packet_store_path() -> Result<PathBuf>

Get the path to the store database file.

+

Trait Implementations§

Source§

impl Debug for Config

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Config

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Config

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Config

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where diff --git a/pr/3561/docs/iroh_dns_server/http/enum.CertMode.html b/pr/3561/docs/iroh_dns_server/http/enum.CertMode.html index aa2ba319a6..839f80274e 100644 --- a/pr/3561/docs/iroh_dns_server/http/enum.CertMode.html +++ b/pr/3561/docs/iroh_dns_server/http/enum.CertMode.html @@ -1,4 +1,4 @@ -CertMode in iroh_dns_server::http - Rust

CertMode

Enum CertMode 

Source
pub enum CertMode {
+CertMode in iroh_dns_server::http - Rust

CertMode

Enum CertMode 

Source
pub enum CertMode {
     Manual,
     LetsEncrypt,
     SelfSigned,
@@ -6,10 +6,10 @@
 

Variants§

§

Manual

Certs are loaded from a the cert_cache path

§

LetsEncrypt

ACME with LetsEncrypt servers

§

SelfSigned

Create self-signed certificates and store them in the cert_cache path

-

Trait Implementations§

Source§

impl Clone for CertMode

Source§

fn clone(&self) -> CertMode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CertMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CertMode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where - __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for CertMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for CertMode

Source§

fn eq(&self, other: &CertMode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, -and should not be overridden without very good reason.
Source§

impl Serialize for CertMode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where - __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for CertMode

Source§

impl StructuralPartialEq for CertMode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where +

Trait Implementations§

Source§

impl Clone for CertMode

Source§

fn clone(&self) -> CertMode

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CertMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for CertMode

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Display for CertMode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl PartialEq for CertMode

Source§

fn eq(&self, other: &CertMode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, +and should not be overridden without very good reason.
Source§

impl Serialize for CertMode

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where + __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Eq for CertMode

Source§

impl StructuralPartialEq for CertMode

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( diff --git a/pr/3561/docs/iroh_dns_server/http/index.html b/pr/3561/docs/iroh_dns_server/http/index.html index 879ea42a0e..112ec2459d 100644 --- a/pr/3561/docs/iroh_dns_server/http/index.html +++ b/pr/3561/docs/iroh_dns_server/http/index.html @@ -1,2 +1,2 @@ -iroh_dns_server::http - Rust

Module http

Module http 

Source
Expand description

HTTP server part of iroh-dns-server

+iroh_dns_server::http - Rust

Module http

Module http 

Source
Expand description

HTTP server part of iroh-dns-server

Structs§

HttpConfig
Config for the HTTP server
HttpServer
The HTTP(S) server part of iroh-dns-server
HttpsConfig
Config for the HTTPS server

Enums§

CertMode
The mode how SSL certificates should be created.
RateLimitConfig
Config for http server rate limit.
\ No newline at end of file diff --git a/pr/3561/docs/iroh_dns_server/http/struct.HttpConfig.html b/pr/3561/docs/iroh_dns_server/http/struct.HttpConfig.html index 11e949dbeb..fea9ecfeb6 100644 --- a/pr/3561/docs/iroh_dns_server/http/struct.HttpConfig.html +++ b/pr/3561/docs/iroh_dns_server/http/struct.HttpConfig.html @@ -1,11 +1,11 @@ -HttpConfig in iroh_dns_server::http - Rust

HttpConfig

Struct HttpConfig 

Source
pub struct HttpConfig {
+HttpConfig in iroh_dns_server::http - Rust

HttpConfig

Struct HttpConfig 

Source
pub struct HttpConfig {
     pub port: u16,
     pub bind_addr: Option<IpAddr>,
 }
Expand description

Config for the HTTP server

Fields§

§port: u16

Port to bind to

§bind_addr: Option<IpAddr>

Optionally set a custom bind address (will use 0.0.0.0 if unset)

-

Trait Implementations§

Source§

impl Clone for HttpConfig

Source§

fn clone(&self) -> HttpConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for HttpConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where - __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for HttpConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where +

Trait Implementations§

Source§

impl Clone for HttpConfig

Source§

fn clone(&self) -> HttpConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for HttpConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for HttpConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where diff --git a/pr/3561/docs/iroh_dns_server/http/struct.HttpServer.html b/pr/3561/docs/iroh_dns_server/http/struct.HttpServer.html index c7b0daa6c8..827895b05e 100644 --- a/pr/3561/docs/iroh_dns_server/http/struct.HttpServer.html +++ b/pr/3561/docs/iroh_dns_server/http/struct.HttpServer.html @@ -1,14 +1,14 @@ -HttpServer in iroh_dns_server::http - Rust

HttpServer

Struct HttpServer 

Source
pub struct HttpServer { /* private fields */ }
Expand description

The HTTP(S) server part of iroh-dns-server

-

Implementations§

Source§

impl HttpServer

Source

pub async fn spawn( +HttpServer in iroh_dns_server::http - Rust

HttpServer

Struct HttpServer 

Source
pub struct HttpServer { /* private fields */ }
Expand description

The HTTP(S) server part of iroh-dns-server

+

Implementations§

Source§

impl HttpServer

Source

pub async fn spawn( http_config: Option<HttpConfig>, https_config: Option<HttpsConfig>, rate_limit_config: RateLimitConfig, state: AppState, ) -> Result<HttpServer>

Spawn the server

-
Source

pub fn http_addr(&self) -> Option<SocketAddr>

Get the bound address of the HTTP socket.

-
Source

pub fn https_addr(&self) -> Option<SocketAddr>

Get the bound address of the HTTPS socket.

-
Source

pub async fn shutdown(self) -> Result<()>

Shutdown the server and wait for all tasks to complete.

-
Source

pub async fn run_until_done(self) -> Result<()>

Wait for all tasks to complete.

+
Source

pub fn http_addr(&self) -> Option<SocketAddr>

Get the bound address of the HTTP socket.

+
Source

pub fn https_addr(&self) -> Option<SocketAddr>

Get the bound address of the HTTPS socket.

+
Source

pub async fn shutdown(self) -> Result<()>

Shutdown the server and wait for all tasks to complete.

+
Source

pub async fn run_until_done(self) -> Result<()>

Wait for all tasks to complete.

Runs forever unless tasks fail.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where diff --git a/pr/3561/docs/iroh_dns_server/http/struct.HttpsConfig.html b/pr/3561/docs/iroh_dns_server/http/struct.HttpsConfig.html index 2e9af50e2b..37b5c6470b 100644 --- a/pr/3561/docs/iroh_dns_server/http/struct.HttpsConfig.html +++ b/pr/3561/docs/iroh_dns_server/http/struct.HttpsConfig.html @@ -1,4 +1,4 @@ -HttpsConfig in iroh_dns_server::http - Rust

HttpsConfig

Struct HttpsConfig 

Source
pub struct HttpsConfig {
+HttpsConfig in iroh_dns_server::http - Rust

HttpsConfig

Struct HttpsConfig 

Source
pub struct HttpsConfig {
     pub port: u16,
     pub bind_addr: Option<IpAddr>,
     pub domains: Vec<String>,
@@ -12,8 +12,8 @@
 
§cert_mode: CertMode

The mode of SSL certificate creation

§letsencrypt_contact: Option<String>

Letsencrypt contact email address (required if using CertMode::LetsEncrypt)

§letsencrypt_prod: Option<bool>

Whether to use the letsenrypt production servers (only applies to CertMode::LetsEncrypt)

-

Trait Implementations§

Source§

impl Clone for HttpsConfig

Source§

fn clone(&self) -> HttpsConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpsConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for HttpsConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where - __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for HttpsConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where +

Trait Implementations§

Source§

impl Clone for HttpsConfig

Source§

fn clone(&self) -> HttpsConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for HttpsConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for HttpsConfig

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where + __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for HttpsConfig

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where diff --git a/pr/3561/docs/iroh_dns_server/index.html b/pr/3561/docs/iroh_dns_server/index.html index 6f323b55d4..8702974b68 100644 --- a/pr/3561/docs/iroh_dns_server/index.html +++ b/pr/3561/docs/iroh_dns_server/index.html @@ -1,2 +1,2 @@ -iroh_dns_server - Rust

Crate iroh_dns_server

Crate iroh_dns_server 

Source
Expand description

A DNS server and pkarr relay

+iroh_dns_server - Rust

Crate iroh_dns_server

Crate iroh_dns_server 

Source
Expand description

A DNS server and pkarr relay

Modules§

config
Configuration for the server
dns
Implementation of a DNS name server for iroh endpoint announces
http
HTTP server part of iroh-dns-server
metrics
Metrics support for the server
server
The main server which combines the DNS and HTTP(S) servers.
state
Shared state and store for the iroh-dns-server

Structs§

ZoneStore
A store for pkarr signed packets.
\ No newline at end of file diff --git a/pr/3561/docs/search.index/path/9b8788cabd79.js b/pr/3561/docs/search.index/path/9b8788cabd79.js new file mode 100644 index 0000000000..c14e5124b6 --- /dev/null +++ b/pr/3561/docs/search.index/path/9b8788cabd79.js @@ -0,0 +1 @@ +rd_("f[1,\"\"]0Al[10,\"core::cmp\",\"core::cmp\"]Al[10,\"core::ops\",\"core::ops\"]Ce[5,\"clap_builder::util::id\",\"clap_builder::util::id\"]Bd[15,\"iroh_relay::client::DialError\"]Cg[5,\"iroh::endpoint::presets\",\"iroh::endpoint::presets\"]Eg[5,\"tower_http::follow_redirect::policy::or\",\"tower_http::follow_redirect::policy::or\"]66Ei[5,\"tower_http::follow_redirect::policy::and\",\"tower_http::follow_redirect::policy::and\"]A`[10,\"core::any\"]Ao[5,\"alloc::sync\",\"alloc::sync\"]Ba[5,\"alloc::boxed\",\"alloc::boxed\"]Cb[10,\"bytes::buf::buf_impl\",\"bytes::buf::buf_impl\"]Bi[6,\"iroh_quinn_proto\",\"iroh_quinn_proto\"]8Al[15,\"iroh::KeyParsingError\"]Ba[15,\"iroh_base::KeyParsingError\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Am[5,\"iroh_bench\",\"iroh_bench\"]Bg[5,\"iroh_bench::s2n\",\"iroh_bench::s2n\"]A`[10,\"core::cmp\"]Ak[5,\"core::pin\",\"core::pin\"]Bg[15,\"iroh_relay::client::ConnectError\"]o[5,\"url\",\"url\"]Am[5,\"alloc::vec\",\"alloc::vec\"]Al[2,\"iroh::discovery::pkarr\"]j[2,\"iroh\"]Ae[2,\"iroh::discovery\"]A`[2,\"iroh_relay\"]Ae[2,\"iroh_dns_server\"]f[1,\"\"]00Ao[2,\"iroh::net_report::options\"]o[2,\"iroh_base\"]f[0,\"\"]A`[2,\"iroh_bench\"]4Ak[2,\"iroh_dns_server::http\"]555Ak[10,\"clap_builder::derive\"]>Af[10,\"core::ops::drop\"]Ad[10,\"core::convert\"]Aa[10,\"core::hash\"]1g[17,\"\"]Ci[5,\"iroh_quinn_proto::crypto\",\"iroh_quinn_proto::crypto\"]Bd[15,\"iroh_base::ticket::ParseError\"]Be[5,\"n0_error::meta\",\"n0_error::meta\"]Cc[5,\"reqwest::dns::resolve\",\"reqwest::dns::resolve\"]Dg[5,\"hickory_proto::rr::domain::name\",\"hickory_proto::rr::domain::name\"]Ak[5,\"std::path\",\"std::path\"]Bi[6,\"core::task::poll\",\"core::task::poll\"]Bb[10,\"core::marker\",\"core::marker\"]Bi[6,\"iroh_quinn_proto\",\"iroh_quinn_proto\"]Ac[10,\"futures_sink\"]2Bf[15,\"iroh::discovery::DiscoveryError\"]Bj[15,\"iroh::discovery::IntoDiscoveryError\"]Bb[15,\"iroh::protocol::AcceptError\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ah[10,\"ppv_lite86::types\"]f[1,\"\"]f[3,\"\"]Ah[2,\"iroh_relay::client\"]A`[2,\"iroh_relay\"]Ae[2,\"iroh_dns_server\"]A`[2,\"iroh_bench\"]4Ae[2,\"iroh::discovery\"]Ad[2,\"iroh::defaults\"]4Bk[2,\"iroh_quinn_proto::connection::streams\"]88Ad[10,\"core::convert\"]Ca[8,\"futures_lite::future\",\"futures_lite::future\"]Ca[8,\"futures_lite::stream\",\"futures_lite::stream\"]Ba[5,\"bytes::bytes\",\"bytes::bytes\"]Ad[5,\"iroh::endpoint\"]Ab[10,\"core::clone\"]Cg[6,\"iroh_quinn_proto::frame\",\"iroh_quinn_proto::frame\"]Ao[10,\"iroh_quinn_proto::coding\"]A`[10,\"core::fmt\"]Ag[10,\"core::ops::deref\"]Bk[15,\"iroh::endpoint::AddEndpointAddrError\"]Ak[5,\"core::fmt\",\"core::fmt\"]Ab[10,\"core::error\"]Be[5,\"std::io::error\",\"std::io::error\"]Bc[6,\"rustls::error\",\"rustls::error\"]Ba[8,\"clap_builder\",\"clap_builder\"]Bi[5,\"signature::error\",\"signature::error\"]Bg[6,\"postcard::error\",\"postcard::error\"]Af[2,\"iroh_relay::quic\"]Bc[2,\"iroh_relay::protos::handshake\"]Ao[2,\"iroh_relay::protos::relay\"]Ba[5,\"hyper::error\",\"hyper::error\"]Ee[6,\"iroh_quinn_proto::transport_parameters\",\"iroh_quinn_proto::transport_parameters\"]Be[5,\"reqwest::error\",\"reqwest::error\"]Cg[6,\"tokio_websockets::error\",\"tokio_websockets::error\"]Bi[6,\"iroh_relay::quic\",\"iroh_relay::quic\"]Dc[6,\"iroh_relay::protos::handshake\",\"iroh_relay::protos::handshake\"]Ck[6,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Ca[6,\"iroh::net_report\",\"iroh::net_report::probes\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Bb[10,\"core::marker\",\"core::marker\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]1g[17,\"\"]f[1,\"\"]Ah[2,\"iroh_relay::protos\"]Af[2,\"iroh_quinn_proto\"]Ae[2,\"iroh::discovery\"]A`[2,\"iroh_bench\"]34Ae[2,\"iroh_dns_server\"]1Bb[2,\"iroh_quinn_proto::connection\"]166Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Ac[10,\"core::borrow\"]C`[10,\"bytes::buf::buf_mut\",\"bytes::buf::buf_mut\"]Bc[5,\"pkarr::client\",\"pkarr::client\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ba[5,\"async_compat\",\"async_compat\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Al[15,\"iroh::KeyParsingError\"]Ba[15,\"iroh_base::KeyParsingError\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Cb[10,\"core::future::future\",\"core::future::future\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]An[10,\"core::hash\",\"core::hash\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]Bm[6,\"core::net::ip_addr\",\"core::net::ip_addr\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Bh[10,\"reloadable_core\",\"reloadable_core\"]Be[15,\"iroh_relay::server::CertConfig\"]Ad[5,\"iroh::endpoint\"]Ba[6,\"core::option\",\"core::option\"]g[17,\"\"]E`[10,\"tower_http::follow_redirect::policy\",\"tower_http::follow_redirect::policy\"]Ch[10,\"iroh::endpoint::presets\",\"iroh::endpoint::presets\"]Co[5,\"hickory_proto::rr::resource\",\"hickory_proto::rr::resource\"]Ca[5,\"iroh::net_report\",\"iroh::net_report::report\"]Ak[8,\"core::fmt\",\"core::fmt\"]Ba[6,\"core::result\",\"core::result\"]Be[8,\"std::io::error\",\"std::io::error\"]Ai[8,\"n0_error\",\"n0_error\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Cg[5,\"iroh_dns_server::server\",\"iroh_dns_server::server\"]?Ad[2,\"iroh::endpoint\"]Cd[6,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map\"]Ak[10,\"futures_core::stream\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Bc[5,\"alloc::string\",\"alloc::string\"]Bl[10,\"iroh_base::ticket\",\"iroh_base::ticket\"]Ak[5,\"core::any\",\"core::any\"]Ci[5,\"iroh_quinn_proto::varint\",\"iroh_quinn_proto::varint\"]Ad[5,\"iroh::endpoint\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]Bd[15,\"iroh_base::ticket::ParseError\"]A`[2,\"iroh_relay\"]Ah[2,\"iroh_relay::protos\"]Af[2,\"iroh_quinn_proto\"]Ae[2,\"iroh_dns_server\"]1Af[2,\"iroh::net_report\"]4041o[2,\"iroh_base\"]3Ae[10,\"iroh::endpoint\"]Bg[8,\"iroh_relay::dns\",\"iroh_relay::dns\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Co[5,\"iroh::discovery::pkarr::dht\",\"iroh::discovery::pkarr::dht\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]De[5,\"clap_builder::builder::command\",\"clap_builder::builder::command\"]Bc[15,\"iroh::endpoint::ConnectError\"]An[15,\"iroh_relay::quic::Error\"]Bi[5,\"core::task::wake\",\"core::task::wake\"]Cc[5,\"iroh_metrics::metrics\",\"iroh_metrics::metrics\"]Ad[10,\"core::default\"]A`[10,\"core::fmt\"]Bm[5,\"tokio::time::error\",\"tokio::time::error\"]Bl[15,\"iroh::discovery::mdns::DiscoveryEvent\"]Bc[10,\"axum_core::extract::from_ref\"]Ah[10,\"core::str::traits\"]Co[5,\"std::collections::hash::map\",\"std::collections::hash::map\"]Ak[5,\"std::time\",\"std::time\"]Cg[5,\"tonic::service::layered\",\"tonic::service::layered\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Cb[5,\"iroh::net_report\",\"iroh::net_report::metrics\"]Ci[5,\"iroh_dns_server::metrics\",\"iroh_dns_server::metrics\"]Cf[5,\"iroh_relay::server\",\"iroh_relay::server::metrics\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Ad[5,\"iroh::endpoint\"]Cg[5,\"iroh::net_report\",\"iroh::net_report::options::imp\"]Ak[5,\"std::path\",\"std::path\"]Bk[5,\"dyn_clone::sealed\",\"dyn_clone::sealed\"]Bo[5,\"tokio::io::read_buf\",\"tokio::io::read_buf\"]Be[5,\"tonic::request\",\"tonic::request\"]Eg[5,\"hickory_server::server::request_handler\",\"hickory_server::server::request_handler\"]B`[15,\"iroh_relay::dns::DnsError\"]Al[10,\"reqwest::dns::resolve\"]Cg[5,\"tokio::runtime::runtime\",\"tokio::runtime::runtime\"]Cj[10,\"iroh_quinn_proto::crypto\",\"iroh_quinn_proto::crypto\"]Bd[15,\"iroh_relay::client::DialError\"]4Ad[10,\"alloc::borrow\"]Ad[10,\"core::convert\"]0Bg[15,\"iroh_relay::client::ConnectError\"]k[10,\"iroh\"]?j[2,\"iroh\"]Af[2,\"iroh::net_report\"]Ah[2,\"iroh_relay::server\"]Ae[2,\"iroh_dns_server\"]f[1,\"\"]Ad[2,\"iroh::endpoint\"]Ad[2,\"iroh::defaults\"]Bb[2,\"iroh_quinn_proto::connection\"]5Ad[5,\"iroh::endpoint\"]Bc[5,\"n0_error::any\",\"n0_error::any\"]Ce[5,\"iroh_dns_server::state\",\"iroh_dns_server::state\"]De[5,\"alloc::collections::btree::set\",\"alloc::collections::btree::set\"]Ch[6,\"iroh_dns_server::http\",\"iroh_dns_server::http::tls\"]Am[6,\"iroh_bench\",\"iroh_bench\"]Ag[10,\"core::ops::deref\"]Bm[15,\"iroh::endpoint::GetMappingAddressError\"]Ae[2,\"iroh_relay::dns\"]Bg[6,\"iroh_relay::dns\",\"iroh_relay::dns\"]Am[5,\"core::time\",\"core::time\"]A`[10,\"dyn_clone\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]Bd[15,\"iroh_base::ticket::ParseError\"]Ca[5,\"iroh_quinn::endpoint\",\"iroh_quinn::endpoint\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Bg[6,\"n0_error::error\",\"n0_error::error\"]4Ca[5,\"iroh_quinn::incoming\",\"iroh_quinn::incoming\"]2Bm[5,\"core::net::ip_addr\",\"core::net::ip_addr\"]0Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Am[10,\"iroh_metrics::iterable\"]Db[10,\"core::iter::traits::iterator\",\"core::iter::traits::iterator\"]An[10,\"tonic::service::layered\"]Am[15,\"iroh::endpoint::Source\"]An[10,\"n0_watcher\",\"n0_watcher\"]Ak[6,\"core::cmp\",\"core::cmp\"]Ad[5,\"iroh::endpoint\"]Bm[5,\"http::header::name\",\"http::header::name\"]Cc[5,\"iroh_dns_server::http\",\"iroh_dns_server::http\"]0B`[10,\"core::future::into_future\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Bd[15,\"iroh_relay::client::DialError\"]B`[15,\"iroh::endpoint::BindError\"]Bm[5,\"iroh_metrics::base\",\"iroh_metrics::base\"]B`[15,\"iroh_relay::dns::DnsError\"]Bm[8,\"core::num::nonzero\",\"core::num::nonzero\"]Bb[15,\"iroh::protocol::AcceptError\"]Bk[15,\"iroh::endpoint::AddEndpointAddrError\"]Ae[2,\"iroh::discovery\"]Ag[2,\"iroh_base::ticket\"]Ao[6,\"url::parser\",\"url::parser\"]Bc[15,\"iroh_relay::dns::LookupError\"]Ao[2,\"iroh_relay::endpoint_info\"]Ae[6,\"iroh::discovery\"]Bk[6,\"iroh_base::ticket\",\"iroh_base::ticket\"]Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]A`[10,\"core::cmp\"]Al[2,\"iroh::discovery::pkarr\"]Ce[6,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Bi[5,\"iroh_relay::quic\",\"iroh_relay::quic\"]Cd[5,\"iroh::net_report\",\"iroh::net_report::reportgen\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]De[6,\"hickory_proto::rr::record_type\",\"hickory_proto::rr::record_type\"]Ad[5,\"iroh::endpoint\"]Ad[6,\"iroh::endpoint\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]22Bh[10,\"serde_core::ser\",\"serde_core::ser\"]Ce[6,\"core::net::socket_addr\",\"core::net::socket_addr\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Af[10,\"n0_error::error\"]Ba[5,\"http::status\",\"http::status\"]Ak[10,\"clap_builder::derive\"]Cj[10,\"iroh_quinn_proto::config\",\"iroh_quinn_proto::config\"]9Af[2,\"iroh_quinn_proto\"]0A`[2,\"iroh_quinn\"]f[3,\"\"]00j[2,\"iroh\"]0Ad[2,\"iroh::protocol\"]Be[6,\"iroh::protocol\",\"iroh::protocol\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Co[5,\"rustls::server::server_conn\",\"rustls::server::server_conn\"]Am[5,\"iroh_bench\",\"iroh_bench\"]Ad[5,\"iroh::endpoint\"]Bc[5,\"data_encoding\",\"data_encoding\"]Ae[10,\"serde_core::de\"]Bg[6,\"iroh_relay::dns\",\"iroh_relay::dns\"]o[5,\"iroh::dns\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Bd[15,\"iroh_relay::client::SendError\"]Bk[15,\"iroh::endpoint::AddEndpointAddrError\"]Bo[5,\"http::header::value\",\"http::header::value\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]0Cc[5,\"iroh_dns_server::http\",\"iroh_dns_server::http\"]Do[5,\"iroh_quinn_proto::config::transport\",\"iroh_quinn_proto::config::transport\"]Ae[10,\"tonic::request\"]Be[15,\"iroh_relay::server::CertConfig\"]Ae[2,\"iroh_relay::dns\"];B`[15,\"iroh_relay::dns::DnsError\"]Bg[15,\"iroh_relay::client::ConnectError\"]Be[15,\"iroh_relay::server::SpawnError\"]Bk[5,\"iroh_relay\",\"iroh_relay::ping_tracker\"]j[5,\"iroh\"]Bh[5,\"iroh_relay\",\"iroh_relay::relay_map\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]6Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Bd[15,\"iroh_relay::client::RecvError\"]Bd[15,\"iroh_relay::client::SendError\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]B`[15,\"iroh::endpoint::AlpnError\"]Ci[5,\"ring::error::unspecified\",\"ring::error::unspecified\"]A`[2,\"iroh_quinn\"]0Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Ce[5,\"rustls::crypto::signer\",\"rustls::crypto::signer\"]Co[5,\"rustls::client::client_conn\",\"rustls::client::client_conn\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ad[5,\"iroh::endpoint\"]Ad[2,\"iroh::endpoint\"]Ah[2,\"iroh_relay::client\"]Cm[6,\"iroh_quinn_proto::endpoint\",\"iroh_quinn_proto::endpoint\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Bm[6,\"iroh_relay::client\",\"iroh_relay::client\"]Ci[5,\"iroh_quinn_proto::shared\",\"iroh_quinn_proto::shared\"]Bf[10,\"serde_core::de\",\"serde_core::de\"]Co[5,\"iroh::discovery::pkarr::dht\",\"iroh::discovery::pkarr::dht\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Ca[5,\"iroh::discovery::dns\",\"iroh::discovery::dns\"]Ci[5,\"iroh_base::endpoint_addr\",\"iroh_base::endpoint_addr\"]j[5,\"iroh\"]Bj[5,\"iroh_base\",\"iroh_base::endpoint_addr\"]Ae[5,\"iroh::discovery\"]Ck[5,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]10Bb[10,\"core::iter::traits::collect\"]Am[10,\"iroh_metrics::iterable\"]D`[10,\"core::iter::traits::collect\",\"core::iter::traits::collect\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Cg[5,\"iroh_quinn_proto::frame\",\"iroh_quinn_proto::frame\"]Bc[15,\"iroh_relay::dns::LookupError\"]Ai[10,\"iroh_metrics::base\"]Bd[15,\"iroh_relay::client::DialError\"]Ad[5,\"iroh::endpoint\"]Ac[5,\"iroh::metrics\"]Cf[5,\"iroh_relay::server\",\"iroh_relay::server::metrics\"]Cg[5,\"hickory_resolver::error\",\"hickory_resolver::error\"]Do[5,\"iroh_quinn_proto::connection::paths\",\"iroh_quinn_proto::connection::paths\"]Co[5,\"rustls::server::server_conn\",\"rustls::server::server_conn\"]5Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Ca[5,\"pkarr::signed_packet\",\"pkarr::signed_packet\"]Ce[5,\"core::net::socket_addr\",\"core::net::socket_addr\"]0Ad[6,\"iroh::endpoint\"]Ae[2,\"iroh::magicsock\"]A`[2,\"iroh_relay\"]l[10,\"snafu\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ab[10,\"core::clone\"]Bb[15,\"iroh::discovery::ParseError\"]Ai[2,\"iroh::endpoint_info\"]Ao[2,\"iroh_relay::endpoint_info\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ai[6,\"iroh::endpoint_info\"]Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Bg[5,\"iroh::discovery\",\"iroh::discovery\"]5421Aj[10,\"iroh::endpoint_info\"]Cl[10,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Bh[10,\"iroh::discovery\",\"iroh::discovery\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Cc[5,\"iroh::discovery::mdns\",\"iroh::discovery::mdns\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Bi[6,\"rustls_pki_types\",\"rustls_pki_types\"]Eo[6,\"iroh_quinn_proto::connection::streams::recv\",\"iroh_quinn_proto::connection::streams::recv\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Ca[15,\"iroh_relay::protos::common::FrameTypeError\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Ci[5,\"iroh_quinn_proto::coding\",\"iroh_quinn_proto::coding\"]o[2,\"iroh_base\"]j[2,\"iroh\"]A`[2,\"iroh_relay\"]Ak[2,\"iroh_dns_server::http\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Bi[5,\"rustls_pki_types\",\"rustls_pki_types\"]Ak[10,\"clap_builder::derive\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Dd[6,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map::endpoint_state\"]Dd[5,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map::endpoint_state\"]Bf[6,\"iroh::endpoint\",\"iroh::magicsock\"]Ae[2,\"iroh::discovery\"]Bg[6,\"iroh::discovery\",\"iroh::discovery\"]Ak[2,\"iroh::discovery::mdns\"]Cc[6,\"iroh::discovery::mdns\",\"iroh::discovery::mdns\"]Bm[15,\"iroh::endpoint::GetMappingAddressError\"]D`[5,\"iroh::test_utils\",\"iroh::test_utils::dns_and_pkarr_servers\"]Co[5,\"iroh_base::ticket::endpoint\",\"iroh_base::ticket::endpoint\"]Ce[5,\"iroh_base::ticket\",\"iroh_base::ticket::endpoint\"]B`[2,\"iroh_relay::protos::common\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Cm[6,\"iroh_relay::protos::common\",\"iroh_relay::protos::common\"]Ak[10,\"clap_builder::derive\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Ac[5,\"iroh::metrics\"]Ao[6,\"pkarr::keys\",\"pkarr::keys\"]Ad[6,\"iroh::endpoint\"]0Ca[5,\"iroh::net_report\",\"iroh::net_report::report\"]Bn[10,\"hickory_server::server::request_handler\"]Cc[8,\"ed25519_dalek::errors\",\"ed25519_dalek::errors\"]j[5,\"iroh\"]B`[5,\"iroh_base\",\"iroh_base::key\"]Da[6,\"simple_dns::simple_dns_error\",\"simple_dns::simple_dns_error\"]Di[5,\"iroh::discovery::static_provider\",\"iroh::discovery::static_provider\"]Be[15,\"iroh_relay::server::SpawnError\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]Ad[5,\"iroh::endpoint\"]Bc[2,\"iroh::magicsock::endpoint_map\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]44Cg[6,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]4B`[15,\"iroh::endpoint::AlpnError\"]Da[6,\"iroh_quinn_proto::connection\",\"iroh_quinn_proto::connection\"]Ad[6,\"iroh::endpoint\"]7Bc[5,\"iroh::metrics\",\"iroh::metrics\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]Bg[15,\"iroh_relay::client::ConnectError\"]B`[15,\"iroh_relay::dns::DnsError\"]Bi[15,\"iroh::endpoint_info::EncodingError\"]Bo[15,\"iroh_relay::endpoint_info::EncodingError\"]j[2,\"iroh\"]o[2,\"iroh_base\"]Be[6,\"iroh_base::key\",\"iroh_base::key\"]j[6,\"iroh\"]B`[6,\"iroh_base\",\"iroh_base::key\"]Eo[5,\"hickory_server::authority::message_response\",\"hickory_server::authority::message_response\"]Ai[10,\"iroh_metrics::base\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Bf[10,\"iroh::protocol\",\"iroh::protocol\"]Bd[15,\"iroh_relay::client::DialError\"]Db[6,\"iroh_dns_server::http\",\"iroh_dns_server::http::rate_limiting\"]Bh[5,\"iroh_relay\",\"iroh_relay::relay_map\"]Bo[10,\"hickory_server::server::response_handler\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Do[5,\"iroh_quinn_proto::config::transport\",\"iroh_quinn_proto::config::transport\"]Ad[5,\"iroh::endpoint\"]Bm[5,\"alloc::collections\",\"alloc::collections\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]f[3,\"\"]Ae[2,\"iroh::discovery\"]5Bi[5,\"iroh::test_utils\",\"iroh::test_utils\"]Ao[2,\"iroh_relay::protos::relay\"]Ck[6,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Am[6,\"iroh_bench\",\"iroh_bench\"]77Ac[5,\"iroh::metrics\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]43Bk[15,\"iroh_relay::protos::handshake::Error\"]Ai[10,\"iri_string::format\"]o[10,\"num_enum\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ca[15,\"iroh_relay::protos::common::FrameTypeError\"]B`[15,\"iroh::endpoint::AlpnError\"]>Dg[5,\"tokio_util::task::abort_on_drop\",\"tokio_util::task::abort_on_drop\"]Ae[10,\"iroh::endpoint\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]1Bd[15,\"iroh_relay::client::DialError\"]Cg[5,\"iroh_relay::server\",\"iroh_relay::server::resolver\"]Ad[6,\"iroh::endpoint\"]Ad[5,\"iroh::endpoint\"]Am[6,\"iroh_bench\",\"iroh_bench\"]6Bf[10,\"iroh::protocol\",\"iroh::protocol\"]Ae[2,\"iroh::discovery\"]Bg[6,\"iroh::discovery\",\"iroh::discovery\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Bo[5,\"http::header::value\",\"http::header::value\"]7j[5,\"iroh\"]Bf[5,\"iroh_base\",\"iroh_base::relay_url\"]Bb[10,\"rustls::server::server_conn\"]::Bg[5,\"iroh::discovery\",\"iroh::discovery\"]Al[15,\"iroh::KeyParsingError\"]Ba[15,\"iroh_base::KeyParsingError\"]Ca[5,\"iroh::discovery::dns\",\"iroh::discovery::dns\"]Bg[15,\"iroh_relay::client::ConnectError\"]Bf[15,\"iroh::discovery::DiscoveryError\"]Ee[5,\"iroh_quinn_proto::transport_parameters\",\"iroh_quinn_proto::transport_parameters\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Ad[2,\"iroh::endpoint\"]Bf[6,\"iroh::endpoint\",\"iroh::magicsock\"]1Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]3Bd[15,\"iroh_relay::client::SendError\"]Bi[15,\"iroh::endpoint_info::EncodingError\"]Bo[15,\"iroh_relay::endpoint_info::EncodingError\"]9Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Cc[5,\"iroh::discovery::mdns\",\"iroh::discovery::mdns\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Ci[5,\"iroh_quinn_proto::varint\",\"iroh_quinn_proto::varint\"]Ad[5,\"iroh::endpoint\"]2Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Ai[5,\"num_enum\",\"num_enum\"]Ci[5,\"iroh_quinn_proto::config\",\"iroh_quinn_proto::config\"]Af[2,\"iroh::test_utils\"]>Af[10,\"core::ops::drop\"]Ad[10,\"core::convert\"]Aa[10,\"core::hash\"]1g[17,\"\"]Ci[5,\"iroh_quinn_proto::crypto\",\"iroh_quinn_proto::crypto\"]Bd[15,\"iroh_base::ticket::ParseError\"]Be[5,\"n0_error::meta\",\"n0_error::meta\"]Cc[5,\"reqwest::dns::resolve\",\"reqwest::dns::resolve\"]Dg[5,\"hickory_proto::rr::domain::name\",\"hickory_proto::rr::domain::name\"]Ak[5,\"std::path\",\"std::path\"]Bi[6,\"core::task::poll\",\"core::task::poll\"]Bb[10,\"core::marker\",\"core::marker\"]Bi[6,\"iroh_quinn_proto\",\"iroh_quinn_proto\"]Ac[10,\"futures_sink\"]2Bf[15,\"iroh::discovery::DiscoveryError\"]Bj[15,\"iroh::discovery::IntoDiscoveryError\"]Bb[15,\"iroh::protocol::AcceptError\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ah[10,\"ppv_lite86::types\"]f[1,\"\"]f[3,\"\"]Ah[2,\"iroh_relay::client\"]A`[2,\"iroh_relay\"]Ae[2,\"iroh_dns_server\"]A`[2,\"iroh_bench\"]4Ae[2,\"iroh::discovery\"]Ad[2,\"iroh::defaults\"]4Bk[2,\"iroh_quinn_proto::connection::streams\"]88Ad[10,\"core::convert\"]Ca[8,\"futures_lite::future\",\"futures_lite::future\"]Ca[8,\"futures_lite::stream\",\"futures_lite::stream\"]Ba[5,\"bytes::bytes\",\"bytes::bytes\"]Ad[5,\"iroh::endpoint\"]Ab[10,\"core::clone\"]Cg[6,\"iroh_quinn_proto::frame\",\"iroh_quinn_proto::frame\"]Ao[10,\"iroh_quinn_proto::coding\"]A`[10,\"core::fmt\"]Ag[10,\"core::ops::deref\"]Bk[15,\"iroh::endpoint::AddEndpointAddrError\"]Ak[5,\"core::fmt\",\"core::fmt\"]Ab[10,\"core::error\"]Be[5,\"std::io::error\",\"std::io::error\"]Bc[6,\"rustls::error\",\"rustls::error\"]Ba[8,\"clap_builder\",\"clap_builder\"]Bi[5,\"signature::error\",\"signature::error\"]Bg[6,\"postcard::error\",\"postcard::error\"]Af[2,\"iroh_relay::quic\"]Bc[2,\"iroh_relay::protos::handshake\"]Ao[2,\"iroh_relay::protos::relay\"]Ba[5,\"hyper::error\",\"hyper::error\"]Ee[6,\"iroh_quinn_proto::transport_parameters\",\"iroh_quinn_proto::transport_parameters\"]Be[5,\"reqwest::error\",\"reqwest::error\"]Cg[6,\"tokio_websockets::error\",\"tokio_websockets::error\"]Bi[6,\"iroh_relay::quic\",\"iroh_relay::quic\"]Dc[6,\"iroh_relay::protos::handshake\",\"iroh_relay::protos::handshake\"]Ck[6,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Ca[6,\"iroh::net_report\",\"iroh::net_report::probes\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Bb[10,\"core::marker\",\"core::marker\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]1g[17,\"\"]f[1,\"\"]Ah[2,\"iroh_relay::protos\"]Af[2,\"iroh_quinn_proto\"]Ae[2,\"iroh::discovery\"]A`[2,\"iroh_bench\"]34Ae[2,\"iroh_dns_server\"]1Bb[2,\"iroh_quinn_proto::connection\"]166Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Ac[10,\"core::borrow\"]C`[10,\"bytes::buf::buf_mut\",\"bytes::buf::buf_mut\"]Bc[5,\"pkarr::client\",\"pkarr::client\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ba[5,\"async_compat\",\"async_compat\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Al[15,\"iroh::KeyParsingError\"]Ba[15,\"iroh_base::KeyParsingError\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Cb[10,\"core::future::future\",\"core::future::future\"]Ca[5,\"iroh_dns_server::dns\",\"iroh_dns_server::dns\"]An[10,\"core::hash\",\"core::hash\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]Bm[6,\"core::net::ip_addr\",\"core::net::ip_addr\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Bh[10,\"reloadable_core\",\"reloadable_core\"]Be[15,\"iroh_relay::server::CertConfig\"]Ad[5,\"iroh::endpoint\"]Ba[6,\"core::option\",\"core::option\"]g[17,\"\"]E`[10,\"tower_http::follow_redirect::policy\",\"tower_http::follow_redirect::policy\"]Ch[10,\"iroh::endpoint::presets\",\"iroh::endpoint::presets\"]Co[5,\"hickory_proto::rr::resource\",\"hickory_proto::rr::resource\"]Ca[5,\"iroh::net_report\",\"iroh::net_report::report\"]Ak[8,\"core::fmt\",\"core::fmt\"]Ba[6,\"core::result\",\"core::result\"]Be[8,\"std::io::error\",\"std::io::error\"]Bg[8,\"n0_snafu::error\",\"n0_snafu::error\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Cg[5,\"iroh_dns_server::server\",\"iroh_dns_server::server\"]?Ad[2,\"iroh::endpoint\"]Cd[6,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map\"]Ak[10,\"futures_core::stream\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Bc[5,\"alloc::string\",\"alloc::string\"]Bl[10,\"iroh_base::ticket\",\"iroh_base::ticket\"]Ak[5,\"core::any\",\"core::any\"]Ci[5,\"iroh_quinn_proto::varint\",\"iroh_quinn_proto::varint\"]Ad[5,\"iroh::endpoint\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]Bd[15,\"iroh_base::ticket::ParseError\"]A`[2,\"iroh_relay\"]Ah[2,\"iroh_relay::protos\"]Af[2,\"iroh_quinn_proto\"]Ae[2,\"iroh_dns_server\"]1Af[2,\"iroh::net_report\"]4041o[2,\"iroh_base\"]3Ae[10,\"iroh::endpoint\"]Bg[8,\"iroh_relay::dns\",\"iroh_relay::dns\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Co[5,\"iroh::discovery::pkarr::dht\",\"iroh::discovery::pkarr::dht\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]De[5,\"clap_builder::builder::command\",\"clap_builder::builder::command\"]Bc[15,\"iroh::endpoint::ConnectError\"]An[15,\"iroh_relay::quic::Error\"]Bi[5,\"core::task::wake\",\"core::task::wake\"]Cc[5,\"iroh_metrics::metrics\",\"iroh_metrics::metrics\"]Ad[10,\"core::default\"]A`[10,\"core::fmt\"]Bm[5,\"tokio::time::error\",\"tokio::time::error\"]Bl[15,\"iroh::discovery::mdns::DiscoveryEvent\"]Bc[10,\"axum_core::extract::from_ref\"]Ah[10,\"core::str::traits\"]Co[5,\"std::collections::hash::map\",\"std::collections::hash::map\"]Ak[5,\"std::time\",\"std::time\"]Cg[5,\"tonic::service::layered\",\"tonic::service::layered\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Cb[5,\"iroh::net_report\",\"iroh::net_report::metrics\"]Ci[5,\"iroh_dns_server::metrics\",\"iroh_dns_server::metrics\"]Cf[5,\"iroh_relay::server\",\"iroh_relay::server::metrics\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Ad[5,\"iroh::endpoint\"]Cg[5,\"iroh::net_report\",\"iroh::net_report::options::imp\"]Ak[5,\"std::path\",\"std::path\"]Bk[5,\"dyn_clone::sealed\",\"dyn_clone::sealed\"]Bo[5,\"tokio::io::read_buf\",\"tokio::io::read_buf\"]Be[5,\"tonic::request\",\"tonic::request\"]Eg[5,\"hickory_server::server::request_handler\",\"hickory_server::server::request_handler\"]B`[15,\"iroh_relay::dns::DnsError\"]Al[10,\"reqwest::dns::resolve\"]Cg[5,\"tokio::runtime::runtime\",\"tokio::runtime::runtime\"]Cj[10,\"iroh_quinn_proto::crypto\",\"iroh_quinn_proto::crypto\"]Bd[15,\"iroh_relay::client::DialError\"]4Ad[10,\"alloc::borrow\"]Ad[10,\"core::convert\"]0Bg[15,\"iroh_relay::client::ConnectError\"]k[10,\"iroh\"]?j[2,\"iroh\"]Af[2,\"iroh::net_report\"]Ah[2,\"iroh_relay::server\"]Ae[2,\"iroh_dns_server\"]f[1,\"\"]Ad[2,\"iroh::endpoint\"]Ad[2,\"iroh::defaults\"]Bb[2,\"iroh_quinn_proto::connection\"]5Ad[5,\"iroh::endpoint\"]Bc[5,\"n0_error::any\",\"n0_error::any\"]Ce[5,\"iroh_dns_server::state\",\"iroh_dns_server::state\"]De[5,\"alloc::collections::btree::set\",\"alloc::collections::btree::set\"]Ch[6,\"iroh_dns_server::http\",\"iroh_dns_server::http::tls\"]Am[6,\"iroh_bench\",\"iroh_bench\"]Ag[10,\"core::ops::deref\"]Bm[15,\"iroh::endpoint::GetMappingAddressError\"]Ae[2,\"iroh_relay::dns\"]Bg[6,\"iroh_relay::dns\",\"iroh_relay::dns\"]Am[5,\"core::time\",\"core::time\"]A`[10,\"dyn_clone\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]Bd[15,\"iroh_base::ticket::ParseError\"]Ca[5,\"iroh_quinn::endpoint\",\"iroh_quinn::endpoint\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Bg[6,\"n0_error::error\",\"n0_error::error\"]4Ca[5,\"iroh_quinn::incoming\",\"iroh_quinn::incoming\"]2Bm[5,\"core::net::ip_addr\",\"core::net::ip_addr\"]0Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Am[10,\"iroh_metrics::iterable\"]Db[10,\"core::iter::traits::iterator\",\"core::iter::traits::iterator\"]An[10,\"tonic::service::layered\"]Am[15,\"iroh::endpoint::Source\"]An[10,\"n0_watcher\",\"n0_watcher\"]Ak[6,\"core::cmp\",\"core::cmp\"]Ad[5,\"iroh::endpoint\"]Bm[5,\"http::header::name\",\"http::header::name\"]Cc[5,\"iroh_dns_server::http\",\"iroh_dns_server::http\"]0B`[10,\"core::future::into_future\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Bd[15,\"iroh_relay::client::DialError\"]B`[15,\"iroh::endpoint::BindError\"]Bm[5,\"iroh_metrics::base\",\"iroh_metrics::base\"]B`[15,\"iroh_relay::dns::DnsError\"]Bm[8,\"core::num::nonzero\",\"core::num::nonzero\"]Bb[15,\"iroh::protocol::AcceptError\"]Bk[15,\"iroh::endpoint::AddEndpointAddrError\"]Ae[2,\"iroh::discovery\"]Ag[2,\"iroh_base::ticket\"]Ao[6,\"url::parser\",\"url::parser\"]Bc[15,\"iroh_relay::dns::LookupError\"]Ao[2,\"iroh_relay::endpoint_info\"]Ae[6,\"iroh::discovery\"]Bk[6,\"iroh_base::ticket\",\"iroh_base::ticket\"]Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]A`[10,\"core::cmp\"]Al[2,\"iroh::discovery::pkarr\"]Ce[6,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Bi[5,\"iroh_relay::quic\",\"iroh_relay::quic\"]Cd[5,\"iroh::net_report\",\"iroh::net_report::reportgen\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]De[6,\"hickory_proto::rr::record_type\",\"hickory_proto::rr::record_type\"]Ad[5,\"iroh::endpoint\"]Ad[6,\"iroh::endpoint\"]Cb[15,\"iroh_relay::protos::relay::RelayToClientMsg\"]22Bh[10,\"serde_core::ser\",\"serde_core::ser\"]Ce[6,\"core::net::socket_addr\",\"core::net::socket_addr\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Af[10,\"n0_error::error\"]Ba[5,\"http::status\",\"http::status\"]Ak[10,\"clap_builder::derive\"]Cj[10,\"iroh_quinn_proto::config\",\"iroh_quinn_proto::config\"]9Af[2,\"iroh_quinn_proto\"]0A`[2,\"iroh_quinn\"]f[3,\"\"]00j[2,\"iroh\"]0Ad[2,\"iroh::protocol\"]Be[6,\"iroh::protocol\",\"iroh::protocol\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Co[5,\"rustls::server::server_conn\",\"rustls::server::server_conn\"]Am[5,\"iroh_bench\",\"iroh_bench\"]Ad[5,\"iroh::endpoint\"]Bc[5,\"data_encoding\",\"data_encoding\"]Ae[10,\"serde_core::de\"]Bg[6,\"iroh_relay::dns\",\"iroh_relay::dns\"]o[5,\"iroh::dns\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Bd[15,\"iroh_relay::client::SendError\"]Bk[15,\"iroh::endpoint::AddEndpointAddrError\"]Bo[5,\"http::header::value\",\"http::header::value\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]0Cc[5,\"iroh_dns_server::http\",\"iroh_dns_server::http\"]Do[5,\"iroh_quinn_proto::config::transport\",\"iroh_quinn_proto::config::transport\"]Ae[10,\"tonic::request\"]Be[15,\"iroh_relay::server::CertConfig\"]Ae[2,\"iroh_relay::dns\"];B`[15,\"iroh_relay::dns::DnsError\"]Bg[15,\"iroh_relay::client::ConnectError\"]Be[15,\"iroh_relay::server::SpawnError\"]Bk[5,\"iroh_relay\",\"iroh_relay::ping_tracker\"]j[5,\"iroh\"]Bh[5,\"iroh_relay\",\"iroh_relay::relay_map\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]6Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Bd[15,\"iroh_relay::client::RecvError\"]Bd[15,\"iroh_relay::client::SendError\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]B`[15,\"iroh::endpoint::AlpnError\"]Ci[5,\"ring::error::unspecified\",\"ring::error::unspecified\"]A`[2,\"iroh_quinn\"]0Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Ce[5,\"rustls::crypto::signer\",\"rustls::crypto::signer\"]Co[5,\"rustls::client::client_conn\",\"rustls::client::client_conn\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ad[5,\"iroh::endpoint\"]Ad[2,\"iroh::endpoint\"]Ah[2,\"iroh_relay::client\"]Cm[6,\"iroh_quinn_proto::endpoint\",\"iroh_quinn_proto::endpoint\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Bm[6,\"iroh_relay::client\",\"iroh_relay::client\"]Ci[5,\"iroh_quinn_proto::shared\",\"iroh_quinn_proto::shared\"]Bf[10,\"serde_core::de\",\"serde_core::de\"]Co[5,\"iroh::discovery::pkarr::dht\",\"iroh::discovery::pkarr::dht\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Ca[5,\"iroh::discovery::dns\",\"iroh::discovery::dns\"]Ci[5,\"iroh_base::endpoint_addr\",\"iroh_base::endpoint_addr\"]j[5,\"iroh\"]Bj[5,\"iroh_base\",\"iroh_base::endpoint_addr\"]Ae[5,\"iroh::discovery\"]Ck[5,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]10Bb[10,\"core::iter::traits::collect\"]Am[10,\"iroh_metrics::iterable\"]D`[10,\"core::iter::traits::collect\",\"core::iter::traits::collect\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Cg[5,\"iroh_quinn_proto::frame\",\"iroh_quinn_proto::frame\"]Bc[15,\"iroh_relay::dns::LookupError\"]Ai[10,\"iroh_metrics::base\"]Bd[15,\"iroh_relay::client::DialError\"]Ad[5,\"iroh::endpoint\"]Ac[5,\"iroh::metrics\"]Cf[5,\"iroh_relay::server\",\"iroh_relay::server::metrics\"]Cg[5,\"hickory_resolver::error\",\"hickory_resolver::error\"]Do[5,\"iroh_quinn_proto::connection::paths\",\"iroh_quinn_proto::connection::paths\"]Co[5,\"rustls::server::server_conn\",\"rustls::server::server_conn\"]5Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]Ca[5,\"pkarr::signed_packet\",\"pkarr::signed_packet\"]Ce[5,\"core::net::socket_addr\",\"core::net::socket_addr\"]0Ad[6,\"iroh::endpoint\"]Ae[2,\"iroh::magicsock\"]A`[2,\"iroh_relay\"]l[10,\"snafu\"]Bm[5,\"iroh_relay::client\",\"iroh_relay::client\"]Ab[10,\"core::clone\"]Bb[15,\"iroh::discovery::ParseError\"]Ai[2,\"iroh::endpoint_info\"]Ao[2,\"iroh_relay::endpoint_info\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ai[6,\"iroh::endpoint_info\"]Ck[6,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Bg[5,\"iroh::discovery\",\"iroh::discovery\"]5421Aj[10,\"iroh::endpoint_info\"]Cl[10,\"iroh_relay::endpoint_info\",\"iroh_relay::endpoint_info\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Bh[10,\"iroh::discovery\",\"iroh::discovery\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Cc[5,\"iroh::discovery::mdns\",\"iroh::discovery::mdns\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Bi[6,\"rustls_pki_types\",\"rustls_pki_types\"]Eo[6,\"iroh_quinn_proto::connection::streams::recv\",\"iroh_quinn_proto::connection::streams::recv\"]Be[5,\"iroh::protocol\",\"iroh::protocol\"]Bj[15,\"iroh_relay::server::SupervisorError\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Ca[15,\"iroh_relay::protos::common::FrameTypeError\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Ci[5,\"iroh_quinn_proto::coding\",\"iroh_quinn_proto::coding\"]o[2,\"iroh_base\"]j[2,\"iroh\"]A`[2,\"iroh_relay\"]Ak[2,\"iroh_dns_server::http\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Bi[5,\"rustls_pki_types\",\"rustls_pki_types\"]Ak[10,\"clap_builder::derive\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Dd[6,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map::endpoint_state\"]Dd[5,\"iroh::endpoint\",\"iroh::magicsock::endpoint_map::endpoint_state\"]Bf[6,\"iroh::endpoint\",\"iroh::magicsock\"]Ae[2,\"iroh::discovery\"]Bg[6,\"iroh::discovery\",\"iroh::discovery\"]Ak[2,\"iroh::discovery::mdns\"]Cc[6,\"iroh::discovery::mdns\",\"iroh::discovery::mdns\"]Bm[15,\"iroh::endpoint::GetMappingAddressError\"]D`[5,\"iroh::test_utils\",\"iroh::test_utils::dns_and_pkarr_servers\"]Co[5,\"iroh_base::ticket::endpoint\",\"iroh_base::ticket::endpoint\"]Ce[5,\"iroh_base::ticket\",\"iroh_base::ticket::endpoint\"]B`[2,\"iroh_relay::protos::common\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Cm[6,\"iroh_relay::protos::common\",\"iroh_relay::protos::common\"]Ak[10,\"clap_builder::derive\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Am[5,\"n0_watcher\",\"n0_watcher\"]Cg[5,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Ac[5,\"iroh::metrics\"]Ao[6,\"pkarr::keys\",\"pkarr::keys\"]Ad[6,\"iroh::endpoint\"]0Ca[5,\"iroh::net_report\",\"iroh::net_report::report\"]Bn[10,\"hickory_server::server::request_handler\"]Cc[8,\"ed25519_dalek::errors\",\"ed25519_dalek::errors\"]j[5,\"iroh\"]B`[5,\"iroh_base\",\"iroh_base::key\"]Da[6,\"simple_dns::simple_dns_error\",\"simple_dns::simple_dns_error\"]Di[5,\"iroh::discovery::static_provider\",\"iroh::discovery::static_provider\"]Be[15,\"iroh_relay::server::SpawnError\"]Bk[5,\"iroh_bench::stats\",\"iroh_bench::stats\"]Ad[5,\"iroh::endpoint\"]Bc[2,\"iroh::magicsock::endpoint_map\"]Bk[15,\"iroh::endpoint::ConnectWithOptsError\"]44Cg[6,\"iroh_dns_server::config\",\"iroh_dns_server::config\"]Bm[5,\"iroh_relay::server\",\"iroh_relay::server\"]4B`[15,\"iroh::endpoint::AlpnError\"]Da[6,\"iroh_quinn_proto::connection\",\"iroh_quinn_proto::connection\"]Ad[6,\"iroh::endpoint\"]7Bc[5,\"iroh::metrics\",\"iroh::metrics\"]Bi[15,\"iroh::discovery::pkarr::PkarrError\"]Bg[15,\"iroh_relay::client::ConnectError\"]B`[15,\"iroh_relay::dns::DnsError\"]Bi[15,\"iroh::endpoint_info::EncodingError\"]Bo[15,\"iroh_relay::endpoint_info::EncodingError\"]j[2,\"iroh\"]o[2,\"iroh_base\"]Be[6,\"iroh_base::key\",\"iroh_base::key\"]j[6,\"iroh\"]B`[6,\"iroh_base\",\"iroh_base::key\"]Eo[5,\"hickory_server::authority::message_response\",\"hickory_server::authority::message_response\"]Ai[10,\"iroh_metrics::base\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Bf[10,\"iroh::protocol\",\"iroh::protocol\"]Bd[15,\"iroh_relay::client::DialError\"]Db[6,\"iroh_dns_server::http\",\"iroh_dns_server::http::rate_limiting\"]Bh[5,\"iroh_relay\",\"iroh_relay::relay_map\"]Bo[10,\"hickory_server::server::response_handler\"]Ah[2,\"iroh_relay::server\"]Bm[6,\"iroh_relay::server\",\"iroh_relay::server\"]Do[5,\"iroh_quinn_proto::config::transport\",\"iroh_quinn_proto::config::transport\"]Ad[5,\"iroh::endpoint\"]Bm[5,\"alloc::collections\",\"alloc::collections\"]Bg[15,\"iroh_relay::protos::relay::Error\"]Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]f[3,\"\"]Ae[2,\"iroh::discovery\"]5Bi[5,\"iroh::test_utils\",\"iroh::test_utils\"]Ao[2,\"iroh_relay::protos::relay\"]Ck[6,\"iroh_relay::protos::relay\",\"iroh_relay::protos::relay\"]Am[6,\"iroh_bench\",\"iroh_bench\"]77Ac[5,\"iroh::metrics\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]43Bk[15,\"iroh_relay::protos::handshake::Error\"]Ai[10,\"iri_string::format\"]o[10,\"num_enum\"]Bb[15,\"iroh::discovery::ParseError\"]Bl[15,\"iroh_relay::endpoint_info::ParseError\"]Ca[15,\"iroh_relay::protos::common::FrameTypeError\"]B`[15,\"iroh::endpoint::AlpnError\"]>Dg[5,\"tokio_util::task::abort_on_drop\",\"tokio_util::task::abort_on_drop\"]Ae[10,\"iroh::endpoint\"]Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]1Bd[15,\"iroh_relay::client::DialError\"]Cg[5,\"iroh_relay::server\",\"iroh_relay::server::resolver\"]Ad[6,\"iroh::endpoint\"]Ad[5,\"iroh::endpoint\"]Am[6,\"iroh_bench\",\"iroh_bench\"]6Bf[10,\"iroh::protocol\",\"iroh::protocol\"]Ae[2,\"iroh::discovery\"]Bg[6,\"iroh::discovery\",\"iroh::discovery\"]Bi[15,\"iroh::endpoint_info::DecodingError\"]Bo[15,\"iroh_relay::endpoint_info::DecodingError\"]Bo[5,\"http::header::value\",\"http::header::value\"]7j[5,\"iroh\"]Bf[5,\"iroh_base\",\"iroh_base::relay_url\"]Bb[10,\"rustls::server::server_conn\"]::Bg[5,\"iroh::discovery\",\"iroh::discovery\"]Al[15,\"iroh::KeyParsingError\"]Ba[15,\"iroh_base::KeyParsingError\"]Ca[5,\"iroh::discovery::dns\",\"iroh::discovery::dns\"]Bg[15,\"iroh_relay::client::ConnectError\"]Bf[15,\"iroh::discovery::DiscoveryError\"]Ee[5,\"iroh_quinn_proto::transport_parameters\",\"iroh_quinn_proto::transport_parameters\"]Bk[15,\"iroh_relay::protos::handshake::Error\"]Ad[2,\"iroh::endpoint\"]Bf[6,\"iroh::endpoint\",\"iroh::magicsock\"]1Be[6,\"iroh::endpoint\",\"iroh::endpoint\"]3Bd[15,\"iroh_relay::client::SendError\"]Bi[15,\"iroh::endpoint_info::EncodingError\"]Bo[15,\"iroh_relay::endpoint_info::EncodingError\"]9Bg[5,\"iroh_relay::dns\",\"iroh_relay::dns\"]Cc[5,\"iroh::discovery::mdns\",\"iroh::discovery::mdns\"]Ce[5,\"iroh::discovery::pkarr\",\"iroh::discovery::pkarr\"]Ci[5,\"iroh_quinn_proto::varint\",\"iroh_quinn_proto::varint\"]Ad[5,\"iroh::endpoint\"]2Be[5,\"iroh::endpoint\",\"iroh::endpoint\"]Ai[5,\"num_enum\",\"num_enum\"]Ci[5,\"iroh_quinn_proto::config\",\"iroh_quinn_proto::config\"]Af[2,\"iroh::test_utils\"]>5use iroh_bench::quinn; 6use iroh_bench::{Commands, Opt, configure_tracing_subscriber, iroh, rt, s2n}; 7use iroh_metrics::{MetricValue, MetricsGroup}; -8use n0_snafu::Result; +8use n0_error::Result; 9 10fn main() { 11 let cmd = Commands::parse(); diff --git a/pr/3561/docs/src/iroh/discovery.rs.html b/pr/3561/docs/src/iroh/discovery.rs.html index 8261964c2b..f14a765909 100644 --- a/pr/3561/docs/src/iroh/discovery.rs.html +++ b/pr/3561/docs/src/iroh/discovery.rs.html @@ -65,7 +65,7 @@ 65//! endpoint::RelayMode, 66//! }; 67//! -68//! # async fn wrapper() -> n0_snafu::Result<()> { +68//! # async fn wrapper() -> n0_error::Result<()> { 69//! let ep = Endpoint::empty_builder(RelayMode::Default) 70//! .discovery(PkarrPublisher::n0_dns()) 71//! .discovery(DnsDiscovery::n0_dns()) @@ -86,7 +86,7 @@ 86//! # Endpoint, SecretKey, 87//! # }; 88//! # -89//! # async fn wrapper() -> n0_snafu::Result<()> { +89//! # async fn wrapper() -> n0_error::Result<()> { 90//! let ep = Endpoint::empty_builder(RelayMode::Default) 91//! .discovery(PkarrPublisher::n0_dns()) 92//! .discovery(DnsDiscovery::n0_dns()) @@ -942,7 +942,7 @@ 942 // we skip accept() errors, they can be caused by retransmits 943 while let Some(connecting) = ep.accept().await.and_then(|inc| inc.accept().ok()) { 944 // Just accept incoming connections, but don't do anything with them. -945 let conn = connecting.await.context("connecting")?; +945 let conn = connecting.await.std_context("connecting")?; 946 connections.push(conn); 947 } 948 @@ -995,7 +995,7 @@ 995 let state = State::new(origin.clone()); 996 let (nameserver, _dns_drop_guard) = run_dns_server(state.clone()) 997 .await -998 .context("Running DNS server")?; +998 .std_context("Running DNS server")?; 999 1000 let secret_key = SecretKey::generate(&mut rng); 1001 let endpoint_info = EndpointInfo::new(secret_key.public()) @@ -1003,7 +1003,7 @@ 1003 let signed_packet = endpoint_info.to_pkarr_signed_packet(&secret_key, 30)?; 1004 state 1005 .upsert(signed_packet) -1006 .context("update and insert signed packet")?; +1006 .std_context("update and insert signed packet")?; 1007 1008 let resolver = DnsResolver::with_nameserver(nameserver); 1009 let resolved = resolver @@ -1023,7 +1023,7 @@ 1023 1024 let dns_pkarr_server = DnsPkarrServer::run_with_origin(origin.clone()) 1025 .await -1026 .context("DnsPkarrServer")?; +1026 .std_context("DnsPkarrServer")?; 1027 1028 let secret_key = SecretKey::generate(&mut rng); 1029 let endpoint_id = secret_key.public(); @@ -1042,7 +1042,7 @@ 1042 dns_pkarr_server 1043 .on_endpoint(&endpoint_id, PUBLISH_TIMEOUT) 1044 .await -1045 .context("wait for on endpoint update")?; +1045 .std_context("wait for on endpoint update")?; 1046 let resolved = resolver 1047 .lookup_endpoint_by_id(&endpoint_id, &origin) 1048 .await?; @@ -1066,7 +1066,7 @@ 1066 async fn pkarr_publish_dns_discover() -> Result<()> { 1067 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); 1068 -1069 let dns_pkarr_server = DnsPkarrServer::run().await.context("DnsPkarrServer run")?; +1069 let dns_pkarr_server = DnsPkarrServer::run().await.std_context("DnsPkarrServer run")?; 1070 let (relay_map, _relay_url, _relay_guard) = run_relay_server().await?; 1071 1072 let (ep1, _guard1) = ep_with_discovery(&mut rng, &relay_map, &dns_pkarr_server).await?; @@ -1076,7 +1076,7 @@ 1076 dns_pkarr_server 1077 .on_endpoint(&ep1.id(), PUBLISH_TIMEOUT) 1078 .await -1079 .context("wait for on endpoint update")?; +1079 .std_context("wait for on endpoint update")?; 1080 1081 // we connect only by endpoint id! 1082 let _conn = ep2.connect(ep1.id(), TEST_ALPN).await?; @@ -1103,7 +1103,7 @@ 1103 async move { 1104 // we skip accept() errors, they can be caused by retransmits 1105 while let Some(connecting) = ep.accept().await.and_then(|inc| inc.accept().ok()) { -1106 let _conn = connecting.await.context("connecting")?; +1106 let _conn = connecting.await.std_context("connecting")?; 1107 // Just accept incoming connections, but don't do anything with them. 1108 } 1109 diff --git a/pr/3561/docs/src/iroh/discovery/mdns.rs.html b/pr/3561/docs/src/iroh/discovery/mdns.rs.html index 99f3ca552b..1031c01241 100644 --- a/pr/3561/docs/src/iroh/discovery/mdns.rs.html +++ b/pr/3561/docs/src/iroh/discovery/mdns.rs.html @@ -591,7 +591,7 @@ 591 .. 592 } = tokio::time::timeout(Duration::from_secs(5), s1.next()) 593 .await -594 .context("timeout")? +594 .std_context("timeout")? 595 .unwrap() 596 else { 597 panic!("Received unexpected discovery event"); @@ -601,7 +601,7 @@ 601 .. 602 } = tokio::time::timeout(Duration::from_secs(5), s2.next()) 603 .await -604 .context("timeout")? +604 .std_context("timeout")? 605 .unwrap() 606 else { 607 panic!("Received unexpected discovery event"); @@ -632,7 +632,7 @@ 632 loop { 633 let event = tokio::time::timeout(Duration::from_secs(5), s1.next()) 634 .await -635 .context("timeout")? +635 .std_context("timeout")? 636 .expect("Stream should not be closed"); 637 638 match event { @@ -653,7 +653,7 @@ 653 loop { 654 let event = tokio::time::timeout(Duration::from_secs(10), s1.next()) 655 .await -656 .context("timeout waiting for expiration event")? +656 .std_context("timeout waiting for expiration event")? 657 .expect("Stream should not be closed"); 658 659 match event { @@ -717,7 +717,7 @@ 717 }; 718 tokio::time::timeout(Duration::from_secs(5), test) 719 .await -720 .context("timeout")? +720 .std_context("timeout")? 721 } 722 723 #[tokio::test] diff --git a/pr/3561/docs/src/iroh/discovery/static_provider.rs.html b/pr/3561/docs/src/iroh/discovery/static_provider.rs.html index 1c02b51a05..f453cf1bea 100644 --- a/pr/3561/docs/src/iroh/discovery/static_provider.rs.html +++ b/pr/3561/docs/src/iroh/discovery/static_provider.rs.html @@ -41,7 +41,7 @@ 41/// use iroh_base::SecretKey; 42/// 43/// # #[tokio::main] -44/// # async fn main() -> n0_snafu::Result<()> { +44/// # async fn main() -> n0_error::Result<()> { 45/// // Create the discovery service and endpoint. 46/// let discovery = StaticProvider::new(); 47/// @@ -125,8 +125,8 @@ 125 /// # fn get_addrs() -> Vec<EndpointAddr> { 126 /// # Vec::new() 127 /// # } -128 /// # #[tokio::main] -129 /// # async fn main() -> n0_snafu::Result<()> { +128/// # #[tokio::main] +129/// # async fn main() -> n0_error::Result<()> { 130 /// // get addrs from somewhere 131 /// let addrs = get_addrs(); 132 /// diff --git a/pr/3561/docs/src/iroh/endpoint.rs.html b/pr/3561/docs/src/iroh/endpoint.rs.html index 094496c6dd..17db4528bd 100644 --- a/pr/3561/docs/src/iroh/endpoint.rs.html +++ b/pr/3561/docs/src/iroh/endpoint.rs.html @@ -827,7 +827,7 @@ 827 /// The observed [`EndpointAddr`] will have the current [`RelayUrl`] and direct addresses. 828 /// 829 /// ```no_run -830 /// # async fn wrapper() -> n0_snafu::Result { +830 /// # async fn wrapper() -> n0_error::Result<()> { 831 /// use iroh::{Endpoint, Watcher}; 832 /// 833 /// let endpoint = Endpoint::builder() @@ -1022,7 +1022,7 @@ 1022 /// ```rust 1023 /// # use std::collections::BTreeMap; 1024 /// # use iroh::endpoint::Endpoint; -1025 /// # async fn wrapper() -> n0_snafu::Result { +1025 /// # async fn wrapper() -> n0_error::Result<()> { 1026 /// let endpoint = Endpoint::bind().await?; 1027 /// assert_eq!(endpoint.metrics().magicsock.recv_datagrams.get(), 0); 1028 /// # Ok(()) @@ -1040,7 +1040,7 @@ 1040 /// # use std::collections::BTreeMap; 1041 /// # use iroh_metrics::{Metric, MetricsGroup, MetricValue, MetricsGroupSet}; 1042 /// # use iroh::endpoint::Endpoint; -1043 /// # async fn wrapper() -> n0_snafu::Result { +1043 /// # async fn wrapper() -> n0_error::Result<()> { 1044 /// let endpoint = Endpoint::bind().await?; 1045 /// let metrics: BTreeMap<String, MetricValue> = endpoint 1046 /// .metrics() @@ -1063,7 +1063,7 @@ 1063 /// ```rust 1064 /// # use iroh_metrics::{Registry, MetricsSource}; 1065 /// # use iroh::endpoint::Endpoint; -1066 /// # async fn wrapper() -> n0_snafu::Result { +1066 /// # async fn wrapper() -> n0_error::Result<()> { 1067 /// let endpoint = Endpoint::bind().await?; 1068 /// let mut registry = Registry::default(); 1069 /// registry.register_all(endpoint.metrics()); @@ -1086,8 +1086,8 @@ 1086 /// # use std::{sync::{Arc, RwLock}, time::Duration}; 1087 /// # use iroh_metrics::{Registry, MetricsSource}; 1088 /// # use iroh::endpoint::Endpoint; -1089 /// # use n0_snafu::ResultExt; -1090 /// # async fn wrapper() -> n0_snafu::Result { +1089 /// # use n0_error::StackResultExt; +1090 /// # async fn wrapper() -> n0_error::Result<()> { 1091 /// // Create a registry, wrapped in a read-write lock so that we can register and serve 1092 /// // the metrics independently. 1093 /// let registry = Arc::new(RwLock::new(Registry::default())); @@ -3019,7 +3019,7 @@ 3019 let mut registry = Registry::default(); 3020 register_endpoint(&mut registry, &client); 3021 register_endpoint(&mut registry, &server); -3022 let s = registry.encode_openmetrics_to_string()?; +3022 let s = registry.encode_openmetrics_to_string().e()?; 3023 assert!(s.contains(r#"magicsock_endpoints_contacted_directly_total{id="3b6a27bcce"} 1"#)); 3024 assert!(s.contains(r#"magicsock_endpoints_contacted_directly_total{id="8a88e3dd74"} 1"#)); 3025 Ok(()) @@ -3125,7 +3125,7 @@ 3125 let endpoint = Endpoint::empty_builder(RelayMode::Staging).bind().await?; 3126 3127 // can get a first report -3128 endpoint.net_report().updated().await?; +3128 endpoint.net_report().updated().await.e()?; 3129 3130 Ok(()) 3131 } diff --git a/pr/3561/docs/src/iroh/endpoint/presets.rs.html b/pr/3561/docs/src/iroh/endpoint/presets.rs.html index 68da930d9a..309e888873 100644 --- a/pr/3561/docs/src/iroh/endpoint/presets.rs.html +++ b/pr/3561/docs/src/iroh/endpoint/presets.rs.html @@ -3,7 +3,7 @@ 3//! # Example 4//! 5//! ```no_run -6//! # async fn wrapper() -> n0_snafu::Result { +6//! # async fn wrapper() -> n0_error::Result<()> { 7//! use iroh::{Endpoint, RelayMode, Watcher, endpoint::presets}; 8//! 9//! let endpoint = Endpoint::empty_builder(RelayMode::Disabled) diff --git a/pr/3561/docs/src/iroh/lib.rs.html b/pr/3561/docs/src/iroh/lib.rs.html index e3ba119664..9024d3b01e 100644 --- a/pr/3561/docs/src/iroh/lib.rs.html +++ b/pr/3561/docs/src/iroh/lib.rs.html @@ -9,8 +9,8 @@ 9//! 10//! ```no_run 11//! # use iroh::{Endpoint, EndpointAddr}; -12//! # use n0_snafu::ResultExt; -13//! # async fn wrapper() -> n0_snafu::Result { +12//! # use n0_error::StackResultExt; +13//! # async fn wrapper() -> n0_error::Result<()> { 14//! let addr: EndpointAddr = todo!(); 15//! let ep = Endpoint::bind().await?; 16//! let conn = ep.connect(addr, b"my-alpn").await?; @@ -27,8 +27,8 @@ 27//! 28//! ```no_run 29//! # use iroh::{Endpoint, EndpointAddr}; -30//! # use n0_snafu::ResultExt; -31//! # async fn wrapper() -> n0_snafu::Result { +30//! # use n0_error::StackResultExt; +31//! # async fn wrapper() -> n0_error::Result<()> { 32//! let ep = Endpoint::builder() 33//! .alpns(vec![b"my-alpn".to_vec()]) 34//! .bind() @@ -171,7 +171,7 @@ 171//! 172//! ```no_run 173//! use iroh::{Endpoint, EndpointAddr}; -174//! use n0_snafu::{Result, ResultExt}; +174//! use n0_error::{Result, StackResultExt}; 175//! 176//! async fn connect(addr: EndpointAddr) -> Result<()> { 177//! // The Endpoint is the central object that manages an iroh node. @@ -197,7 +197,7 @@ 197//! ```no_run 198//! use iroh::{Endpoint, EndpointAddr}; 199//! use n0_future::StreamExt; -200//! use n0_snafu::{Result, ResultExt}; +200//! use n0_error::{Result, StackResultExt}; 201//! 202//! async fn accept() -> Result<()> { 203//! // To accept connections at least one ALPN must be configured. diff --git a/pr/3561/docs/src/iroh/magicsock.rs.html b/pr/3561/docs/src/iroh/magicsock.rs.html index 71524c2b45..07dc05e396 100644 --- a/pr/3561/docs/src/iroh/magicsock.rs.html +++ b/pr/3561/docs/src/iroh/magicsock.rs.html @@ -2697,7 +2697,7 @@ 2697 } 2698 }) 2699 .await -2700 .context("timeout")?; +2700 .std_context("timeout")?; 2701 info!("all endpoints meshed"); 2702 Ok(tasks) 2703 } @@ -2708,24 +2708,24 @@ 2708 let conn = ep.endpoint.accept().await.expect("no conn"); 2709 2710 info!("connecting"); -2711 let conn = conn.await.context("connecting")?; +2711 let conn = conn.await.std_context("connecting")?; 2712 info!("accepting bi"); -2713 let (mut send_bi, mut recv_bi) = conn.accept_bi().await.context("accept bi")?; +2713 let (mut send_bi, mut recv_bi) = conn.accept_bi().await.std_context("accept bi")?; 2714 2715 info!("reading"); 2716 let val = recv_bi 2717 .read_to_end(usize::MAX) 2718 .await -2719 .context("read to end")?; +2719 .std_context("read to end")?; 2720 2721 info!("replying"); 2722 for chunk in val.chunks(12) { -2723 send_bi.write_all(chunk).await.context("write all")?; +2723 send_bi.write_all(chunk).await.std_context("write all")?; 2724 } 2725 2726 info!("finishing"); -2727 send_bi.finish().context("finish")?; -2728 send_bi.stopped().await.context("stopped")?; +2727 send_bi.finish().std_context("finish")?; +2728 send_bi.stopped().await.std_context("stopped")?; 2729 2730 let stats = conn.stats(); 2731 info!("stats: {:#?}", stats); @@ -2757,20 +2757,20 @@ 2757 let conn = ep.endpoint.connect(dest, ALPN).await?; 2758 2759 info!("opening bi"); -2760 let (mut send_bi, mut recv_bi) = conn.open_bi().await.context("open bi")?; +2760 let (mut send_bi, mut recv_bi) = conn.open_bi().await.std_context("open bi")?; 2761 2762 info!("writing message"); -2763 send_bi.write_all(msg).await.context("write all")?; +2763 send_bi.write_all(msg).await.std_context("write all")?; 2764 2765 info!("finishing"); -2766 send_bi.finish().context("finish")?; -2767 send_bi.stopped().await.context("stopped")?; +2766 send_bi.finish().std_context("finish")?; +2767 send_bi.stopped().await.std_context("stopped")?; 2768 2769 info!("reading_to_end"); 2770 let val = recv_bi 2771 .read_to_end(usize::MAX) 2772 .await -2773 .context("read to end")?; +2773 .std_context("read to end")?; 2774 assert_eq!( 2775 val, 2776 msg, @@ -2921,7 +2921,7 @@ 2921 test_two_devices_roundtrip_network_change_impl(), 2922 ) 2923 .await -2924 .context("timeout")? +2924 .std_context("timeout")? 2925 } 2926 2927 /// Same structure as `test_two_devices_roundtrip_quinn_magic`, but interrupts regularly @@ -3147,7 +3147,7 @@ 3147 mapped_addr.private_socket_addr(), 3148 &tls::name::encode(endpoint_id), 3149 ) -3150 .context("connect")?; +3150 .std_context("connect")?; 3151 let connection = connect.await.e()?; 3152 Ok(connection) 3153 } @@ -3191,12 +3191,12 @@ 3191 // This needs an accept task 3192 let accept_task = tokio::spawn({ 3193 async fn accept(ep: quinn::Endpoint) -> Result<()> { -3194 let incoming = ep.accept().await.context("no incoming")?; +3194 let incoming = ep.accept().await.std_context("no incoming")?; 3195 let _conn = incoming 3196 .accept() -3197 .context("accept")? +3197 .std_context("accept")? 3198 .await -3199 .context("connecting")?; +3199 .std_context("connecting")?; 3200 3201 // Keep this connection alive for a while 3202 tokio::time::sleep(Duration::from_secs(10)).await; @@ -3268,14 +3268,14 @@ 3268 // We need a task to accept the connection. 3269 let accept_task = tokio::spawn({ 3270 async fn accept(ep: quinn::Endpoint) -> Result<()> { -3271 let incoming = ep.accept().await.context("no incoming")?; +3271 let incoming = ep.accept().await.std_context("no incoming")?; 3272 let conn = incoming 3273 .accept() -3274 .context("accept")? +3274 .std_context("accept")? 3275 .await -3276 .context("connecting")?; -3277 let mut stream = conn.accept_uni().await.context("accept uni")?; -3278 stream.read_to_end(1 << 16).await.context("read to end")?; +3276 .std_context("connecting")?; +3277 let mut stream = conn.accept_uni().await.std_context("accept uni")?; +3278 stream.read_to_end(1 << 16).await.std_context("read to end")?; 3279 info!("accept finished"); 3280 Ok(()) 3281 } diff --git a/pr/3561/docs/src/iroh_bench/iroh.rs.html b/pr/3561/docs/src/iroh_bench/iroh.rs.html index c5bb6cce42..61edb24770 100644 --- a/pr/3561/docs/src/iroh_bench/iroh.rs.html +++ b/pr/3561/docs/src/iroh_bench/iroh.rs.html @@ -8,7 +8,7 @@ 8 Endpoint, EndpointAddr, RelayMode, RelayUrl, 9 endpoint::{Connection, ConnectionError, RecvStream, SendStream, TransportConfig}, 10}; -11use n0_snafu::{Result, ResultExt}; +11use n0_error::{Result, StackResultExt, StdResultExt}; 12use tracing::{trace, warn}; 13 14use crate::{ @@ -120,7 +120,7 @@ 120 let connection = endpoint 121 .connect(server_addr, ALPN) 122 .await -123 .context("unable to connect")?; +123 .std_context("unable to connect")?; 124 trace!("connected"); 125 126 Ok((endpoint, connection)) @@ -200,21 +200,21 @@ 200 stream 201 .write_chunk(bytes_data.clone()) 202 .await -203 .context("failed sending data")?; +203 .std_context("failed sending data")?; 204 } 205 206 if remaining != 0 { 207 stream 208 .write_chunk(bytes_data.slice(0..remaining)) 209 .await -210 .context("failed sending data")?; +210 .std_context("failed sending data")?; 211 } 212 -213 stream.finish().context("failed finishing stream")?; +213 stream.finish().std_context("failed finishing stream")?; 214 stream 215 .stopped() 216 .await -217 .context("failed to wait for stream to be stopped")?; +217 .std_context("failed to wait for stream to be stopped")?; 218 219 Ok(()) 220} @@ -229,7 +229,7 @@ 229 let (mut send_stream, mut recv_stream) = connection 230 .open_bi() 231 .await -232 .context("failed to open stream")?; +232 .std_context("failed to open stream")?; 233 234 send_data_on_stream(&mut send_stream, upload_size).await?; 235 @@ -258,7 +258,7 @@ 258 continue; 259 } 260 }; -261 let connection = connecting.await.context("handshake failed")?; +261 let connection = connecting.await.std_context("handshake failed")?; 262 263 server_tasks.push(tokio::spawn(async move { 264 loop { @@ -275,7 +275,7 @@ 275 tokio::spawn(async move { 276 drain_stream(&mut recv_stream, opt.read_unordered).await?; 277 send_data_on_stream(&mut send_stream, opt.download_size).await?; -278 Ok::<_, n0_snafu::Error>(()) +278 Ok::<_, n0_error::AnyError>(()) 279 }); 280 } 281 diff --git a/pr/3561/docs/src/iroh_bench/lib.rs.html b/pr/3561/docs/src/iroh_bench/lib.rs.html index 8b5af0f273..628570e4cb 100644 --- a/pr/3561/docs/src/iroh_bench/lib.rs.html +++ b/pr/3561/docs/src/iroh_bench/lib.rs.html @@ -6,7 +6,7 @@ 6}; 7 8use clap::Parser; -9use n0_snafu::Result; +9use n0_error::Result; 10use stats::Stats; 11use tokio::{ 12 runtime::{Builder, Runtime}, diff --git a/pr/3561/docs/src/iroh_bench/quinn.rs.html b/pr/3561/docs/src/iroh_bench/quinn.rs.html index ea393e9b8b..94a7d64cd6 100644 --- a/pr/3561/docs/src/iroh_bench/quinn.rs.html +++ b/pr/3561/docs/src/iroh_bench/quinn.rs.html @@ -5,7 +5,7 @@ 5}; 6 7use bytes::Bytes; -8use n0_snafu::{Result, ResultExt}; +8use n0_error::{Result, StdResultExt}; 9use quinn::{ 10 Connection, Endpoint, RecvStream, SendStream, TransportConfig, crypto::rustls::QuicClientConfig, 11}; @@ -91,7 +91,7 @@ 91 .connect_with(client_config, server_addr, "localhost") 92 .unwrap() 93 .await -94 .context("unable to connect")?; +94 .std_context("unable to connect")?; 95 trace!("connected"); 96 97 Ok((endpoint, connection)) @@ -171,21 +171,21 @@ 171 stream 172 .write_chunk(bytes_data.clone()) 173 .await -174 .context("failed sending data")?; +174 .std_context("failed sending data")?; 175 } 176 177 if remaining != 0 { 178 stream 179 .write_chunk(bytes_data.slice(0..remaining)) 180 .await -181 .context("failed sending data")?; +181 .std_context("failed sending data")?; 182 } 183 -184 stream.finish().context("failed finishing stream")?; +184 stream.finish().std_context("failed finishing stream")?; 185 stream 186 .stopped() 187 .await -188 .context("failed to wait for stream to be stopped")?; +188 .std_context("failed to wait for stream to be stopped")?; 189 190 Ok(()) 191} @@ -200,7 +200,7 @@ 200 let (mut send_stream, mut recv_stream) = connection 201 .open_bi() 202 .await -203 .context("failed to open stream")?; +203 .std_context("failed to open stream")?; 204 205 send_data_on_stream(&mut send_stream, upload_size).await?; 206 @@ -229,7 +229,7 @@ 229 continue; 230 } 231 }; -232 let connection = connecting.await.context("handshake failed")?; +232 let connection = connecting.await.std_context("handshake failed")?; 233 234 server_tasks.push(tokio::spawn(async move { 235 loop { @@ -246,7 +246,7 @@ 246 tokio::spawn(async move { 247 drain_stream(&mut recv_stream, opt.read_unordered).await?; 248 send_data_on_stream(&mut send_stream, opt.download_size).await?; -249 Ok::<_, n0_snafu::Error>(()) +249 Ok::<_, n0_error::AnyError>(()) 250 }); 251 } 252 diff --git a/pr/3561/docs/src/iroh_dns_server/config.rs.html b/pr/3561/docs/src/iroh_dns_server/config.rs.html index 2aef1cb158..a6d4c54bcd 100644 --- a/pr/3561/docs/src/iroh_dns_server/config.rs.html +++ b/pr/3561/docs/src/iroh_dns_server/config.rs.html @@ -7,7 +7,7 @@ 7 time::Duration, 8}; 9 -10use n0_snafu::{Result, ResultExt}; +10use n0_error::{Result, StackResultExt, StdResultExt}; 11use serde::{Deserialize, Serialize}; 12use tracing::info; 13 @@ -162,87 +162,91 @@ 162 ); 163 let s = tokio::fs::read_to_string(path.as_ref()) 164 .await -165 .with_context(|| format!("failed to read {}", path.as_ref().to_string_lossy()))?; -166 let config: Config = toml::from_str(&s).e()?; -167 Ok(config) -168 } -169 -170 /// Get the data directory. -171 pub fn data_dir() -> Result<PathBuf> { -172 let dir = if let Some(val) = env::var_os("IROH_DNS_DATA_DIR") { -173 PathBuf::from(val) -174 } else { -175 let path = dirs_next::data_dir() -176 .context("operating environment provides no directory for application data")?; -177 -178 path.join("iroh-dns") -179 }; -180 Ok(dir) -181 } -182 -183 /// Get the path to the store database file. -184 pub fn signed_packet_store_path() -> Result<PathBuf> { -185 Ok(Self::data_dir()?.join("signed-packets-1.db")) -186 } -187 -188 /// Get the address where the metrics server should be bound, if set. -189 pub(crate) fn metrics_addr(&self) -> Option<SocketAddr> { -190 match &self.metrics { -191 None => Some(DEFAULT_METRICS_ADDR), -192 Some(conf) => match conf.disabled { -193 true => None, -194 false => Some(conf.bind_addr.unwrap_or(DEFAULT_METRICS_ADDR)), -195 }, -196 } -197 } -198 -199 pub(crate) fn mainline_enabled(&self) -> Option<BootstrapOption> { -200 match self.mainline.as_ref() { -201 None => None, -202 Some(MainlineConfig { enabled: false, .. }) => None, -203 Some(MainlineConfig { -204 bootstrap: Some(bootstrap), -205 .. -206 }) => Some(BootstrapOption::Custom(bootstrap.clone())), +165 .std_context(format!( +166 "failed to read {}", +167 path.as_ref().to_string_lossy() +168 ))?; +169 let config: Config = toml::from_str(&s).e()?; +170 Ok(config) +171 } +172 +173 /// Get the data directory. +174 pub fn data_dir() -> Result<PathBuf> { +175 let dir = if let Some(val) = env::var_os("IROH_DNS_DATA_DIR") { +176 PathBuf::from(val) +177 } else { +178 let path = dirs_next::data_dir().std_context( +179 "operating environment provides no directory for application data", +180 )?; +181 +182 path.join("iroh-dns") +183 }; +184 Ok(dir) +185 } +186 +187 /// Get the path to the store database file. +188 pub fn signed_packet_store_path() -> Result<PathBuf> { +189 Ok(Self::data_dir()?.join("signed-packets-1.db")) +190 } +191 +192 /// Get the address where the metrics server should be bound, if set. +193 pub(crate) fn metrics_addr(&self) -> Option<SocketAddr> { +194 match &self.metrics { +195 None => Some(DEFAULT_METRICS_ADDR), +196 Some(conf) => match conf.disabled { +197 true => None, +198 false => Some(conf.bind_addr.unwrap_or(DEFAULT_METRICS_ADDR)), +199 }, +200 } +201 } +202 +203 pub(crate) fn mainline_enabled(&self) -> Option<BootstrapOption> { +204 match self.mainline.as_ref() { +205 None => None, +206 Some(MainlineConfig { enabled: false, .. }) => None, 207 Some(MainlineConfig { -208 bootstrap: None, .. -209 }) => Some(BootstrapOption::Default), -210 } -211 } -212} -213 -214impl Default for Config { -215 fn default() -> Self { -216 Self { -217 http: Some(HttpConfig { -218 port: 8080, -219 bind_addr: None, -220 }), -221 https: Some(HttpsConfig { -222 port: 8443, +208 bootstrap: Some(bootstrap), +209 .. +210 }) => Some(BootstrapOption::Custom(bootstrap.clone())), +211 Some(MainlineConfig { +212 bootstrap: None, .. +213 }) => Some(BootstrapOption::Default), +214 } +215 } +216} +217 +218impl Default for Config { +219 fn default() -> Self { +220 Self { +221 http: Some(HttpConfig { +222 port: 8080, 223 bind_addr: None, -224 domains: vec!["localhost".to_string()], -225 cert_mode: CertMode::SelfSigned, -226 letsencrypt_contact: None, -227 letsencrypt_prod: None, -228 }), -229 dns: DnsConfig { -230 port: 5300, -231 bind_addr: None, -232 origins: vec!["irohdns.example.".to_string(), ".".to_string()], -233 -234 default_soa: "irohdns.example hostmaster.irohdns.example 0 10800 3600 604800 3600" -235 .to_string(), -236 default_ttl: 900, +224 }), +225 https: Some(HttpsConfig { +226 port: 8443, +227 bind_addr: None, +228 domains: vec!["localhost".to_string()], +229 cert_mode: CertMode::SelfSigned, +230 letsencrypt_contact: None, +231 letsencrypt_prod: None, +232 }), +233 dns: DnsConfig { +234 port: 5300, +235 bind_addr: None, +236 origins: vec!["irohdns.example.".to_string(), ".".to_string()], 237 -238 rr_a: Some(Ipv4Addr::LOCALHOST), -239 rr_aaaa: None, -240 rr_ns: Some("ns1.irohdns.example.".to_string()), -241 }, -242 zone_store: None, -243 metrics: None, -244 mainline: None, -245 pkarr_put_rate_limit: RateLimitConfig::default(), -246 } -247 } -248}

\ No newline at end of file +238 default_soa: "irohdns.example hostmaster.irohdns.example 0 10800 3600 604800 3600" +239 .to_string(), +240 default_ttl: 900, +241 +242 rr_a: Some(Ipv4Addr::LOCALHOST), +243 rr_aaaa: None, +244 rr_ns: Some("ns1.irohdns.example.".to_string()), +245 }, +246 zone_store: None, +247 metrics: None, +248 mainline: None, +249 pkarr_put_rate_limit: RateLimitConfig::default(), +250 } +251 } +252}

\ No newline at end of file diff --git a/pr/3561/docs/src/iroh_dns_server/dns.rs.html b/pr/3561/docs/src/iroh_dns_server/dns.rs.html index e8824ac927..2db42df66d 100644 --- a/pr/3561/docs/src/iroh_dns_server/dns.rs.html +++ b/pr/3561/docs/src/iroh_dns_server/dns.rs.html @@ -25,7 +25,7 @@ 25 server::{Request, RequestHandler, ResponseHandler, ResponseInfo}, 26 store::in_memory::InMemoryAuthority, 27}; -28use n0_snafu::{Result, ResultExt, format_err}; +28use n0_error::{Result, StdResultExt, format_err}; 29use serde::{Deserialize, Serialize}; 30use tokio::{ 31 net::{TcpListener, UdpSocket}, diff --git a/pr/3561/docs/src/iroh_dns_server/dns/node_authority.rs.html b/pr/3561/docs/src/iroh_dns_server/dns/node_authority.rs.html index 11485c6189..4606591544 100644 --- a/pr/3561/docs/src/iroh_dns_server/dns/node_authority.rs.html +++ b/pr/3561/docs/src/iroh_dns_server/dns/node_authority.rs.html @@ -13,197 +13,196 @@ 13 server::RequestInfo, 14 store::in_memory::InMemoryAuthority, 15}; -16use n0_snafu::{Result, ResultExt}; -17use snafu::whatever; -18use tracing::{debug, trace}; -19 -20use crate::{ -21 store::ZoneStore, -22 util::{PublicKeyBytes, record_set_append_origin}, -23}; -24 -25#[derive(derive_more::Debug)] -26pub struct NodeAuthority { -27 serial: u32, -28 origins: Vec<Name>, -29 #[debug("InMemoryAuthority")] -30 static_authority: InMemoryAuthority, -31 zones: ZoneStore, -32 // TODO: This is used by Authority::origin -33 // Find out what exactly this is used for - we don't have a primary origin. -34 first_origin: LowerName, -35} -36 -37impl NodeAuthority { -38 pub fn new( -39 zones: ZoneStore, -40 static_authority: InMemoryAuthority, -41 origins: Vec<Name>, -42 serial: u32, -43 ) -> Result<Self> { -44 if origins.is_empty() { -45 whatever!("at least one origin is required"); -46 } -47 let first_origin = LowerName::from(&origins[0]); -48 Ok(Self { -49 static_authority, -50 origins, -51 serial, -52 zones, -53 first_origin, -54 }) -55 } -56 -57 pub fn origins(&self) -> impl Iterator<Item = &Name> { -58 self.origins.iter() -59 } -60 -61 pub fn serial(&self) -> u32 { -62 self.serial -63 } -64 -65 async fn resolve_pkarr( -66 &self, -67 name: Name, -68 pubkey: PublicKeyBytes, -69 origin: Name, -70 record_type: RecordType, -71 lookup_options: LookupOptions, -72 ) -> Result<AuthLookup, LookupError> { -73 debug!(%origin, %pubkey, %name, "resolve in pkarr zones"); -74 match self -75 .zones -76 .resolve(&pubkey, &name, record_type) -77 .await -78 .map_err(err_refused)? -79 { -80 Some(pkarr_set) => { -81 debug!(%origin, %pubkey, %name, "found {} records in pkarr zone", pkarr_set.records_without_rrsigs().count()); -82 let new_origin = -83 Name::parse(&pubkey.to_z32(), Some(&origin)).map_err(err_refused)?; -84 let record_set = record_set_append_origin(&pkarr_set, &new_origin, self.serial()) -85 .map_err(err_refused)?; -86 let records = LookupRecords::new(lookup_options, Arc::new(record_set)); -87 let answers = AuthLookup::answers(records, None); -88 Ok(answers) -89 } -90 None => Err(err_nx_domain("not found")), -91 } -92 } -93} -94 -95#[async_trait] -96impl Authority for NodeAuthority { -97 type Lookup = AuthLookup; -98 -99 fn zone_type(&self) -> ZoneType { -100 ZoneType::Primary -101 } -102 -103 fn is_axfr_allowed(&self) -> bool { -104 false -105 } -106 -107 async fn update(&self, _update: &MessageRequest) -> UpdateResult<bool> { -108 Err(ResponseCode::NotImp) -109 } -110 -111 fn origin(&self) -> &LowerName { -112 &self.first_origin -113 } -114 -115 async fn lookup( -116 &self, -117 name: &LowerName, -118 record_type: RecordType, -119 lookup_options: LookupOptions, -120 ) -> LookupControlFlow<Self::Lookup> { -121 debug!(name=%name, "lookup in node authority"); -122 match record_type { -123 RecordType::SOA | RecordType::NS => { -124 self.static_authority -125 .lookup(name, record_type, lookup_options) -126 .await -127 } -128 _ => match parse_name_as_pkarr_with_origin(name, &self.origins) { -129 Ok((name, pubkey, origin)) => { -130 let res = self -131 .resolve_pkarr(name, pubkey, origin, record_type, lookup_options) -132 .await; -133 LookupControlFlow::Continue(res) -134 } -135 Err(err) => { -136 debug!(%name, failed_with=%err, "not a pkarr name, resolve in static authority"); -137 self.static_authority -138 .lookup(name, record_type, lookup_options) -139 .await -140 } -141 }, -142 } -143 } -144 -145 async fn search( -146 &self, -147 request_info: RequestInfo<'_>, -148 lookup_options: LookupOptions, -149 ) -> LookupControlFlow<Self::Lookup> { -150 debug!("search in node authority for {}", request_info.query); -151 let lookup_name = request_info.query.name(); -152 let record_type: RecordType = request_info.query.query_type(); -153 match record_type { -154 RecordType::SOA => { -155 self.static_authority -156 .lookup(self.origin(), record_type, lookup_options) -157 .await -158 } -159 RecordType::AXFR => { -160 LookupControlFlow::Continue(Err(LookupError::from(ResponseCode::Refused))) -161 } -162 _ => self.lookup(lookup_name, record_type, lookup_options).await, -163 } -164 } -165 -166 async fn get_nsec_records( -167 &self, -168 _name: &LowerName, -169 _lookup_options: LookupOptions, -170 ) -> LookupControlFlow<Self::Lookup> { -171 LookupControlFlow::Skip -172 } -173} -174 -175fn parse_name_as_pkarr_with_origin( -176 name: impl Into<Name>, -177 allowed_origins: &[Name], -178) -> Result<(Name, PublicKeyBytes, Name)> { -179 let name = name.into(); -180 trace!("resolve {name}"); -181 for origin in allowed_origins.iter() { -182 trace!("try {origin}"); -183 if !origin.zone_of(&name) { -184 continue; -185 } -186 if name.num_labels() < origin.num_labels() + 1 { -187 whatever!("not a valid pkarr name: missing pubkey"); -188 } -189 trace!("parse {origin}"); -190 let labels = name.iter().rev(); -191 let mut labels_without_origin = labels.skip(origin.num_labels() as usize); -192 let pkey_label = labels_without_origin.next().expect("length checked above"); -193 let pkey_str = std::str::from_utf8(pkey_label).e()?; -194 let pkey = -195 PublicKeyBytes::from_z32(pkey_str).context("not a valid pkarr name: invalid pubkey")?; -196 let remaining_name = Name::from_labels(labels_without_origin.rev()).e()?; -197 return Ok((remaining_name, pkey, origin.clone())); -198 } -199 whatever!("name does not match any allowed origin"); -200} -201 -202fn err_refused(e: impl fmt::Debug) -> LookupError { -203 trace!("lookup failed (refused): {e:?}"); -204 LookupError::from(ResponseCode::Refused) -205} -206fn err_nx_domain(e: impl fmt::Debug) -> LookupError { -207 trace!("lookup failed (nxdomain): {e:?}"); -208 LookupError::from(ResponseCode::NXDomain) -209}

\ No newline at end of file +16use n0_error::{Result, StackResultExt, StdResultExt, whatever}; +17use tracing::{debug, trace}; +18 +19use crate::{ +20 store::ZoneStore, +21 util::{PublicKeyBytes, record_set_append_origin}, +22}; +23 +24#[derive(derive_more::Debug)] +25pub struct NodeAuthority { +26 serial: u32, +27 origins: Vec<Name>, +28 #[debug("InMemoryAuthority")] +29 static_authority: InMemoryAuthority, +30 zones: ZoneStore, +31 // TODO: This is used by Authority::origin +32 // Find out what exactly this is used for - we don't have a primary origin. +33 first_origin: LowerName, +34} +35 +36impl NodeAuthority { +37 pub fn new( +38 zones: ZoneStore, +39 static_authority: InMemoryAuthority, +40 origins: Vec<Name>, +41 serial: u32, +42 ) -> Result<Self> { +43 if origins.is_empty() { +44 whatever!("at least one origin is required"); +45 } +46 let first_origin = LowerName::from(&origins[0]); +47 Ok(Self { +48 static_authority, +49 origins, +50 serial, +51 zones, +52 first_origin, +53 }) +54 } +55 +56 pub fn origins(&self) -> impl Iterator<Item = &Name> { +57 self.origins.iter() +58 } +59 +60 pub fn serial(&self) -> u32 { +61 self.serial +62 } +63 +64 async fn resolve_pkarr( +65 &self, +66 name: Name, +67 pubkey: PublicKeyBytes, +68 origin: Name, +69 record_type: RecordType, +70 lookup_options: LookupOptions, +71 ) -> Result<AuthLookup, LookupError> { +72 debug!(%origin, %pubkey, %name, "resolve in pkarr zones"); +73 match self +74 .zones +75 .resolve(&pubkey, &name, record_type) +76 .await +77 .map_err(err_refused)? +78 { +79 Some(pkarr_set) => { +80 debug!(%origin, %pubkey, %name, "found {} records in pkarr zone", pkarr_set.records_without_rrsigs().count()); +81 let new_origin = +82 Name::parse(&pubkey.to_z32(), Some(&origin)).map_err(err_refused)?; +83 let record_set = record_set_append_origin(&pkarr_set, &new_origin, self.serial()) +84 .map_err(err_refused)?; +85 let records = LookupRecords::new(lookup_options, Arc::new(record_set)); +86 let answers = AuthLookup::answers(records, None); +87 Ok(answers) +88 } +89 None => Err(err_nx_domain("not found")), +90 } +91 } +92} +93 +94#[async_trait] +95impl Authority for NodeAuthority { +96 type Lookup = AuthLookup; +97 +98 fn zone_type(&self) -> ZoneType { +99 ZoneType::Primary +100 } +101 +102 fn is_axfr_allowed(&self) -> bool { +103 false +104 } +105 +106 async fn update(&self, _update: &MessageRequest) -> UpdateResult<bool> { +107 Err(ResponseCode::NotImp) +108 } +109 +110 fn origin(&self) -> &LowerName { +111 &self.first_origin +112 } +113 +114 async fn lookup( +115 &self, +116 name: &LowerName, +117 record_type: RecordType, +118 lookup_options: LookupOptions, +119 ) -> LookupControlFlow<Self::Lookup> { +120 debug!(name=%name, "lookup in node authority"); +121 match record_type { +122 RecordType::SOA | RecordType::NS => { +123 self.static_authority +124 .lookup(name, record_type, lookup_options) +125 .await +126 } +127 _ => match parse_name_as_pkarr_with_origin(name, &self.origins) { +128 Ok((name, pubkey, origin)) => { +129 let res = self +130 .resolve_pkarr(name, pubkey, origin, record_type, lookup_options) +131 .await; +132 LookupControlFlow::Continue(res) +133 } +134 Err(err) => { +135 debug!(%name, failed_with=%err, "not a pkarr name, resolve in static authority"); +136 self.static_authority +137 .lookup(name, record_type, lookup_options) +138 .await +139 } +140 }, +141 } +142 } +143 +144 async fn search( +145 &self, +146 request_info: RequestInfo<'_>, +147 lookup_options: LookupOptions, +148 ) -> LookupControlFlow<Self::Lookup> { +149 debug!("search in node authority for {}", request_info.query); +150 let lookup_name = request_info.query.name(); +151 let record_type: RecordType = request_info.query.query_type(); +152 match record_type { +153 RecordType::SOA => { +154 self.static_authority +155 .lookup(self.origin(), record_type, lookup_options) +156 .await +157 } +158 RecordType::AXFR => { +159 LookupControlFlow::Continue(Err(LookupError::from(ResponseCode::Refused))) +160 } +161 _ => self.lookup(lookup_name, record_type, lookup_options).await, +162 } +163 } +164 +165 async fn get_nsec_records( +166 &self, +167 _name: &LowerName, +168 _lookup_options: LookupOptions, +169 ) -> LookupControlFlow<Self::Lookup> { +170 LookupControlFlow::Skip +171 } +172} +173 +174fn parse_name_as_pkarr_with_origin( +175 name: impl Into<Name>, +176 allowed_origins: &[Name], +177) -> Result<(Name, PublicKeyBytes, Name)> { +178 let name = name.into(); +179 trace!("resolve {name}"); +180 for origin in allowed_origins.iter() { +181 trace!("try {origin}"); +182 if !origin.zone_of(&name) { +183 continue; +184 } +185 if name.num_labels() < origin.num_labels() + 1 { +186 whatever!("not a valid pkarr name: missing pubkey"); +187 } +188 trace!("parse {origin}"); +189 let labels = name.iter().rev(); +190 let mut labels_without_origin = labels.skip(origin.num_labels() as usize); +191 let pkey_label = labels_without_origin.next().expect("length checked above"); +192 let pkey_str = std::str::from_utf8(pkey_label).e()?; +193 let pkey = PublicKeyBytes::from_z32(pkey_str) +194 .std_context("not a valid pkarr name: invalid pubkey")?; +195 let remaining_name = Name::from_labels(labels_without_origin.rev()).e()?; +196 return Ok((remaining_name, pkey, origin.clone())); +197 } +198 whatever!("name does not match any allowed origin"); +199} +200 +201fn err_refused(e: impl fmt::Debug) -> LookupError { +202 trace!("lookup failed (refused): {e:?}"); +203 LookupError::from(ResponseCode::Refused) +204} +205fn err_nx_domain(e: impl fmt::Debug) -> LookupError { +206 trace!("lookup failed (nxdomain): {e:?}"); +207 LookupError::from(ResponseCode::NXDomain) +208} \ No newline at end of file diff --git a/pr/3561/docs/src/iroh_dns_server/http.rs.html b/pr/3561/docs/src/iroh_dns_server/http.rs.html index aa380d8b0c..24964d15d2 100644 --- a/pr/3561/docs/src/iroh_dns_server/http.rs.html +++ b/pr/3561/docs/src/iroh_dns_server/http.rs.html @@ -14,254 +14,253 @@ 14 response::IntoResponse, 15 routing::get, 16}; -17use n0_snafu::{Result, ResultExt}; +17use n0_error::{Result, StackResultExt, StdResultExt, whatever}; 18use serde::{Deserialize, Serialize}; -19use snafu::whatever; -20use tokio::{net::TcpListener, task::JoinSet}; -21use tower_http::{ -22 cors::{self, CorsLayer}, -23 trace::TraceLayer, -24}; -25use tracing::{Level, info, span, warn}; -26 -27mod doh; -28mod error; -29mod pkarr; -30mod rate_limiting; -31mod tls; -32 -33pub use self::{rate_limiting::RateLimitConfig, tls::CertMode}; -34use crate::{config::Config, state::AppState}; -35 -36/// Config for the HTTP server -37#[derive(Debug, Serialize, Deserialize, Clone)] -38pub struct HttpConfig { -39 /// Port to bind to -40 pub port: u16, -41 /// Optionally set a custom bind address (will use 0.0.0.0 if unset) -42 pub bind_addr: Option<IpAddr>, -43} -44 -45/// Config for the HTTPS server -46#[derive(Debug, Serialize, Deserialize, Clone)] -47pub struct HttpsConfig { -48 /// Port to bind to -49 pub port: u16, -50 /// Optionally set a custom bind address (will use 0.0.0.0 if unset) -51 pub bind_addr: Option<IpAddr>, -52 /// The list of domains for which SSL certificates should be created. -53 pub domains: Vec<String>, -54 /// The mode of SSL certificate creation -55 pub cert_mode: CertMode, -56 /// Letsencrypt contact email address (required if using [`CertMode::LetsEncrypt`]) -57 pub letsencrypt_contact: Option<String>, -58 /// Whether to use the letsenrypt production servers (only applies to [`CertMode::LetsEncrypt`]) -59 pub letsencrypt_prod: Option<bool>, -60} -61 -62/// The HTTP(S) server part of iroh-dns-server -63pub struct HttpServer { -64 tasks: JoinSet<std::io::Result<()>>, -65 http_addr: Option<SocketAddr>, -66 https_addr: Option<SocketAddr>, -67} -68 -69impl HttpServer { -70 /// Spawn the server -71 pub async fn spawn( -72 http_config: Option<HttpConfig>, -73 https_config: Option<HttpsConfig>, -74 rate_limit_config: RateLimitConfig, -75 state: AppState, -76 ) -> Result<HttpServer> { -77 if http_config.is_none() && https_config.is_none() { -78 whatever!("Either http or https config is required"); -79 } -80 -81 let app = create_app(state, &rate_limit_config); -82 -83 let mut tasks = JoinSet::new(); -84 -85 // launch http -86 let http_addr = if let Some(config) = http_config { -87 let bind_addr = SocketAddr::new( -88 config.bind_addr.unwrap_or(Ipv4Addr::UNSPECIFIED.into()), -89 config.port, -90 ); -91 let app = app.clone(); -92 let listener = TcpListener::bind(bind_addr).await.e()?.into_std().e()?; -93 let bound_addr = listener.local_addr().e()?; -94 let fut = axum_server::from_tcp(listener) -95 .serve(app.into_make_service_with_connect_info::<SocketAddr>()); -96 info!("HTTP server listening on {bind_addr}"); -97 tasks.spawn(fut); -98 Some(bound_addr) -99 } else { -100 None -101 }; -102 -103 // launch https -104 let https_addr = if let Some(config) = https_config { -105 let bind_addr = SocketAddr::new( -106 config.bind_addr.unwrap_or(Ipv4Addr::UNSPECIFIED.into()), -107 config.port, -108 ); -109 let acceptor = { -110 let cache_path = Config::data_dir()? -111 .join("cert_cache") -112 .join(config.cert_mode.to_string()); -113 tokio::fs::create_dir_all(&cache_path) -114 .await -115 .with_context(|| { -116 format!("failed to create cert cache dir at {cache_path:?}") -117 })?; -118 config -119 .cert_mode -120 .build( -121 config.domains, -122 cache_path, -123 config.letsencrypt_contact, -124 config.letsencrypt_prod.unwrap_or(false), -125 ) -126 .await? -127 }; -128 let listener = TcpListener::bind(bind_addr).await.e()?.into_std().e()?; -129 let bound_addr = listener.local_addr().e()?; -130 let fut = axum_server::from_tcp(listener) -131 .acceptor(acceptor) -132 .serve(app.into_make_service_with_connect_info::<SocketAddr>()); -133 info!("HTTPS server listening on {bind_addr}"); -134 tasks.spawn(fut); -135 Some(bound_addr) -136 } else { -137 None -138 }; -139 -140 Ok(HttpServer { -141 tasks, -142 http_addr, -143 https_addr, -144 }) -145 } -146 -147 /// Get the bound address of the HTTP socket. -148 pub fn http_addr(&self) -> Option<SocketAddr> { -149 self.http_addr -150 } -151 -152 /// Get the bound address of the HTTPS socket. -153 pub fn https_addr(&self) -> Option<SocketAddr> { -154 self.https_addr -155 } -156 -157 /// Shutdown the server and wait for all tasks to complete. -158 pub async fn shutdown(mut self) -> Result<()> { -159 // TODO: Graceful cancellation. -160 self.tasks.abort_all(); -161 self.run_until_done().await?; -162 Ok(()) -163 } -164 -165 /// Wait for all tasks to complete. -166 /// -167 /// Runs forever unless tasks fail. -168 pub async fn run_until_done(mut self) -> Result<()> { -169 let mut final_res: Result<()> = Ok(()); -170 while let Some(res) = self.tasks.join_next().await { -171 match res { -172 Ok(Ok(())) => {} -173 Err(err) if err.is_cancelled() => {} -174 Ok(Err(err)) => { -175 warn!(?err, "task failed"); -176 final_res = Err(err).context("task"); -177 } -178 Err(err) => { -179 warn!(?err, "task panicked"); -180 final_res = Err(err).context("join"); -181 } -182 } -183 } -184 final_res -185 } -186} -187 -188pub(crate) fn create_app(state: AppState, rate_limit_config: &RateLimitConfig) -> Router { -189 // configure cors middleware -190 let cors = CorsLayer::new() -191 // allow `GET` and `POST` when accessing the resource -192 .allow_methods([Method::GET, Method::POST, Method::PUT]) -193 // allow requests from any origin -194 .allow_origin(cors::Any); -195 -196 // configure tracing middleware -197 let trace = TraceLayer::new_for_http().make_span_with(|request: &http::Request<_>| { -198 let conn_info = request -199 .extensions() -200 .get::<ConnectInfo<SocketAddr>>() -201 .expect("connectinfo extension to be present"); -202 let span = span!( -203 Level::DEBUG, -204 "http_request", -205 method = ?request.method(), -206 uri = ?request.uri(), -207 src = %conn_info.0, -208 ); -209 span -210 }); -211 -212 // configure rate limiting middleware -213 let rate_limit = rate_limiting::create(rate_limit_config); -214 -215 // configure routes -216 // -217 // only the pkarr::put route gets a rate limit -218 let router = Router::new() -219 .route("/dns-query", get(doh::get).post(doh::post)) -220 .route( -221 "/pkarr/{key}", -222 if let Some(rate_limit) = rate_limit { -223 get(pkarr::get).put(pkarr::put.layer(rate_limit)) -224 } else { -225 get(pkarr::get).put(pkarr::put) -226 }, -227 ) -228 .route("/healthcheck", get(|| async { "OK" })) -229 .route("/", get(|| async { "Hi!" })) -230 .with_state(state.clone()); -231 -232 // configure app -233 router -234 .layer(cors) -235 .layer(trace) -236 .route_layer(middleware::from_fn_with_state(state, metrics_middleware)) -237} -238 -239/// Record request metrics. -240// TODO: -241// * Request duration would be much better tracked as a histogram. -242// * It would be great to attach labels to the metrics, so that the recorded metrics -243// can filter by method etc. -244// -245// See also -246// https://github.com/tokio-rs/axum/blob/main/examples/prometheus-metrics/src/main.rs#L114 -247async fn metrics_middleware( -248 State(state): State<AppState>, -249 req: Request, -250 next: Next, -251) -> impl IntoResponse { -252 let start = Instant::now(); -253 let response = next.run(req).await; -254 let latency = start.elapsed().as_millis(); -255 let status = response.status(); -256 state -257 .metrics -258 .http_requests_duration_ms -259 .inc_by(latency as u64); -260 state.metrics.http_requests.inc(); -261 if status.is_success() { -262 state.metrics.http_requests_success.inc(); -263 } else { -264 state.metrics.http_requests_error.inc(); -265 } -266 response -267} \ No newline at end of file +19use tokio::{net::TcpListener, task::JoinSet}; +20use tower_http::{ +21 cors::{self, CorsLayer}, +22 trace::TraceLayer, +23}; +24use tracing::{Level, info, span, warn}; +25 +26mod doh; +27mod error; +28mod pkarr; +29mod rate_limiting; +30mod tls; +31 +32pub use self::{rate_limiting::RateLimitConfig, tls::CertMode}; +33use crate::{config::Config, state::AppState}; +34 +35/// Config for the HTTP server +36#[derive(Debug, Serialize, Deserialize, Clone)] +37pub struct HttpConfig { +38 /// Port to bind to +39 pub port: u16, +40 /// Optionally set a custom bind address (will use 0.0.0.0 if unset) +41 pub bind_addr: Option<IpAddr>, +42} +43 +44/// Config for the HTTPS server +45#[derive(Debug, Serialize, Deserialize, Clone)] +46pub struct HttpsConfig { +47 /// Port to bind to +48 pub port: u16, +49 /// Optionally set a custom bind address (will use 0.0.0.0 if unset) +50 pub bind_addr: Option<IpAddr>, +51 /// The list of domains for which SSL certificates should be created. +52 pub domains: Vec<String>, +53 /// The mode of SSL certificate creation +54 pub cert_mode: CertMode, +55 /// Letsencrypt contact email address (required if using [`CertMode::LetsEncrypt`]) +56 pub letsencrypt_contact: Option<String>, +57 /// Whether to use the letsenrypt production servers (only applies to [`CertMode::LetsEncrypt`]) +58 pub letsencrypt_prod: Option<bool>, +59} +60 +61/// The HTTP(S) server part of iroh-dns-server +62pub struct HttpServer { +63 tasks: JoinSet<std::io::Result<()>>, +64 http_addr: Option<SocketAddr>, +65 https_addr: Option<SocketAddr>, +66} +67 +68impl HttpServer { +69 /// Spawn the server +70 pub async fn spawn( +71 http_config: Option<HttpConfig>, +72 https_config: Option<HttpsConfig>, +73 rate_limit_config: RateLimitConfig, +74 state: AppState, +75 ) -> Result<HttpServer> { +76 if http_config.is_none() && https_config.is_none() { +77 whatever!("Either http or https config is required"); +78 } +79 +80 let app = create_app(state, &rate_limit_config); +81 +82 let mut tasks = JoinSet::new(); +83 +84 // launch http +85 let http_addr = if let Some(config) = http_config { +86 let bind_addr = SocketAddr::new( +87 config.bind_addr.unwrap_or(Ipv4Addr::UNSPECIFIED.into()), +88 config.port, +89 ); +90 let app = app.clone(); +91 let listener = TcpListener::bind(bind_addr).await.e()?.into_std().e()?; +92 let bound_addr = listener.local_addr().e()?; +93 let fut = axum_server::from_tcp(listener) +94 .serve(app.into_make_service_with_connect_info::<SocketAddr>()); +95 info!("HTTP server listening on {bind_addr}"); +96 tasks.spawn(fut); +97 Some(bound_addr) +98 } else { +99 None +100 }; +101 +102 // launch https +103 let https_addr = if let Some(config) = https_config { +104 let bind_addr = SocketAddr::new( +105 config.bind_addr.unwrap_or(Ipv4Addr::UNSPECIFIED.into()), +106 config.port, +107 ); +108 let acceptor = { +109 let cache_path = Config::data_dir()? +110 .join("cert_cache") +111 .join(config.cert_mode.to_string()); +112 tokio::fs::create_dir_all(&cache_path) +113 .await +114 .std_context(format!( +115 "failed to create cert cache dir at {cache_path:?}" +116 ))?; +117 config +118 .cert_mode +119 .build( +120 config.domains, +121 cache_path, +122 config.letsencrypt_contact, +123 config.letsencrypt_prod.unwrap_or(false), +124 ) +125 .await? +126 }; +127 let listener = TcpListener::bind(bind_addr).await.e()?.into_std().e()?; +128 let bound_addr = listener.local_addr().e()?; +129 let fut = axum_server::from_tcp(listener) +130 .acceptor(acceptor) +131 .serve(app.into_make_service_with_connect_info::<SocketAddr>()); +132 info!("HTTPS server listening on {bind_addr}"); +133 tasks.spawn(fut); +134 Some(bound_addr) +135 } else { +136 None +137 }; +138 +139 Ok(HttpServer { +140 tasks, +141 http_addr, +142 https_addr, +143 }) +144 } +145 +146 /// Get the bound address of the HTTP socket. +147 pub fn http_addr(&self) -> Option<SocketAddr> { +148 self.http_addr +149 } +150 +151 /// Get the bound address of the HTTPS socket. +152 pub fn https_addr(&self) -> Option<SocketAddr> { +153 self.https_addr +154 } +155 +156 /// Shutdown the server and wait for all tasks to complete. +157 pub async fn shutdown(mut self) -> Result<()> { +158 // TODO: Graceful cancellation. +159 self.tasks.abort_all(); +160 self.run_until_done().await?; +161 Ok(()) +162 } +163 +164 /// Wait for all tasks to complete. +165 /// +166 /// Runs forever unless tasks fail. +167 pub async fn run_until_done(mut self) -> Result<()> { +168 let mut final_res: Result<()> = Ok(()); +169 while let Some(res) = self.tasks.join_next().await { +170 match res { +171 Ok(Ok(())) => {} +172 Err(err) if err.is_cancelled() => {} +173 Ok(Err(err)) => { +174 warn!(?err, "task failed"); +175 final_res = Err(err).std_context("task"); +176 } +177 Err(err) => { +178 warn!(?err, "task panicked"); +179 final_res = Err(err).std_context("join"); +180 } +181 } +182 } +183 final_res +184 } +185} +186 +187pub(crate) fn create_app(state: AppState, rate_limit_config: &RateLimitConfig) -> Router { +188 // configure cors middleware +189 let cors = CorsLayer::new() +190 // allow `GET` and `POST` when accessing the resource +191 .allow_methods([Method::GET, Method::POST, Method::PUT]) +192 // allow requests from any origin +193 .allow_origin(cors::Any); +194 +195 // configure tracing middleware +196 let trace = TraceLayer::new_for_http().make_span_with(|request: &http::Request<_>| { +197 let conn_info = request +198 .extensions() +199 .get::<ConnectInfo<SocketAddr>>() +200 .expect("connectinfo extension to be present"); +201 let span = span!( +202 Level::DEBUG, +203 "http_request", +204 method = ?request.method(), +205 uri = ?request.uri(), +206 src = %conn_info.0, +207 ); +208 span +209 }); +210 +211 // configure rate limiting middleware +212 let rate_limit = rate_limiting::create(rate_limit_config); +213 +214 // configure routes +215 // +216 // only the pkarr::put route gets a rate limit +217 let router = Router::new() +218 .route("/dns-query", get(doh::get).post(doh::post)) +219 .route( +220 "/pkarr/{key}", +221 if let Some(rate_limit) = rate_limit { +222 get(pkarr::get).put(pkarr::put.layer(rate_limit)) +223 } else { +224 get(pkarr::get).put(pkarr::put) +225 }, +226 ) +227 .route("/healthcheck", get(|| async { "OK" })) +228 .route("/", get(|| async { "Hi!" })) +229 .with_state(state.clone()); +230 +231 // configure app +232 router +233 .layer(cors) +234 .layer(trace) +235 .route_layer(middleware::from_fn_with_state(state, metrics_middleware)) +236} +237 +238/// Record request metrics. +239// TODO: +240// * Request duration would be much better tracked as a histogram. +241// * It would be great to attach labels to the metrics, so that the recorded metrics +242// can filter by method etc. +243// +244// See also +245// https://github.com/tokio-rs/axum/blob/main/examples/prometheus-metrics/src/main.rs#L114 +246async fn metrics_middleware( +247 State(state): State<AppState>, +248 req: Request, +249 next: Next, +250) -> impl IntoResponse { +251 let start = Instant::now(); +252 let response = next.run(req).await; +253 let latency = start.elapsed().as_millis(); +254 let status = response.status(); +255 state +256 .metrics +257 .http_requests_duration_ms +258 .inc_by(latency as u64); +259 state.metrics.http_requests.inc(); +260 if status.is_success() { +261 state.metrics.http_requests_success.inc(); +262 } else { +263 state.metrics.http_requests_error.inc(); +264 } +265 response +266} \ No newline at end of file diff --git a/pr/3561/docs/src/iroh_dns_server/http/doh.rs.html b/pr/3561/docs/src/iroh_dns_server/http/doh.rs.html index de326b34b2..4a9e187b03 100644 --- a/pr/3561/docs/src/iroh_dns_server/http/doh.rs.html +++ b/pr/3561/docs/src/iroh_dns_server/http/doh.rs.html @@ -16,7 +16,7 @@ 16 HeaderValue, StatusCode, 17 header::{CACHE_CONTROL, CONTENT_TYPE}, 18}; -19use n0_snafu::ResultExt; +19use n0_error::StdResultExt; 20 21use super::error::AppResult; 22use crate::state::AppState; diff --git a/pr/3561/docs/src/iroh_dns_server/http/doh/response.rs.html b/pr/3561/docs/src/iroh_dns_server/http/doh/response.rs.html index bbfaadd8fc..0c2c9edd9d 100644 --- a/pr/3561/docs/src/iroh_dns_server/http/doh/response.rs.html +++ b/pr/3561/docs/src/iroh_dns_server/http/doh/response.rs.html @@ -4,138 +4,134 @@ 4// https://github.com/fission-codes/fission-server/blob/394de877fad021260c69fdb1edd7bb4b2f98108c/fission-core/src/dns.rs 5 6use hickory_server::proto; -7use n0_snafu::Result; +7use n0_error::{Result, whatever}; 8use serde::{Deserialize, Serialize}; -9use snafu::ensure_whatever; -10 -11#[derive(Debug, Serialize, Deserialize)] -12/// JSON representation of a DNS response -13/// See: <https://developers.google.com/speed/public-dns/docs/doh/json> -14pub struct DnsResponse { -15 /// Standard DNS response code -16 #[serde(rename = "Status")] -17 pub status: u32, -18 /// Whether the response was truncated -19 #[serde(rename = "TC")] -20 pub tc: bool, -21 /// Whether recursion was desired -22 #[serde(rename = "RD")] -23 pub rd: bool, -24 /// Whether recursion was available -25 #[serde(rename = "RA")] -26 pub ra: bool, -27 /// Whether the response was validated with DNSSEC -28 #[serde(rename = "AD")] -29 pub ad: bool, -30 /// Whether the client asked to disable DNSSEC validation -31 #[serde(rename = "CD")] -32 pub cd: bool, -33 /// The questions that this request answers -34 #[serde(rename = "Question")] -35 pub question: Vec<DohQuestionJson>, -36 /// The answers to the request -37 #[serde(rename = "Answer")] -38 #[serde(skip_serializing_if = "Vec::is_empty")] -39 pub answer: Vec<DohRecordJson>, -40 /// An optional comment -41 #[serde(rename = "Comment")] -42 pub comment: Option<String>, -43 /// IP Address / scope prefix-length of the client -44 /// See: <https://tools.ietf.org/html/rfc7871> -45 pub edns_client_subnet: Option<String>, -46} -47 -48impl DnsResponse { -49 /// Create a new JSON response from a DNS message -50 pub fn from_message(message: proto::op::Message) -> Result<Self> { -51 ensure_whatever!( -52 message.message_type() == proto::op::MessageType::Response, -53 "Expected message type to be response" -54 ); -55 -56 ensure_whatever!( -57 message.query_count() == message.queries().len() as u16, -58 "Query count mismatch" -59 ); -60 -61 ensure_whatever!( -62 message.answer_count() == message.answers().len() as u16, -63 "Answer count mismatch" -64 ); -65 -66 let status: u32 = -67 <u16 as From<proto::op::ResponseCode>>::from(message.response_code()) as u32; -68 -69 let question: Vec<_> = message -70 .queries() -71 .iter() -72 .map(DohQuestionJson::from_query) -73 .collect(); -74 -75 let answer: Vec<_> = message -76 .answers() -77 .iter() -78 .map(DohRecordJson::from_record) -79 .collect::<Result<_>>()?; -80 -81 Ok(DnsResponse { -82 status, -83 tc: message.truncated(), -84 rd: message.recursion_desired(), -85 ra: message.recursion_available(), -86 ad: message.authentic_data(), -87 cd: message.checking_disabled(), -88 question, -89 answer, -90 comment: None, -91 edns_client_subnet: None, -92 }) -93 } -94} -95 -96#[derive(Debug, Serialize, Deserialize)] -97/// JSON representation of a DNS question -98pub struct DohQuestionJson { -99 /// FQDN with trailing dot -100 pub name: String, -101 /// Standard DNS RR type -102 #[serde(rename = "type")] -103 pub question_type: u16, -104} -105 -106impl DohQuestionJson { -107 /// Create a new JSON question from a DNS query -108 pub fn from_query(query: &proto::op::Query) -> Self { -109 Self { -110 name: query.name().to_string(), -111 question_type: query.query_type().into(), -112 } -113 } -114} -115 -116#[derive(Debug, Serialize, Deserialize)] -117/// JSON representation of a DNS record -118pub struct DohRecordJson { -119 /// FQDN with trailing dot -120 pub name: String, -121 /// Standard DNS RR type -122 #[serde(rename = "type")] -123 pub record_type: u16, -124 /// Time-to-live, in seconds -125 #[serde(rename = "TTL")] -126 pub ttl: u32, -127 /// Record data -128 pub data: String, -129} -130 -131impl DohRecordJson { -132 /// Create a new JSON record from a DNS record -133 pub fn from_record(record: &proto::rr::Record) -> Result<Self> { -134 Ok(Self { -135 name: record.name().to_string(), -136 record_type: record.record_type().into(), -137 ttl: record.ttl(), -138 data: record.data().to_string(), -139 }) -140 } -141} \ No newline at end of file +9 +10#[derive(Debug, Serialize, Deserialize)] +11/// JSON representation of a DNS response +12/// See: <https://developers.google.com/speed/public-dns/docs/doh/json> +13pub struct DnsResponse { +14 /// Standard DNS response code +15 #[serde(rename = "Status")] +16 pub status: u32, +17 /// Whether the response was truncated +18 #[serde(rename = "TC")] +19 pub tc: bool, +20 /// Whether recursion was desired +21 #[serde(rename = "RD")] +22 pub rd: bool, +23 /// Whether recursion was available +24 #[serde(rename = "RA")] +25 pub ra: bool, +26 /// Whether the response was validated with DNSSEC +27 #[serde(rename = "AD")] +28 pub ad: bool, +29 /// Whether the client asked to disable DNSSEC validation +30 #[serde(rename = "CD")] +31 pub cd: bool, +32 /// The questions that this request answers +33 #[serde(rename = "Question")] +34 pub question: Vec<DohQuestionJson>, +35 /// The answers to the request +36 #[serde(rename = "Answer")] +37 #[serde(skip_serializing_if = "Vec::is_empty")] +38 pub answer: Vec<DohRecordJson>, +39 /// An optional comment +40 #[serde(rename = "Comment")] +41 pub comment: Option<String>, +42 /// IP Address / scope prefix-length of the client +43 /// See: <https://tools.ietf.org/html/rfc7871> +44 pub edns_client_subnet: Option<String>, +45} +46 +47impl DnsResponse { +48 /// Create a new JSON response from a DNS message +49 pub fn from_message(message: proto::op::Message) -> Result<Self> { +50 if message.message_type() != proto::op::MessageType::Response { +51 whatever!("Expected message type to be response"); +52 } +53 +54 if message.query_count() != message.queries().len() as u16 { +55 whatever!("Query count mismatch"); +56 } +57 +58 if message.answer_count() != message.answers().len() as u16 { +59 whatever!("Answer count mismatch"); +60 } +61 +62 let status: u32 = +63 <u16 as From<proto::op::ResponseCode>>::from(message.response_code()) as u32; +64 +65 let question: Vec<_> = message +66 .queries() +67 .iter() +68 .map(DohQuestionJson::from_query) +69 .collect(); +70 +71 let answer: Vec<_> = message +72 .answers() +73 .iter() +74 .map(DohRecordJson::from_record) +75 .collect::<Result<_>>()?; +76 +77 Ok(DnsResponse { +78 status, +79 tc: message.truncated(), +80 rd: message.recursion_desired(), +81 ra: message.recursion_available(), +82 ad: message.authentic_data(), +83 cd: message.checking_disabled(), +84 question, +85 answer, +86 comment: None, +87 edns_client_subnet: None, +88 }) +89 } +90} +91 +92#[derive(Debug, Serialize, Deserialize)] +93/// JSON representation of a DNS question +94pub struct DohQuestionJson { +95 /// FQDN with trailing dot +96 pub name: String, +97 /// Standard DNS RR type +98 #[serde(rename = "type")] +99 pub question_type: u16, +100} +101 +102impl DohQuestionJson { +103 /// Create a new JSON question from a DNS query +104 pub fn from_query(query: &proto::op::Query) -> Self { +105 Self { +106 name: query.name().to_string(), +107 question_type: query.query_type().into(), +108 } +109 } +110} +111 +112#[derive(Debug, Serialize, Deserialize)] +113/// JSON representation of a DNS record +114pub struct DohRecordJson { +115 /// FQDN with trailing dot +116 pub name: String, +117 /// Standard DNS RR type +118 #[serde(rename = "type")] +119 pub record_type: u16, +120 /// Time-to-live, in seconds +121 #[serde(rename = "TTL")] +122 pub ttl: u32, +123 /// Record data +124 pub data: String, +125} +126 +127impl DohRecordJson { +128 /// Create a new JSON record from a DNS record +129 pub fn from_record(record: &proto::rr::Record) -> Result<Self> { +130 Ok(Self { +131 name: record.name().to_string(), +132 record_type: record.record_type().into(), +133 ttl: record.ttl(), +134 data: record.data().to_string(), +135 }) +136 } +137} \ No newline at end of file diff --git a/pr/3561/docs/src/iroh_dns_server/http/error.rs.html b/pr/3561/docs/src/iroh_dns_server/http/error.rs.html index d659fd42ef..8cef37af80 100644 --- a/pr/3561/docs/src/iroh_dns_server/http/error.rs.html +++ b/pr/3561/docs/src/iroh_dns_server/http/error.rs.html @@ -49,8 +49,8 @@ 49 } 50} 51 -52impl From<n0_snafu::Error> for AppError { -53 fn from(value: n0_snafu::Error) -> Self { +52impl From<n0_error::AnyError> for AppError { +53 fn from(value: n0_error::AnyError) -> Self { 54 Self { 55 status: StatusCode::INTERNAL_SERVER_ERROR, 56 detail: Some(value.to_string()), diff --git a/pr/3561/docs/src/iroh_dns_server/http/tls.rs.html b/pr/3561/docs/src/iroh_dns_server/http/tls.rs.html index 37478ca5c4..5b91fdcb76 100644 --- a/pr/3561/docs/src/iroh_dns_server/http/tls.rs.html +++ b/pr/3561/docs/src/iroh_dns_server/http/tls.rs.html @@ -10,179 +10,178 @@ 10 tls_rustls::{RustlsAcceptor, RustlsConfig}, 11}; 12use n0_future::{FutureExt, future::Boxed as BoxFuture}; -13use n0_snafu::{Result, ResultExt}; +13use n0_error::{Result, StdResultExt, whatever}; 14use serde::{Deserialize, Serialize}; -15use snafu::whatever; -16use tokio::io::{AsyncRead, AsyncWrite}; -17use tokio_rustls_acme::{AcmeConfig, axum::AxumAcceptor, caches::DirCache}; -18use tokio_stream::StreamExt; -19use tracing::{Instrument, debug, error, info_span}; -20 -21/// The mode how SSL certificates should be created. -22#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, strum::Display)] -23#[serde(rename_all = "snake_case")] -24pub enum CertMode { -25 /// Certs are loaded from a the `cert_cache` path -26 Manual, -27 /// ACME with LetsEncrypt servers -28 LetsEncrypt, -29 /// Create self-signed certificates and store them in the `cert_cache` path -30 SelfSigned, -31} -32 -33impl CertMode { -34 /// Build the [`TlsAcceptor`] for this mode. -35 pub(crate) async fn build( -36 &self, -37 domains: Vec<String>, -38 cert_cache: PathBuf, -39 letsencrypt_contact: Option<String>, -40 letsencrypt_prod: bool, -41 ) -> Result<TlsAcceptor> { -42 Ok(match self { -43 CertMode::Manual => TlsAcceptor::manual(domains, cert_cache).await?, -44 CertMode::SelfSigned => TlsAcceptor::self_signed(domains).await?, -45 CertMode::LetsEncrypt => { -46 let contact = -47 letsencrypt_contact.context("contact is required for letsencrypt cert mode")?; -48 TlsAcceptor::letsencrypt(domains, &contact, letsencrypt_prod, cert_cache)? -49 } -50 }) -51 } -52} -53 -54/// TLS Certificate Authority acceptor. -55#[derive(Clone)] -56pub enum TlsAcceptor { -57 LetsEncrypt(AxumAcceptor), -58 Manual(RustlsAcceptor), -59} -60 -61impl<I: AsyncRead + AsyncWrite + Unpin + Send + 'static, S: Send + 'static> Accept<I, S> -62 for TlsAcceptor -63{ -64 type Stream = tokio_rustls::server::TlsStream<I>; -65 type Service = S; -66 type Future = BoxFuture<io::Result<(Self::Stream, Self::Service)>>; -67 -68 fn accept(&self, stream: I, service: S) -> Self::Future { -69 match self { -70 Self::LetsEncrypt(a) => a.accept(stream, service).boxed(), -71 Self::Manual(a) => a.accept(stream, service).boxed(), -72 } -73 } -74} -75 -76impl TlsAcceptor { -77 async fn self_signed(domains: Vec<String>) -> Result<Self> { -78 let rcgen::CertifiedKey { cert, signing_key } = -79 rcgen::generate_simple_self_signed(domains).e()?; -80 let config = RustlsConfig::from_der(vec![cert.der().to_vec()], signing_key.serialize_der()) -81 .await -82 .e()?; -83 let acceptor = RustlsAcceptor::new(config); -84 Ok(Self::Manual(acceptor)) -85 } -86 -87 async fn manual(domains: Vec<String>, dir: PathBuf) -> Result<Self> { -88 let config = rustls::ServerConfig::builder().with_no_client_auth(); -89 if domains.len() != 1 { -90 whatever!("Multiple domains in manual mode are not supported"); -91 } -92 -93 let keyname = escape_hostname(&domains[0]); -94 let cert_path = dir.join(format!("{keyname}.crt")); -95 let key_path = dir.join(format!("{keyname}.key")); -96 -97 let certs = load_certs(cert_path).await?; -98 let secret_key = load_secret_key(key_path).await?; -99 -100 let config = config.with_single_cert(certs, secret_key).e()?; -101 let config = RustlsConfig::from_config(Arc::new(config)); -102 let acceptor = RustlsAcceptor::new(config); -103 Ok(Self::Manual(acceptor)) -104 } -105 -106 fn letsencrypt( -107 domains: Vec<String>, -108 contact: &str, -109 is_production: bool, -110 dir: PathBuf, -111 ) -> Result<Self> { -112 let config = rustls::ServerConfig::builder().with_no_client_auth(); -113 let mut state = AcmeConfig::new(domains) -114 .contact([format!("mailto:{contact}")]) -115 .cache_option(Some(DirCache::new(dir))) -116 .directory_lets_encrypt(is_production) -117 .state(); -118 -119 let config = config.with_cert_resolver(state.resolver()); -120 let acceptor = state.acceptor(); -121 -122 tokio::spawn( -123 async move { -124 loop { -125 match state.next().await.unwrap() { -126 Ok(ok) => debug!("acme event: {:?}", ok), -127 Err(err) => error!("error: {:?}", err), -128 } -129 } -130 } -131 .instrument(info_span!("acme")), -132 ); -133 let config = Arc::new(config); -134 let acceptor = AxumAcceptor::new(acceptor, config); -135 Ok(Self::LetsEncrypt(acceptor)) -136 } -137} -138 -139async fn load_certs( -140 filename: impl AsRef<Path>, -141) -> Result<Vec<rustls::pki_types::CertificateDer<'static>>> { -142 let certfile = tokio::fs::read(filename) -143 .await -144 .context("cannot open certificate file")?; -145 let mut reader = std::io::Cursor::new(certfile); -146 let certs: Result<Vec<_>, std::io::Error> = rustls_pemfile::certs(&mut reader).collect(); -147 let certs = certs.e()?; -148 -149 Ok(certs) -150} -151 -152async fn load_secret_key( -153 filename: impl AsRef<Path>, -154) -> Result<rustls::pki_types::PrivateKeyDer<'static>> { -155 let keyfile = tokio::fs::read(filename.as_ref()) -156 .await -157 .context("cannot open secret key file")?; -158 let mut reader = std::io::Cursor::new(keyfile); -159 -160 loop { -161 match rustls_pemfile::read_one(&mut reader).context("cannot parse secret key .pem file")? { -162 Some(rustls_pemfile::Item::Pkcs1Key(key)) => { -163 return Ok(rustls::pki_types::PrivateKeyDer::Pkcs1(key)); -164 } -165 Some(rustls_pemfile::Item::Pkcs8Key(key)) => { -166 return Ok(rustls::pki_types::PrivateKeyDer::Pkcs8(key)); -167 } -168 Some(rustls_pemfile::Item::Sec1Key(key)) => { -169 return Ok(rustls::pki_types::PrivateKeyDer::Sec1(key)); -170 } -171 None => break, -172 _ => {} -173 } -174 } -175 -176 whatever!( -177 "no keys found in {} (encrypted keys not supported)", -178 filename.as_ref().display() -179 ); -180} -181 -182static UNSAFE_HOSTNAME_CHARACTERS: OnceLock<regex::Regex> = OnceLock::new(); -183 -184fn escape_hostname(hostname: &str) -> Cow<'_, str> { -185 let regex = UNSAFE_HOSTNAME_CHARACTERS -186 .get_or_init(|| regex::Regex::new(r"[^a-zA-Z0-9-\.]").expect("valid regex")); -187 regex.replace_all(hostname, "") -188} \ No newline at end of file +15use tokio::io::{AsyncRead, AsyncWrite}; +16use tokio_rustls_acme::{AcmeConfig, axum::AxumAcceptor, caches::DirCache}; +17use tokio_stream::StreamExt; +18use tracing::{Instrument, debug, error, info_span}; +19 +20/// The mode how SSL certificates should be created. +21#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, strum::Display)] +22#[serde(rename_all = "snake_case")] +23pub enum CertMode { +24 /// Certs are loaded from a the `cert_cache` path +25 Manual, +26 /// ACME with LetsEncrypt servers +27 LetsEncrypt, +28 /// Create self-signed certificates and store them in the `cert_cache` path +29 SelfSigned, +30} +31 +32impl CertMode { +33 /// Build the [`TlsAcceptor`] for this mode. +34 pub(crate) async fn build( +35 &self, +36 domains: Vec<String>, +37 cert_cache: PathBuf, +38 letsencrypt_contact: Option<String>, +39 letsencrypt_prod: bool, +40 ) -> Result<TlsAcceptor> { +41 Ok(match self { +42 CertMode::Manual => TlsAcceptor::manual(domains, cert_cache).await?, +43 CertMode::SelfSigned => TlsAcceptor::self_signed(domains).await?, +44 CertMode::LetsEncrypt => { +45 let contact = letsencrypt_contact +46 .std_context("contact is required for letsencrypt cert mode")?; +47 TlsAcceptor::letsencrypt(domains, &contact, letsencrypt_prod, cert_cache)? +48 } +49 }) +50 } +51} +52 +53/// TLS Certificate Authority acceptor. +54#[derive(Clone)] +55pub enum TlsAcceptor { +56 LetsEncrypt(AxumAcceptor), +57 Manual(RustlsAcceptor), +58} +59 +60impl<I: AsyncRead + AsyncWrite + Unpin + Send + 'static, S: Send + 'static> Accept<I, S> +61 for TlsAcceptor +62{ +63 type Stream = tokio_rustls::server::TlsStream<I>; +64 type Service = S; +65 type Future = BoxFuture<io::Result<(Self::Stream, Self::Service)>>; +66 +67 fn accept(&self, stream: I, service: S) -> Self::Future { +68 match self { +69 Self::LetsEncrypt(a) => a.accept(stream, service).boxed(), +70 Self::Manual(a) => a.accept(stream, service).boxed(), +71 } +72 } +73} +74 +75impl TlsAcceptor { +76 async fn self_signed(domains: Vec<String>) -> Result<Self> { +77 let rcgen::CertifiedKey { cert, signing_key } = +78 rcgen::generate_simple_self_signed(domains).e()?; +79 let config = RustlsConfig::from_der(vec![cert.der().to_vec()], signing_key.serialize_der()) +80 .await +81 .e()?; +82 let acceptor = RustlsAcceptor::new(config); +83 Ok(Self::Manual(acceptor)) +84 } +85 +86 async fn manual(domains: Vec<String>, dir: PathBuf) -> Result<Self> { +87 let config = rustls::ServerConfig::builder().with_no_client_auth(); +88 if domains.len() != 1 { +89 whatever!("Multiple domains in manual mode are not supported"); +90 } +91 +92 let keyname = escape_hostname(&domains[0]); +93 let cert_path = dir.join(format!("{keyname}.crt")); +94 let key_path = dir.join(format!("{keyname}.key")); +95 +96 let certs = load_certs(cert_path).await?; +97 let secret_key = load_secret_key(key_path).await?; +98 +99 let config = config.with_single_cert(certs, secret_key).e()?; +100 let config = RustlsConfig::from_config(Arc::new(config)); +101 let acceptor = RustlsAcceptor::new(config); +102 Ok(Self::Manual(acceptor)) +103 } +104 +105 fn letsencrypt( +106 domains: Vec<String>, +107 contact: &str, +108 is_production: bool, +109 dir: PathBuf, +110 ) -> Result<Self> { +111 let config = rustls::ServerConfig::builder().with_no_client_auth(); +112 let mut state = AcmeConfig::new(domains) +113 .contact([format!("mailto:{contact}")]) +114 .cache_option(Some(DirCache::new(dir))) +115 .directory_lets_encrypt(is_production) +116 .state(); +117 +118 let config = config.with_cert_resolver(state.resolver()); +119 let acceptor = state.acceptor(); +120 +121 tokio::spawn( +122 async move { +123 loop { +124 match state.next().await.unwrap() { +125 Ok(ok) => debug!("acme event: {:?}", ok), +126 Err(err) => error!("error: {:?}", err), +127 } +128 } +129 } +130 .instrument(info_span!("acme")), +131 ); +132 let config = Arc::new(config); +133 let acceptor = AxumAcceptor::new(acceptor, config); +134 Ok(Self::LetsEncrypt(acceptor)) +135 } +136} +137 +138async fn load_certs( +139 filename: impl AsRef<Path>, +140) -> Result<Vec<rustls::pki_types::CertificateDer<'static>>> { +141 let certfile = tokio::fs::read(filename) +142 .await +143 .std_context("cannot open certificate file")?; +144 let mut reader = std::io::Cursor::new(certfile); +145 let certs: Result<Vec<_>, std::io::Error> = rustls_pemfile::certs(&mut reader).collect(); +146 let certs = certs.e()?; +147 +148 Ok(certs) +149} +150 +151async fn load_secret_key( +152 filename: impl AsRef<Path>, +153) -> Result<rustls::pki_types::PrivateKeyDer<'static>> { +154 let keyfile = tokio::fs::read(filename.as_ref()) +155 .await +156 .std_context("cannot open secret key file")?; +157 let mut reader = std::io::Cursor::new(keyfile); +158 +159 loop { +160 match rustls_pemfile::read_one(&mut reader).std_context("cannot parse secret key .pem file")? { +161 Some(rustls_pemfile::Item::Pkcs1Key(key)) => { +162 return Ok(rustls::pki_types::PrivateKeyDer::Pkcs1(key)); +163 } +164 Some(rustls_pemfile::Item::Pkcs8Key(key)) => { +165 return Ok(rustls::pki_types::PrivateKeyDer::Pkcs8(key)); +166 } +167 Some(rustls_pemfile::Item::Sec1Key(key)) => { +168 return Ok(rustls::pki_types::PrivateKeyDer::Sec1(key)); +169 } +170 None => break, +171 _ => {} +172 } +173 } +174 +175 whatever!( +176 "no keys found in {} (encrypted keys not supported)", +177 filename.as_ref().display() +178 ); +179} +180 +181static UNSAFE_HOSTNAME_CHARACTERS: OnceLock<regex::Regex> = OnceLock::new(); +182 +183fn escape_hostname(hostname: &str) -> Cow<'_, str> { +184 let regex = UNSAFE_HOSTNAME_CHARACTERS +185 .get_or_init(|| regex::Regex::new(r"[^a-zA-Z0-9-\.]").expect("valid regex")); +186 regex.replace_all(hostname, "") +187} \ No newline at end of file diff --git a/pr/3561/docs/src/iroh_dns_server/lib.rs.html b/pr/3561/docs/src/iroh_dns_server/lib.rs.html index c3b70f9da7..d2acbdb84d 100644 --- a/pr/3561/docs/src/iroh_dns_server/lib.rs.html +++ b/pr/3561/docs/src/iroh_dns_server/lib.rs.html @@ -25,7 +25,7 @@ 25 RelayUrl, SecretKey, discovery::pkarr::PkarrRelayClient, dns::DnsResolver, 26 endpoint_info::EndpointInfo, 27 }; -28 use n0_snafu::{Result, ResultExt}; +28 use n0_error::{Result, StdResultExt}; 29 use pkarr::{SignedPacket, Timestamp}; 30 use rand::{CryptoRng, SeedableRng}; 31 use tracing_test::traced_test; @@ -43,7 +43,7 @@ 43 #[tokio::test] 44 #[traced_test] 45 async fn pkarr_publish_dns_resolve() -> Result { -46 let (server, nameserver, http_url) = Server::spawn_for_tests().await?; +46 let (server, nameserver, http_url) = Server::spawn_for_tests().await.e()?; 47 let pkarr_relay_url = { 48 let mut url = http_url.clone(); 49 url.set_path("/pkarr"); @@ -158,7 +158,7 @@ 158 #[tokio::test] 159 #[traced_test] 160 async fn integration_smoke() -> Result { -161 let (server, nameserver, http_url) = Server::spawn_for_tests().await?; +161 let (server, nameserver, http_url) = Server::spawn_for_tests().await.e()?; 162 163 let pkarr_relay = { 164 let mut url = http_url.clone(); @@ -200,7 +200,7 @@ 200 max_batch_time: Duration::from_millis(100), 201 ..Default::default() 202 }; -203 let store = ZoneStore::in_memory(options, Default::default())?; +203 let store = ZoneStore::in_memory(options, Default::default()).e()?; 204 205 // create a signed packet 206 let signed_packet = random_signed_packet(&mut rng)?; @@ -208,71 +208,76 @@ 208 209 store 210 .insert(signed_packet, PacketSource::PkarrPublish) -211 .await?; -212 -213 tokio::time::sleep(Duration::from_secs(1)).await; -214 for _ in 0..10 { -215 let entry = store.get_signed_packet(&key).await?; -216 if entry.is_none() { -217 return Ok(()); -218 } -219 tokio::time::sleep(Duration::from_secs(1)).await; -220 } -221 panic!("store did not evict packet"); -222 } -223 -224 #[tokio::test] -225 #[traced_test] -226 async fn integration_mainline() -> Result { -227 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); -228 -229 // run a mainline testnet -230 let testnet = pkarr::mainline::Testnet::new_async(5).await.e()?; -231 let bootstrap = testnet.bootstrap.clone(); -232 -233 // spawn our server with mainline support -234 let (server, nameserver, _http_url) = -235 Server::spawn_for_tests_with_options(Some(BootstrapOption::Custom(bootstrap)), None) -236 .await?; -237 -238 let origin = "irohdns.example."; +211 .await +212 .e()?; +213 +214 tokio::time::sleep(Duration::from_secs(1)).await; +215 for _ in 0..10 { +216 let entry = store.get_signed_packet(&key).await.e()?; +217 if entry.is_none() { +218 return Ok(()); +219 } +220 tokio::time::sleep(Duration::from_secs(1)).await; +221 } +222 panic!("store did not evict packet"); +223 } +224 +225 #[tokio::test] +226 #[traced_test] +227 async fn integration_mainline() -> Result { +228 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); +229 +230 // run a mainline testnet +231 let testnet = pkarr::mainline::Testnet::new_async(5).await.e()?; +232 let bootstrap = testnet.bootstrap.clone(); +233 +234 // spawn our server with mainline support +235 let (server, nameserver, _http_url) = +236 Server::spawn_for_tests_with_options(Some(BootstrapOption::Custom(bootstrap)), None) +237 .await +238 .e()?; 239 -240 // create a signed packet -241 let secret_key = SecretKey::generate(&mut rng); -242 let endpoint_id = secret_key.public(); -243 let relay_url: RelayUrl = "https://relay.example.".parse()?; -244 let endpoint_info = EndpointInfo::new(endpoint_id).with_relay_url(Some(relay_url.clone())); -245 let signed_packet = endpoint_info.to_pkarr_signed_packet(&secret_key, 30)?; -246 -247 // publish the signed packet to our DHT -248 let pkarr = pkarr::Client::builder() -249 .no_default_network() -250 .dht(|builder| builder.bootstrap(&testnet.bootstrap)) -251 .build() -252 .e()?; -253 pkarr.publish(&signed_packet, None).await.e()?; -254 -255 // resolve via DNS from our server, which will lookup from our DHT -256 let resolver = test_resolver(nameserver); -257 let res = resolver.lookup_endpoint_by_id(&endpoint_id, origin).await?; -258 -259 assert_eq!(res.endpoint_id, endpoint_id); -260 assert_eq!(res.relay_url(), Some(&relay_url)); -261 -262 server.shutdown().await?; -263 Ok(()) -264 } -265 -266 fn test_resolver(nameserver: SocketAddr) -> DnsResolver { -267 DnsResolver::with_nameserver(nameserver) -268 } -269 -270 fn random_signed_packet<R: CryptoRng + ?Sized>(rng: &mut R) -> Result<SignedPacket> { -271 let secret_key = SecretKey::generate(rng); -272 let endpoint_id = secret_key.public(); -273 let relay_url: RelayUrl = "https://relay.example.".parse()?; -274 let endpoint_info = EndpointInfo::new(endpoint_id).with_relay_url(Some(relay_url.clone())); -275 let packet = endpoint_info.to_pkarr_signed_packet(&secret_key, 30)?; -276 Ok(packet) -277 } -278} \ No newline at end of file +240 let origin = "irohdns.example."; +241 +242 // create a signed packet +243 let secret_key = SecretKey::generate(&mut rng); +244 let endpoint_id = secret_key.public(); +245 let relay_url: RelayUrl = "https://relay.example.".parse()?; +246 let endpoint_info = EndpointInfo::new(endpoint_id).with_relay_url(Some(relay_url.clone())); +247 let signed_packet = endpoint_info.to_pkarr_signed_packet(&secret_key, 30)?; +248 +249 // publish the signed packet to our DHT +250 let pkarr = pkarr::Client::builder() +251 .no_default_network() +252 .dht(|builder| builder.bootstrap(&testnet.bootstrap)) +253 .build() +254 .e()?; +255 pkarr.publish(&signed_packet, None).await.e()?; +256 +257 // resolve via DNS from our server, which will lookup from our DHT +258 let resolver = test_resolver(nameserver); +259 let res = resolver +260 .lookup_endpoint_by_id(&endpoint_id, origin) +261 .await +262 .e()?; +263 +264 assert_eq!(res.endpoint_id, endpoint_id); +265 assert_eq!(res.relay_url(), Some(&relay_url)); +266 +267 server.shutdown().await.e()?; +268 Ok(()) +269 } +270 +271 fn test_resolver(nameserver: SocketAddr) -> DnsResolver { +272 DnsResolver::with_nameserver(nameserver) +273 } +274 +275 fn random_signed_packet<R: CryptoRng + ?Sized>(rng: &mut R) -> Result<SignedPacket> { +276 let secret_key = SecretKey::generate(rng); +277 let endpoint_id = secret_key.public(); +278 let relay_url: RelayUrl = "https://relay.example.".parse()?; +279 let endpoint_info = EndpointInfo::new(endpoint_id).with_relay_url(Some(relay_url.clone())); +280 let packet = endpoint_info.to_pkarr_signed_packet(&secret_key, 30)?; +281 Ok(packet) +282 } +283} \ No newline at end of file diff --git a/pr/3561/docs/src/iroh_dns_server/server.rs.html b/pr/3561/docs/src/iroh_dns_server/server.rs.html index bbda7c9450..5f492621aa 100644 --- a/pr/3561/docs/src/iroh_dns_server/server.rs.html +++ b/pr/3561/docs/src/iroh_dns_server/server.rs.html @@ -2,7 +2,7 @@ 2use std::sync::Arc; 3 4use iroh_metrics::service::start_metrics_server; -5use n0_snafu::{Result, ResultExt}; +5use n0_error::{Result, StdResultExt, StackResultExt}; 6use tracing::info; 7 8use crate::{ diff --git a/pr/3561/docs/src/iroh_dns_server/store.rs.html b/pr/3561/docs/src/iroh_dns_server/store.rs.html index 33aa8bb1bd..7f298f95fe 100644 --- a/pr/3561/docs/src/iroh_dns_server/store.rs.html +++ b/pr/3561/docs/src/iroh_dns_server/store.rs.html @@ -4,7 +4,7 @@ 4 5use hickory_server::proto::rr::{Name, RecordSet, RecordType, RrKey}; 6use lru::LruCache; -7use n0_snafu::Result; +7use n0_error::Result; 8use pkarr::{Client as PkarrClient, SignedPacket}; 9use tokio::sync::Mutex; 10use tracing::{debug, trace, warn}; diff --git a/pr/3561/docs/src/iroh_dns_server/store/signed_packets.rs.html b/pr/3561/docs/src/iroh_dns_server/store/signed_packets.rs.html index 6648adbf0d..0f26b3fd84 100644 --- a/pr/3561/docs/src/iroh_dns_server/store/signed_packets.rs.html +++ b/pr/3561/docs/src/iroh_dns_server/store/signed_packets.rs.html @@ -6,7 +6,7 @@ 6 time::{Duration, SystemTime}, 7}; 8 -9use n0_snafu::{Result, ResultExt, format_err}; +9use n0_error::{Result, StdResultExt, StackResultExt, format_err}; 10use pkarr::{SignedPacket, Timestamp}; 11use redb::{ 12 Database, MultimapTableDefinition, ReadableTable, TableDefinition, backends::InMemoryBackend, @@ -144,10 +144,10 @@ 144 }, 145 Err(err) => { 146 warn!("get {key} failed: {err:#}"); -147 return Err(err).with_context(|| format!("get packet for {key} failed")) -148 } -149 } -150 } +147 return Err(err).std_context(format!("get packet for {key} failed")) +148 } +149 } +150 } 151 Message::Upsert { packet, res } => { 152 let key = PublicKeyBytes::from_signed_packet(&packet); 153 trace!("upsert {}", key); @@ -265,250 +265,251 @@ 265 let path = path.as_ref(); 266 info!("loading packet database from {}", path.to_string_lossy()); 267 if let Some(parent) = path.parent() { -268 std::fs::create_dir_all(parent).with_context(|| { -269 format!( -270 "failed to create database directory at {}", -271 path.to_string_lossy() -272 ) -273 })?; -274 } -275 let mut db = Database::builder() -276 .create(path) -277 .context("failed to open packet database")?; -278 match db.upgrade() { -279 Ok(true) => info!("Database was upgraded to redb v3 compatible format"), -280 Ok(false) => {} -281 Err(err) => warn!("Database upgrade to redb v3 compatible format failed: {err:#}"), -282 } -283 Self::open(db, options, metrics) -284 } -285 -286 pub fn in_memory(options: Options, metrics: Arc<Metrics>) -> Result<Self> { -287 info!("using in-memory packet database"); -288 let db = Database::builder() -289 .create_with_backend(InMemoryBackend::new()) -290 .e()?; -291 Self::open(db, options, metrics) -292 } -293 -294 pub fn open(db: Database, options: Options, metrics: Arc<Metrics>) -> Result<Self> { -295 // create tables -296 let write_tx = db.begin_write().e()?; -297 let _ = Tables::new(&write_tx).e()?; -298 write_tx.commit().e()?; -299 let (send, recv) = mpsc::channel(1024); -300 let send2 = send.clone(); -301 let cancel = CancellationToken::new(); -302 let cancel2 = cancel.clone(); -303 let cancel3 = cancel.clone(); -304 let actor = Actor { -305 db, -306 recv: PeekableReceiver::new(recv), -307 cancel: cancel2, -308 options, -309 metrics, -310 }; -311 // start an io thread and donate it to the tokio runtime so we can do blocking IO -312 // inside the thread despite being in a tokio runtime -313 let _write_thread = IoThread::new("packet-store-actor", move || actor.run())?; -314 let _evict_thread = IoThread::new("packet-store-evict", move || { -315 evict_task(send2, options, cancel3) -316 })?; -317 Ok(Self { -318 send, -319 cancel, -320 _write_thread, -321 _evict_thread, -322 }) -323 } -324 -325 pub async fn upsert(&self, packet: SignedPacket) -> Result<bool> { -326 let (tx, rx) = oneshot::channel(); -327 self.send -328 .send(Message::Upsert { packet, res: tx }) -329 .await -330 .e()?; -331 rx.await.e() -332 } -333 -334 pub async fn get(&self, key: &PublicKeyBytes) -> Result<Option<SignedPacket>> { -335 let (tx, rx) = oneshot::channel(); -336 self.send -337 .send(Message::Get { key: *key, res: tx }) -338 .await -339 .e()?; -340 rx.await.e() -341 } -342 -343 pub async fn remove(&self, key: &PublicKeyBytes) -> Result<bool> { -344 let (tx, rx) = oneshot::channel(); -345 self.send -346 .send(Message::Remove { key: *key, res: tx }) -347 .await -348 .e()?; -349 rx.await.e() -350 } -351} -352 -353fn get_packet( -354 table: &impl ReadableTable<&'static SignedPacketsKey, &'static [u8]>, -355 key: &PublicKeyBytes, -356) -> Result<Option<SignedPacket>> { -357 let Some(row) = table.get(key.as_ref()).context("database fetch failed")? else { -358 return Ok(None); -359 }; -360 match SignedPacket::deserialize(row.value()) { -361 Ok(packet) => Ok(Some(packet)), -362 Err(err) => { -363 // Prior to iroh-dns-server v0.35, we stored packets in the default `SignedPacket::as_bytes` serialization from pkarr v2, -364 // which did not include the `last_seen` timestamp added as a prefix in `SignedPacket::serialize` from pkarr v3. -365 // If decoding the packet as a serialized pkarr v3 packet fails, we assume it was stored with iroh-dns-server before v0.35, -366 // and prepend an empty timestamp. -367 let data = row.value(); -368 let mut buf = Vec::with_capacity(data.len() + 8); -369 buf.extend(&[0u8; 8]); -370 buf.extend(data); -371 match SignedPacket::deserialize(&buf) { -372 Ok(packet) => Ok(Some(packet)), -373 Err(err2) => Err(format_err!( -374 "Failed to decode as pkarr v3: {err:#}. Also failed to decode as pkarr v2: {err2:#}" -375 )), -376 } -377 } -378 } -379} -380 -381async fn evict_task(send: mpsc::Sender<Message>, options: Options, cancel: CancellationToken) { -382 let cancel2 = cancel.clone(); -383 let _ = cancel2 -384 .run_until_cancelled(async move { -385 info!("starting evict task"); -386 if let Err(cause) = evict_task_inner(send, options).await { -387 error!("evict task failed: {:?}", cause); -388 } -389 // when we are done for whatever reason we want to shut down the actor -390 cancel.cancel(); -391 }) -392 .await; -393} -394 -395/// Periodically check for expired packets and remove them. -396async fn evict_task_inner(send: mpsc::Sender<Message>, options: Options) -> Result<()> { -397 let expiry_us = options.eviction.as_micros() as u64; -398 loop { -399 let (tx, rx) = oneshot::channel(); -400 let _ = send.send(Message::Snapshot { res: tx }).await.ok(); -401 // if we can't get the snapshot we exit the loop, main actor dead -402 let snapshot = rx.await.context("failed to get snapshot")?; -403 -404 let expired = Timestamp::now() - expiry_us; -405 trace!("evicting packets older than {}", fmt_time(expired)); -406 // if getting the range fails we exit the loop and shut down -407 // if individual reads fail we log the error and limp on -408 for item in snapshot.update_time.range(..expired.to_bytes()).e()? { -409 let (time, keys) = match item { -410 Ok(v) => v, -411 Err(e) => { -412 error!("failed to read update_time row {:?}", e); -413 continue; -414 } -415 }; -416 let time = Timestamp::from(time.value()); -417 trace!("evicting expired packets at {}", fmt_time(time)); -418 for item in keys { -419 let key = match item { -420 Ok(v) => v, -421 Err(e) => { -422 error!( -423 "failed to read update_time item at {}: {:?}", -424 fmt_time(time), -425 e -426 ); -427 continue; -428 } -429 }; -430 let key = PublicKeyBytes::new(key.value()); -431 -432 debug!("evicting expired packet {} {}", fmt_time(time), key); -433 send.send(Message::CheckExpired { time, key }).await.e()?; -434 } -435 } -436 // sleep for the eviction interval so we don't constantly check -437 tokio::time::sleep(options.eviction_interval).await; -438 } -439} -440 -441/// An io thread that drives a future to completion on the current tokio runtime -442/// -443/// Inside the future, blocking IO can be done without blocking one of the tokio -444/// pool threads. -445#[derive(Debug)] -446struct IoThread { -447 handle: Option<std::thread::JoinHandle<()>>, -448} -449 -450impl IoThread { -451 /// Spawn a new io thread. -452 /// -453 /// Calling this function requires that the current thread is running in a -454 /// tokio runtime. It is up to the caller to make sure the future exits, -455 /// e.g. by using a cancellation token. Otherwise, drop will block. -456 fn new<F, Fut>(name: &str, f: F) -> Result<Self> -457 where -458 F: FnOnce() -> Fut + Send + 'static, -459 Fut: Future<Output = ()>, -460 { -461 let rt = tokio::runtime::Handle::try_current().context("get tokio handle")?; -462 let handle = std::thread::Builder::new() -463 .name(name.into()) -464 .spawn(move || rt.block_on(f())) -465 .context("failed to spawn thread")?; -466 Ok(Self { -467 handle: Some(handle), -468 }) -469 } -470} -471 -472impl Drop for IoThread { -473 fn drop(&mut self) { -474 if let Some(handle) = self.handle.take() { -475 let _ = handle.join(); -476 } -477 } -478} -479 -480/// A wrapper for a tokio mpsc receiver that allows peeking at the next message. -481#[derive(Debug)] -482pub(super) struct PeekableReceiver<T> { -483 msg: Option<T>, -484 recv: tokio::sync::mpsc::Receiver<T>, -485} -486 -487#[allow(dead_code)] -488impl<T> PeekableReceiver<T> { -489 pub fn new(recv: tokio::sync::mpsc::Receiver<T>) -> Self { -490 Self { msg: None, recv } -491 } -492 -493 /// Receive the next message. -494 /// -495 /// Will block if there are no messages. -496 /// Returns None only if there are no more messages (sender is dropped). -497 pub async fn recv(&mut self) -> Option<T> { -498 if let Some(msg) = self.msg.take() { -499 return Some(msg); -500 } -501 self.recv.recv().await -502 } -503 -504 /// Push back a message. This will only work if there is room for it. -505 /// Otherwise, it will fail and return the message. -506 pub fn push_back(&mut self, msg: T) -> std::result::Result<(), T> { -507 if self.msg.is_none() { -508 self.msg = Some(msg); -509 Ok(()) -510 } else { -511 Err(msg) -512 } -513 } -514} \ No newline at end of file +268 std::fs::create_dir_all(parent).std_context(format!( +269 "failed to create database directory at {}", +270 path.to_string_lossy() +271 ))?; +272 } +273 let mut db = Database::builder() +274 .create(path) +275 .std_context("failed to open packet database")?; +276 match db.upgrade() { +277 Ok(true) => info!("Database was upgraded to redb v3 compatible format"), +278 Ok(false) => {} +279 Err(err) => warn!("Database upgrade to redb v3 compatible format failed: {err:#}"), +280 } +281 Self::open(db, options, metrics) +282 } +283 +284 pub fn in_memory(options: Options, metrics: Arc<Metrics>) -> Result<Self> { +285 info!("using in-memory packet database"); +286 let db = Database::builder() +287 .create_with_backend(InMemoryBackend::new()) +288 .e()?; +289 Self::open(db, options, metrics) +290 } +291 +292 pub fn open(db: Database, options: Options, metrics: Arc<Metrics>) -> Result<Self> { +293 // create tables +294 let write_tx = db.begin_write().e()?; +295 let _ = Tables::new(&write_tx).e()?; +296 write_tx.commit().e()?; +297 let (send, recv) = mpsc::channel(1024); +298 let send2 = send.clone(); +299 let cancel = CancellationToken::new(); +300 let cancel2 = cancel.clone(); +301 let cancel3 = cancel.clone(); +302 let actor = Actor { +303 db, +304 recv: PeekableReceiver::new(recv), +305 cancel: cancel2, +306 options, +307 metrics, +308 }; +309 // start an io thread and donate it to the tokio runtime so we can do blocking IO +310 // inside the thread despite being in a tokio runtime +311 let _write_thread = IoThread::new("packet-store-actor", move || actor.run())?; +312 let _evict_thread = IoThread::new("packet-store-evict", move || { +313 evict_task(send2, options, cancel3) +314 })?; +315 Ok(Self { +316 send, +317 cancel, +318 _write_thread, +319 _evict_thread, +320 }) +321 } +322 +323 pub async fn upsert(&self, packet: SignedPacket) -> Result<bool> { +324 let (tx, rx) = oneshot::channel(); +325 self.send +326 .send(Message::Upsert { packet, res: tx }) +327 .await +328 .e()?; +329 rx.await.e() +330 } +331 +332 pub async fn get(&self, key: &PublicKeyBytes) -> Result<Option<SignedPacket>> { +333 let (tx, rx) = oneshot::channel(); +334 self.send +335 .send(Message::Get { key: *key, res: tx }) +336 .await +337 .e()?; +338 rx.await.e() +339 } +340 +341 pub async fn remove(&self, key: &PublicKeyBytes) -> Result<bool> { +342 let (tx, rx) = oneshot::channel(); +343 self.send +344 .send(Message::Remove { key: *key, res: tx }) +345 .await +346 .e()?; +347 rx.await.e() +348 } +349} +350 +351fn get_packet( +352 table: &impl ReadableTable<&'static SignedPacketsKey, &'static [u8]>, +353 key: &PublicKeyBytes, +354) -> Result<Option<SignedPacket>> { +355 let Some(row) = table +356 .get(key.as_ref()) +357 .std_context("database fetch failed")? +358 else { +359 return Ok(None); +360 }; +361 match SignedPacket::deserialize(row.value()) { +362 Ok(packet) => Ok(Some(packet)), +363 Err(err) => { +364 // Prior to iroh-dns-server v0.35, we stored packets in the default `SignedPacket::as_bytes` serialization from pkarr v2, +365 // which did not include the `last_seen` timestamp added as a prefix in `SignedPacket::serialize` from pkarr v3. +366 // If decoding the packet as a serialized pkarr v3 packet fails, we assume it was stored with iroh-dns-server before v0.35, +367 // and prepend an empty timestamp. +368 let data = row.value(); +369 let mut buf = Vec::with_capacity(data.len() + 8); +370 buf.extend(&[0u8; 8]); +371 buf.extend(data); +372 match SignedPacket::deserialize(&buf) { +373 Ok(packet) => Ok(Some(packet)), +374 Err(err2) => Err(format_err!( +375 "Failed to decode as pkarr v3: {err:#}. Also failed to decode as pkarr v2: {err2:#}" +376 )), +377 } +378 } +379 } +380} +381 +382async fn evict_task(send: mpsc::Sender<Message>, options: Options, cancel: CancellationToken) { +383 let cancel2 = cancel.clone(); +384 let _ = cancel2 +385 .run_until_cancelled(async move { +386 info!("starting evict task"); +387 if let Err(cause) = evict_task_inner(send, options).await { +388 error!("evict task failed: {:?}", cause); +389 } +390 // when we are done for whatever reason we want to shut down the actor +391 cancel.cancel(); +392 }) +393 .await; +394} +395 +396/// Periodically check for expired packets and remove them. +397async fn evict_task_inner(send: mpsc::Sender<Message>, options: Options) -> Result<()> { +398 let expiry_us = options.eviction.as_micros() as u64; +399 loop { +400 let (tx, rx) = oneshot::channel(); +401 let _ = send.send(Message::Snapshot { res: tx }).await.ok(); +402 // if we can't get the snapshot we exit the loop, main actor dead +403 let snapshot = rx.await.std_context("failed to get snapshot")?; +404 +405 let expired = Timestamp::now() - expiry_us; +406 trace!("evicting packets older than {}", fmt_time(expired)); +407 // if getting the range fails we exit the loop and shut down +408 // if individual reads fail we log the error and limp on +409 for item in snapshot.update_time.range(..expired.to_bytes()).e()? { +410 let (time, keys) = match item { +411 Ok(v) => v, +412 Err(e) => { +413 error!("failed to read update_time row {:?}", e); +414 continue; +415 } +416 }; +417 let time = Timestamp::from(time.value()); +418 trace!("evicting expired packets at {}", fmt_time(time)); +419 for item in keys { +420 let key = match item { +421 Ok(v) => v, +422 Err(e) => { +423 error!( +424 "failed to read update_time item at {}: {:?}", +425 fmt_time(time), +426 e +427 ); +428 continue; +429 } +430 }; +431 let key = PublicKeyBytes::new(key.value()); +432 +433 debug!("evicting expired packet {} {}", fmt_time(time), key); +434 send.send(Message::CheckExpired { time, key }).await.e()?; +435 } +436 } +437 // sleep for the eviction interval so we don't constantly check +438 tokio::time::sleep(options.eviction_interval).await; +439 } +440} +441 +442/// An io thread that drives a future to completion on the current tokio runtime +443/// +444/// Inside the future, blocking IO can be done without blocking one of the tokio +445/// pool threads. +446#[derive(Debug)] +447struct IoThread { +448 handle: Option<std::thread::JoinHandle<()>>, +449} +450 +451impl IoThread { +452 /// Spawn a new io thread. +453 /// +454 /// Calling this function requires that the current thread is running in a +455 /// tokio runtime. It is up to the caller to make sure the future exits, +456 /// e.g. by using a cancellation token. Otherwise, drop will block. +457 fn new<F, Fut>(name: &str, f: F) -> Result<Self> +458 where +459 F: FnOnce() -> Fut + Send + 'static, +460 Fut: Future<Output = ()>, +461 { +462 let rt = tokio::runtime::Handle::try_current().std_context("get tokio handle")?; +463 let handle = std::thread::Builder::new() +464 .name(name.into()) +465 .spawn(move || rt.block_on(f())) +466 .std_context("failed to spawn thread")?; +467 Ok(Self { +468 handle: Some(handle), +469 }) +470 } +471} +472 +473impl Drop for IoThread { +474 fn drop(&mut self) { +475 if let Some(handle) = self.handle.take() { +476 let _ = handle.join(); +477 } +478 } +479} +480 +481/// A wrapper for a tokio mpsc receiver that allows peeking at the next message. +482#[derive(Debug)] +483pub(super) struct PeekableReceiver<T> { +484 msg: Option<T>, +485 recv: tokio::sync::mpsc::Receiver<T>, +486} +487 +488#[allow(dead_code)] +489impl<T> PeekableReceiver<T> { +490 pub fn new(recv: tokio::sync::mpsc::Receiver<T>) -> Self { +491 Self { msg: None, recv } +492 } +493 +494 /// Receive the next message. +495 /// +496 /// Will block if there are no messages. +497 /// Returns None only if there are no more messages (sender is dropped). +498 pub async fn recv(&mut self) -> Option<T> { +499 if let Some(msg) = self.msg.take() { +500 return Some(msg); +501 } +502 self.recv.recv().await +503 } +504 +505 /// Push back a message. This will only work if there is room for it. +506 /// Otherwise, it will fail and return the message. +507 pub fn push_back(&mut self, msg: T) -> std::result::Result<(), T> { +508 if self.msg.is_none() { +509 self.msg = Some(msg); +510 Ok(()) +511 } else { +512 Err(msg) +513 } +514 } +515} \ No newline at end of file diff --git a/pr/3561/docs/src/iroh_dns_server/util.rs.html b/pr/3561/docs/src/iroh_dns_server/util.rs.html index c13bddd2b8..479fed35be 100644 --- a/pr/3561/docs/src/iroh_dns_server/util.rs.html +++ b/pr/3561/docs/src/iroh_dns_server/util.rs.html @@ -13,7 +13,7 @@ 13 }, 14 serialize::binary::BinDecodable, 15}; -16use n0_snafu::{Error, Result, ResultExt}; +16use n0_error::{AnyError, Result, StdResultExt}; 17use pkarr::SignedPacket; 18 19#[derive( @@ -28,7 +28,7 @@ 28 29 pub fn from_z32(s: &str) -> Result<Self> { 30 let bytes = z32::decode(s.as_bytes()).e()?; -31 let bytes = TryInto::<[u8; 32]>::try_into(&bytes[..]).context("invalid length")?; +31 let bytes = TryInto::<[u8; 32]>::try_into(&bytes[..]).std_context("invalid length")?; 32 Ok(Self(bytes)) 33 } 34 @@ -68,14 +68,14 @@ 68} 69 70impl TryFrom<PublicKeyBytes> for pkarr::PublicKey { -71 type Error = Error; +71 type Error = AnyError; 72 fn try_from(value: PublicKeyBytes) -> Result<Self, Self::Error> { 73 pkarr::PublicKey::try_from(&value.0).e() 74 } 75} 76 77impl FromStr for PublicKeyBytes { -78 type Err = Error; +78 type Err = AnyError; 79 fn from_str(s: &str) -> Result<Self, Self::Err> { 80 Self::from_z32(s) 81 } diff --git a/pr/3561/docs/src/iroh_relay/server/client.rs.html b/pr/3561/docs/src/iroh_relay/server/client.rs.html index 73c5f73f70..0f2029d31e 100644 --- a/pr/3561/docs/src/iroh_relay/server/client.rs.html +++ b/pr/3561/docs/src/iroh_relay/server/client.rs.html @@ -325,431 +325,434 @@ 325 break; 326 } 327 maybe_frame = self.stream.next() => { -328 self.handle_frame(maybe_frame).await?; -329 // reset the ping interval, we just received a message -330 ping_interval.reset(); -331 } -332 // First priority, disco packets -333 packet = self.disco_send_queue.recv() => { -334 let packet = packet.ok_or_else(|| e!(RunError::DiscoSendQueuePacketDrop))?; -335 self.send_disco_packet(packet).await -336 .map_err(|err| e!(RunError::DiscoPacketSend, err))?; -337 } -338 // Second priority, sending regular packets -339 packet = self.send_queue.recv() => { -340 let packet = packet.ok_or_else(|| e!(RunError::SendQueuePacketDrop))?; -341 self.send_packet(packet).await -342 .map_err(|err| e!(RunError::PacketSend, err))?; -343 } -344 // Last priority, sending left endpoints -345 endpoint_id = self.endpoint_gone.recv() => { -346 let endpoint_id = endpoint_id.ok_or_else(|| e!(RunError::EndpointGoneDrop))?; -347 trace!("endpoint_id gone: {:?}", endpoint_id); -348 self.write_frame(RelayToClientMsg::EndpointGone(endpoint_id)).await -349 .map_err(|err| e!(RunError::EndpointGoneWriteFrame, err))?; -350 } -351 _ = self.ping_tracker.timeout() => { -352 trace!("pong timed out"); -353 break; -354 } -355 _ = ping_interval.tick() => { -356 trace!("keep alive ping"); -357 // new interval -358 ping_interval.reset_after(next_interval()); -359 let data = self.ping_tracker.new_ping(); -360 self.write_frame(RelayToClientMsg::Ping(data)) -361 .await -362 .map_err(|err| e!(RunError::KeepAliveWriteFrame, err))?; -363 } -364 } -365 -366 self.stream -367 .flush() -368 .await -369 .map_err(|_| e!(RunError::TickFlush))?; -370 } -371 Ok(()) -372 } -373 -374 /// Writes the given frame to the connection. -375 /// -376 /// Errors if the send does not happen within the `timeout` duration -377 async fn write_frame(&mut self, frame: RelayToClientMsg) -> Result<(), WriteFrameError> { -378 tokio::time::timeout(self.timeout, self.stream.send(frame)) -379 .await? -380 .map_err(|err| e!(WriteFrameError::Stream { source: err }))?; -381 Ok(()) -382 } -383 -384 /// Writes contents to the client in a `RECV_PACKET` frame. -385 /// -386 /// Errors if the send does not happen within the `timeout` duration -387 /// Does not flush. -388 async fn send_raw(&mut self, packet: Packet) -> Result<(), WriteFrameError> { -389 let remote_endpoint_id = packet.src; -390 let datagrams = packet.data; -391 -392 if let Ok(len) = datagrams.contents.len().try_into() { -393 self.metrics.bytes_sent.inc_by(len); -394 } -395 self.write_frame(RelayToClientMsg::Datagrams { -396 remote_endpoint_id, -397 datagrams, -398 }) -399 .await -400 } -401 -402 async fn send_packet(&mut self, packet: Packet) -> Result<(), WriteFrameError> { -403 trace!("send packet"); -404 match self.send_raw(packet).await { -405 Ok(()) => { -406 self.metrics.send_packets_sent.inc(); -407 Ok(()) -408 } -409 Err(err) => { -410 self.metrics.send_packets_dropped.inc(); -411 Err(err) -412 } -413 } -414 } -415 -416 async fn send_disco_packet(&mut self, packet: Packet) -> Result<(), WriteFrameError> { -417 trace!("send disco packet"); -418 match self.send_raw(packet).await { -419 Ok(()) => { -420 self.metrics.disco_packets_sent.inc(); -421 Ok(()) -422 } -423 Err(err) => { -424 self.metrics.disco_packets_dropped.inc(); -425 Err(err) -426 } -427 } -428 } -429 -430 /// Handles frame read results. -431 async fn handle_frame( -432 &mut self, -433 maybe_frame: Option<Result<ClientToRelayMsg, RelayRecvError>>, -434 ) -> Result<(), HandleFrameError> { -435 trace!(?maybe_frame, "handle incoming frame"); -436 let frame = match maybe_frame { -437 Some(frame) => frame?, -438 None => return Err!(HandleFrameError::StreamTerminated), -439 }; -440 -441 match frame { -442 ClientToRelayMsg::Datagrams { -443 dst_endpoint_id: dst_key, -444 datagrams, -445 } => { -446 let packet_len = datagrams.contents.len(); -447 if let Err(err @ ForwardPacketError { .. }) = -448 self.handle_frame_send_packet(dst_key, datagrams) -449 { -450 warn!("failed to handle send packet frame: {err:#}"); -451 } -452 self.metrics.bytes_recv.inc_by(packet_len as u64); -453 } -454 ClientToRelayMsg::Ping(data) => { -455 self.metrics.got_ping.inc(); -456 // TODO: add rate limiter -457 self.write_frame(RelayToClientMsg::Pong(data)).await?; -458 self.metrics.sent_pong.inc(); -459 } -460 ClientToRelayMsg::Pong(data) => { -461 self.ping_tracker.pong_received(data); +328 self +329 .handle_frame(maybe_frame) +330 .await +331 .map_err(|source| e!(RunError::HandleFrame { source }))?; +332 // reset the ping interval, we just received a message +333 ping_interval.reset(); +334 } +335 // First priority, disco packets +336 packet = self.disco_send_queue.recv() => { +337 let packet = packet.ok_or_else(|| e!(RunError::DiscoSendQueuePacketDrop))?; +338 self.send_disco_packet(packet).await +339 .map_err(|err| e!(RunError::DiscoPacketSend, err))?; +340 } +341 // Second priority, sending regular packets +342 packet = self.send_queue.recv() => { +343 let packet = packet.ok_or_else(|| e!(RunError::SendQueuePacketDrop))?; +344 self.send_packet(packet).await +345 .map_err(|err| e!(RunError::PacketSend, err))?; +346 } +347 // Last priority, sending left endpoints +348 endpoint_id = self.endpoint_gone.recv() => { +349 let endpoint_id = endpoint_id.ok_or_else(|| e!(RunError::EndpointGoneDrop))?; +350 trace!("endpoint_id gone: {:?}", endpoint_id); +351 self.write_frame(RelayToClientMsg::EndpointGone(endpoint_id)).await +352 .map_err(|err| e!(RunError::EndpointGoneWriteFrame, err))?; +353 } +354 _ = self.ping_tracker.timeout() => { +355 trace!("pong timed out"); +356 break; +357 } +358 _ = ping_interval.tick() => { +359 trace!("keep alive ping"); +360 // new interval +361 ping_interval.reset_after(next_interval()); +362 let data = self.ping_tracker.new_ping(); +363 self.write_frame(RelayToClientMsg::Ping(data)) +364 .await +365 .map_err(|err| e!(RunError::KeepAliveWriteFrame, err))?; +366 } +367 } +368 +369 self.stream +370 .flush() +371 .await +372 .map_err(|_| e!(RunError::TickFlush))?; +373 } +374 Ok(()) +375 } +376 +377 /// Writes the given frame to the connection. +378 /// +379 /// Errors if the send does not happen within the `timeout` duration +380 async fn write_frame(&mut self, frame: RelayToClientMsg) -> Result<(), WriteFrameError> { +381 tokio::time::timeout(self.timeout, self.stream.send(frame)) +382 .await? +383 .map_err(|err| e!(WriteFrameError::Stream { source: err }))?; +384 Ok(()) +385 } +386 +387 /// Writes contents to the client in a `RECV_PACKET` frame. +388 /// +389 /// Errors if the send does not happen within the `timeout` duration +390 /// Does not flush. +391 async fn send_raw(&mut self, packet: Packet) -> Result<(), WriteFrameError> { +392 let remote_endpoint_id = packet.src; +393 let datagrams = packet.data; +394 +395 if let Ok(len) = datagrams.contents.len().try_into() { +396 self.metrics.bytes_sent.inc_by(len); +397 } +398 self.write_frame(RelayToClientMsg::Datagrams { +399 remote_endpoint_id, +400 datagrams, +401 }) +402 .await +403 } +404 +405 async fn send_packet(&mut self, packet: Packet) -> Result<(), WriteFrameError> { +406 trace!("send packet"); +407 match self.send_raw(packet).await { +408 Ok(()) => { +409 self.metrics.send_packets_sent.inc(); +410 Ok(()) +411 } +412 Err(err) => { +413 self.metrics.send_packets_dropped.inc(); +414 Err(err) +415 } +416 } +417 } +418 +419 async fn send_disco_packet(&mut self, packet: Packet) -> Result<(), WriteFrameError> { +420 trace!("send disco packet"); +421 match self.send_raw(packet).await { +422 Ok(()) => { +423 self.metrics.disco_packets_sent.inc(); +424 Ok(()) +425 } +426 Err(err) => { +427 self.metrics.disco_packets_dropped.inc(); +428 Err(err) +429 } +430 } +431 } +432 +433 /// Handles frame read results. +434 async fn handle_frame( +435 &mut self, +436 maybe_frame: Option<Result<ClientToRelayMsg, RelayRecvError>>, +437 ) -> Result<(), HandleFrameError> { +438 trace!(?maybe_frame, "handle incoming frame"); +439 let frame = match maybe_frame { +440 Some(frame) => frame?, +441 None => return Err!(HandleFrameError::StreamTerminated), +442 }; +443 +444 match frame { +445 ClientToRelayMsg::Datagrams { +446 dst_endpoint_id: dst_key, +447 datagrams, +448 } => { +449 let packet_len = datagrams.contents.len(); +450 if let Err(err @ ForwardPacketError { .. }) = +451 self.handle_frame_send_packet(dst_key, datagrams) +452 { +453 warn!("failed to handle send packet frame: {err:#}"); +454 } +455 self.metrics.bytes_recv.inc_by(packet_len as u64); +456 } +457 ClientToRelayMsg::Ping(data) => { +458 self.metrics.got_ping.inc(); +459 // TODO: add rate limiter +460 self.write_frame(RelayToClientMsg::Pong(data)).await?; +461 self.metrics.sent_pong.inc(); 462 } -463 } -464 Ok(()) -465 } -466 -467 fn handle_frame_send_packet( -468 &self, -469 dst: EndpointId, -470 data: Datagrams, -471 ) -> Result<(), ForwardPacketError> { -472 if disco::looks_like_disco_wrapper(&data.contents) { -473 self.metrics.disco_packets_recv.inc(); -474 self.clients -475 .send_disco_packet(dst, data, self.endpoint_id, &self.metrics)?; -476 } else { -477 self.metrics.send_packets_recv.inc(); -478 self.clients -479 .send_packet(dst, data, self.endpoint_id, &self.metrics)?; -480 } -481 Ok(()) -482 } -483} -484 -485#[derive(Debug)] -486pub(crate) enum PacketScope { -487 Disco, -488 Data, -489} -490 -491#[derive(Debug)] -492pub(crate) enum SendError { -493 Full, -494 Closed, -495} -496 -497#[add_meta] -498#[derive(Error)] -499#[display("failed to forward {scope:?} packet: {reason:?}")] -500pub(crate) struct ForwardPacketError { -501 scope: PacketScope, -502 reason: SendError, -503} -504 -505/// Tracks how many unique endpoints have been seen during the last day. -506#[derive(Debug)] -507struct ClientCounter { -508 clients: HashSet<EndpointId>, -509 last_clear_date: Date, -510} -511 -512impl Default for ClientCounter { -513 fn default() -> Self { -514 Self { -515 clients: HashSet::new(), -516 last_clear_date: OffsetDateTime::now_utc().date(), -517 } -518 } -519} -520 -521impl ClientCounter { -522 fn check_and_clear(&mut self) { -523 let today = OffsetDateTime::now_utc().date(); -524 if today != self.last_clear_date { -525 self.clients.clear(); -526 self.last_clear_date = today; -527 } -528 } -529 -530 /// Marks this endpoint as seen, returns whether it is new today or not. -531 fn update(&mut self, client: EndpointId) -> bool { -532 self.check_and_clear(); -533 self.clients.insert(client) -534 } -535} -536 -537#[cfg(test)] -538mod tests { -539 use iroh_base::SecretKey; -540 use n0_error::{Result, StdResultExt}; -541 use n0_future::Stream; -542 use rand::SeedableRng; -543 use tracing::info; -544 use tracing_test::traced_test; -545 -546 use super::*; -547 use crate::{client::conn::Conn, protos::common::FrameType}; +463 ClientToRelayMsg::Pong(data) => { +464 self.ping_tracker.pong_received(data); +465 } +466 } +467 Ok(()) +468 } +469 +470 fn handle_frame_send_packet( +471 &self, +472 dst: EndpointId, +473 data: Datagrams, +474 ) -> Result<(), ForwardPacketError> { +475 if disco::looks_like_disco_wrapper(&data.contents) { +476 self.metrics.disco_packets_recv.inc(); +477 self.clients +478 .send_disco_packet(dst, data, self.endpoint_id, &self.metrics)?; +479 } else { +480 self.metrics.send_packets_recv.inc(); +481 self.clients +482 .send_packet(dst, data, self.endpoint_id, &self.metrics)?; +483 } +484 Ok(()) +485 } +486} +487 +488#[derive(Debug)] +489pub(crate) enum PacketScope { +490 Disco, +491 Data, +492} +493 +494#[derive(Debug)] +495pub(crate) enum SendError { +496 Full, +497 Closed, +498} +499 +500#[add_meta] +501#[derive(Error)] +502#[display("failed to forward {scope:?} packet: {reason:?}")] +503pub(crate) struct ForwardPacketError { +504 scope: PacketScope, +505 reason: SendError, +506} +507 +508/// Tracks how many unique endpoints have been seen during the last day. +509#[derive(Debug)] +510struct ClientCounter { +511 clients: HashSet<EndpointId>, +512 last_clear_date: Date, +513} +514 +515impl Default for ClientCounter { +516 fn default() -> Self { +517 Self { +518 clients: HashSet::new(), +519 last_clear_date: OffsetDateTime::now_utc().date(), +520 } +521 } +522} +523 +524impl ClientCounter { +525 fn check_and_clear(&mut self) { +526 let today = OffsetDateTime::now_utc().date(); +527 if today != self.last_clear_date { +528 self.clients.clear(); +529 self.last_clear_date = today; +530 } +531 } +532 +533 /// Marks this endpoint as seen, returns whether it is new today or not. +534 fn update(&mut self, client: EndpointId) -> bool { +535 self.check_and_clear(); +536 self.clients.insert(client) +537 } +538} +539 +540#[cfg(test)] +541mod tests { +542 use iroh_base::SecretKey; +543 use n0_error::{Result, StdResultExt}; +544 use n0_future::Stream; +545 use rand::SeedableRng; +546 use tracing::info; +547 use tracing_test::traced_test; 548 -549 async fn recv_frame< -550 E: std::error::Error + Sync + Send + 'static, -551 S: Stream<Item = Result<RelayToClientMsg, E>> + Unpin, -552 >( -553 frame_type: FrameType, -554 mut stream: S, -555 ) -> Result<RelayToClientMsg> { -556 match stream.next().await { -557 Some(Ok(frame)) => { -558 if frame_type != frame.typ() { -559 n0_error::whatever!( -560 "Unexpected frame, got {:?}, but expected {:?}", -561 frame.typ(), -562 frame_type -563 ); -564 } -565 Ok(frame) -566 } -567 Some(Err(err)) => Err(err).e(), -568 None => n0_error::whatever!("Unexpected EOF, expected frame {frame_type:?}"), -569 } -570 } -571 -572 #[tokio::test] -573 #[traced_test] -574 async fn test_client_actor_basic() -> Result { -575 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); -576 -577 let (send_queue_s, send_queue_r) = mpsc::channel(10); -578 let (disco_send_queue_s, disco_send_queue_r) = mpsc::channel(10); -579 let (peer_gone_s, peer_gone_r) = mpsc::channel(10); -580 -581 let endpoint_id = SecretKey::generate(&mut rng).public(); -582 let (io, io_rw) = tokio::io::duplex(1024); -583 let mut io_rw = Conn::test(io_rw); -584 let stream = RelayedStream::test(io); -585 -586 let clients = Clients::default(); -587 let metrics = Arc::new(Metrics::default()); -588 let actor = Actor { -589 stream, -590 timeout: Duration::from_secs(1), -591 send_queue: send_queue_r, -592 disco_send_queue: disco_send_queue_r, -593 endpoint_gone: peer_gone_r, -594 connection_id: 0, -595 endpoint_id, -596 clients: clients.clone(), -597 client_counter: ClientCounter::default(), -598 ping_tracker: PingTracker::default(), -599 metrics, -600 }; -601 -602 let done = CancellationToken::new(); -603 let io_done = done.clone(); -604 let handle = tokio::task::spawn(async move { actor.run(io_done).await }); -605 -606 // Write tests -607 println!("-- write"); -608 let data = b"hello world!"; -609 -610 // send packet -611 println!(" send packet"); -612 let packet = Packet { -613 src: endpoint_id, -614 data: Datagrams::from(&data[..]), -615 }; -616 send_queue_s -617 .send(packet.clone()) -618 .await -619 .std_context("send")?; -620 let frame = recv_frame(FrameType::RelayToClientDatagram, &mut io_rw) +549 use super::*; +550 use crate::{client::conn::Conn, protos::common::FrameType}; +551 +552 async fn recv_frame< +553 E: std::error::Error + Sync + Send + 'static, +554 S: Stream<Item = Result<RelayToClientMsg, E>> + Unpin, +555 >( +556 frame_type: FrameType, +557 mut stream: S, +558 ) -> Result<RelayToClientMsg> { +559 match stream.next().await { +560 Some(Ok(frame)) => { +561 if frame_type != frame.typ() { +562 n0_error::whatever!( +563 "Unexpected frame, got {:?}, but expected {:?}", +564 frame.typ(), +565 frame_type +566 ); +567 } +568 Ok(frame) +569 } +570 Some(Err(err)) => Err(err).e(), +571 None => n0_error::whatever!("Unexpected EOF, expected frame {frame_type:?}"), +572 } +573 } +574 +575 #[tokio::test] +576 #[traced_test] +577 async fn test_client_actor_basic() -> Result { +578 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); +579 +580 let (send_queue_s, send_queue_r) = mpsc::channel(10); +581 let (disco_send_queue_s, disco_send_queue_r) = mpsc::channel(10); +582 let (peer_gone_s, peer_gone_r) = mpsc::channel(10); +583 +584 let endpoint_id = SecretKey::generate(&mut rng).public(); +585 let (io, io_rw) = tokio::io::duplex(1024); +586 let mut io_rw = Conn::test(io_rw); +587 let stream = RelayedStream::test(io); +588 +589 let clients = Clients::default(); +590 let metrics = Arc::new(Metrics::default()); +591 let actor = Actor { +592 stream, +593 timeout: Duration::from_secs(1), +594 send_queue: send_queue_r, +595 disco_send_queue: disco_send_queue_r, +596 endpoint_gone: peer_gone_r, +597 connection_id: 0, +598 endpoint_id, +599 clients: clients.clone(), +600 client_counter: ClientCounter::default(), +601 ping_tracker: PingTracker::default(), +602 metrics, +603 }; +604 +605 let done = CancellationToken::new(); +606 let io_done = done.clone(); +607 let handle = tokio::task::spawn(async move { actor.run(io_done).await }); +608 +609 // Write tests +610 println!("-- write"); +611 let data = b"hello world!"; +612 +613 // send packet +614 println!(" send packet"); +615 let packet = Packet { +616 src: endpoint_id, +617 data: Datagrams::from(&data[..]), +618 }; +619 send_queue_s +620 .send(packet.clone()) 621 .await -622 .e()?; -623 assert_eq!( -624 frame, -625 RelayToClientMsg::Datagrams { -626 remote_endpoint_id: endpoint_id, -627 datagrams: data.to_vec().into() -628 } -629 ); -630 -631 // send disco packet -632 println!(" send disco packet"); -633 disco_send_queue_s -634 .send(packet.clone()) -635 .await -636 .std_context("send")?; -637 let frame = recv_frame(FrameType::RelayToClientDatagram, &mut io_rw) +622 .std_context("send")?; +623 let frame = recv_frame(FrameType::RelayToClientDatagram, &mut io_rw) +624 .await +625 .e()?; +626 assert_eq!( +627 frame, +628 RelayToClientMsg::Datagrams { +629 remote_endpoint_id: endpoint_id, +630 datagrams: data.to_vec().into() +631 } +632 ); +633 +634 // send disco packet +635 println!(" send disco packet"); +636 disco_send_queue_s +637 .send(packet.clone()) 638 .await -639 .e()?; -640 assert_eq!( -641 frame, -642 RelayToClientMsg::Datagrams { -643 remote_endpoint_id: endpoint_id, -644 datagrams: data.to_vec().into() -645 } -646 ); -647 -648 // send peer_gone -649 println!("send peer gone"); -650 peer_gone_s.send(endpoint_id).await.std_context("send")?; -651 let frame = recv_frame(FrameType::EndpointGone, &mut io_rw).await.e()?; -652 assert_eq!(frame, RelayToClientMsg::EndpointGone(endpoint_id)); -653 -654 // Read tests -655 println!("--read"); +639 .std_context("send")?; +640 let frame = recv_frame(FrameType::RelayToClientDatagram, &mut io_rw) +641 .await +642 .e()?; +643 assert_eq!( +644 frame, +645 RelayToClientMsg::Datagrams { +646 remote_endpoint_id: endpoint_id, +647 datagrams: data.to_vec().into() +648 } +649 ); +650 +651 // send peer_gone +652 println!("send peer gone"); +653 peer_gone_s.send(endpoint_id).await.std_context("send")?; +654 let frame = recv_frame(FrameType::EndpointGone, &mut io_rw).await.e()?; +655 assert_eq!(frame, RelayToClientMsg::EndpointGone(endpoint_id)); 656 -657 // send ping, expect pong -658 let data = b"pingpong"; -659 io_rw.send(ClientToRelayMsg::Ping(*data)).await?; -660 -661 // recv pong -662 println!(" recv pong"); -663 let frame = recv_frame(FrameType::Pong, &mut io_rw).await?; -664 assert_eq!(frame, RelayToClientMsg::Pong(*data)); -665 -666 let target = SecretKey::generate(&mut rng).public(); -667 -668 // send packet -669 println!(" send packet"); -670 let data = b"hello world!"; -671 io_rw -672 .send(ClientToRelayMsg::Datagrams { -673 dst_endpoint_id: target, -674 datagrams: Datagrams::from(data), -675 }) -676 .await -677 .std_context("send")?; -678 -679 // send disco packet -680 println!(" send disco packet"); -681 // starts with `MAGIC` & key, then data -682 let mut disco_data = disco::MAGIC.as_bytes().to_vec(); -683 disco_data.extend_from_slice(target.as_bytes()); -684 disco_data.extend_from_slice(data); -685 io_rw -686 .send(ClientToRelayMsg::Datagrams { -687 dst_endpoint_id: target, -688 datagrams: disco_data.clone().into(), -689 }) -690 .await -691 .std_context("send")?; -692 -693 done.cancel(); -694 handle.await.std_context("join")?; -695 Ok(()) -696 } -697 -698 #[tokio::test(start_paused = true)] -699 #[traced_test] -700 async fn test_rate_limit() -> Result { -701 const LIMIT: u32 = 50; -702 const MAX_FRAMES: u32 = 100; -703 -704 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); -705 -706 // Build the rate limited stream. -707 let (io_read, io_write) = tokio::io::duplex((LIMIT * MAX_FRAMES) as _); -708 let mut frame_writer = Conn::test(io_write); -709 // Rate limiter allowing LIMIT bytes/s -710 let mut stream = RelayedStream::test_limited(io_read, LIMIT / 10, LIMIT)?; -711 -712 // Prepare a frame to send, assert its size. -713 let data = Datagrams::from(b"hello world!!!!!"); -714 let target = SecretKey::generate(&mut rng).public(); -715 let frame = ClientToRelayMsg::Datagrams { -716 dst_endpoint_id: target, -717 datagrams: data.clone(), -718 }; -719 let frame_len = frame.to_bytes().len(); -720 assert_eq!(frame_len, LIMIT as usize); -721 -722 // Send a frame, it should arrive. -723 info!("-- send packet"); -724 frame_writer.send(frame.clone()).await.context("send")?; -725 frame_writer.flush().await.context("flush")?; -726 let recv_frame = tokio::time::timeout(Duration::from_millis(500), stream.next()) -727 .await -728 .expect("timeout") -729 .expect("option") -730 .expect("ok"); -731 assert_eq!(recv_frame, frame); -732 -733 // Next frame does not arrive. -734 info!("-- send packet"); -735 frame_writer.send(frame.clone()).await.context("send")?; -736 frame_writer.flush().await.context("flush")?; -737 let res = tokio::time::timeout(Duration::from_millis(100), stream.next()).await; -738 assert!(res.is_err(), "expecting a timeout"); -739 info!("-- timeout happened"); -740 -741 // Wait long enough. -742 info!("-- sleep"); -743 tokio::time::sleep(Duration::from_secs(1)).await; -744 -745 // Frame arrives. -746 let recv_frame = tokio::time::timeout(Duration::from_millis(500), stream.next()) -747 .await -748 .expect("timeout") -749 .expect("option") -750 .expect("ok"); -751 assert_eq!(recv_frame, frame); -752 -753 Ok(()) -754 } -755} \ No newline at end of file +657 // Read tests +658 println!("--read"); +659 +660 // send ping, expect pong +661 let data = b"pingpong"; +662 io_rw.send(ClientToRelayMsg::Ping(*data)).await?; +663 +664 // recv pong +665 println!(" recv pong"); +666 let frame = recv_frame(FrameType::Pong, &mut io_rw).await?; +667 assert_eq!(frame, RelayToClientMsg::Pong(*data)); +668 +669 let target = SecretKey::generate(&mut rng).public(); +670 +671 // send packet +672 println!(" send packet"); +673 let data = b"hello world!"; +674 io_rw +675 .send(ClientToRelayMsg::Datagrams { +676 dst_endpoint_id: target, +677 datagrams: Datagrams::from(data), +678 }) +679 .await +680 .std_context("send")?; +681 +682 // send disco packet +683 println!(" send disco packet"); +684 // starts with `MAGIC` & key, then data +685 let mut disco_data = disco::MAGIC.as_bytes().to_vec(); +686 disco_data.extend_from_slice(target.as_bytes()); +687 disco_data.extend_from_slice(data); +688 io_rw +689 .send(ClientToRelayMsg::Datagrams { +690 dst_endpoint_id: target, +691 datagrams: disco_data.clone().into(), +692 }) +693 .await +694 .std_context("send")?; +695 +696 done.cancel(); +697 handle.await.std_context("join")?; +698 Ok(()) +699 } +700 +701 #[tokio::test(start_paused = true)] +702 #[traced_test] +703 async fn test_rate_limit() -> Result { +704 const LIMIT: u32 = 50; +705 const MAX_FRAMES: u32 = 100; +706 +707 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(0u64); +708 +709 // Build the rate limited stream. +710 let (io_read, io_write) = tokio::io::duplex((LIMIT * MAX_FRAMES) as _); +711 let mut frame_writer = Conn::test(io_write); +712 // Rate limiter allowing LIMIT bytes/s +713 let mut stream = RelayedStream::test_limited(io_read, LIMIT / 10, LIMIT)?; +714 +715 // Prepare a frame to send, assert its size. +716 let data = Datagrams::from(b"hello world!!!!!"); +717 let target = SecretKey::generate(&mut rng).public(); +718 let frame = ClientToRelayMsg::Datagrams { +719 dst_endpoint_id: target, +720 datagrams: data.clone(), +721 }; +722 let frame_len = frame.to_bytes().len(); +723 assert_eq!(frame_len, LIMIT as usize); +724 +725 // Send a frame, it should arrive. +726 info!("-- send packet"); +727 frame_writer.send(frame.clone()).await.context("send")?; +728 frame_writer.flush().await.context("flush")?; +729 let recv_frame = tokio::time::timeout(Duration::from_millis(500), stream.next()) +730 .await +731 .expect("timeout") +732 .expect("option") +733 .expect("ok"); +734 assert_eq!(recv_frame, frame); +735 +736 // Next frame does not arrive. +737 info!("-- send packet"); +738 frame_writer.send(frame.clone()).await.context("send")?; +739 frame_writer.flush().await.context("flush")?; +740 let res = tokio::time::timeout(Duration::from_millis(100), stream.next()).await; +741 assert!(res.is_err(), "expecting a timeout"); +742 info!("-- timeout happened"); +743 +744 // Wait long enough. +745 info!("-- sleep"); +746 tokio::time::sleep(Duration::from_secs(1)).await; +747 +748 // Frame arrives. +749 let recv_frame = tokio::time::timeout(Duration::from_millis(500), stream.next()) +750 .await +751 .expect("timeout") +752 .expect("option") +753 .expect("ok"); +754 assert_eq!(recv_frame, frame); +755 +756 Ok(()) +757 } +758} \ No newline at end of file diff --git a/pr/3561/docs/trait.impl/core/marker/trait.Freeze.js b/pr/3561/docs/trait.impl/core/marker/trait.Freeze.js index 18605baedc..ec955989c1 100644 --- a/pr/3561/docs/trait.impl/core/marker/trait.Freeze.js +++ b/pr/3561/docs/trait.impl/core/marker/trait.Freeze.js @@ -1,9 +1,9 @@ (function() { - var implementors = Object.fromEntries([["iroh",[["impl !Freeze for AlpnError",1,["iroh::endpoint::AlpnError"]],["impl !Freeze for ConnectError",1,["iroh::endpoint::ConnectError"]],["impl !Freeze for AcceptError",1,["iroh::protocol::AcceptError"]],["impl !Freeze for Incoming",1,["iroh::endpoint::Incoming"]],["impl !Freeze for IncomingFuture",1,["iroh::endpoint::IncomingFuture"]],["impl !Freeze for Metrics",1,["iroh::magicsock::metrics::Metrics"]],["impl !Freeze for Metrics",1,["iroh::net_report::metrics::Metrics"]],["impl Freeze for DiscoveryError",1,["iroh::discovery::DiscoveryError"]],["impl Freeze for IntoDiscoveryError",1,["iroh::discovery::IntoDiscoveryError"]],["impl Freeze for DiscoveryEvent",1,["iroh::discovery::mdns::DiscoveryEvent"]],["impl Freeze for PkarrError",1,["iroh::discovery::pkarr::PkarrError"]],["impl Freeze for AddEndpointAddrError",1,["iroh::magicsock::AddEndpointAddrError"]],["impl Freeze for BindError",1,["iroh::endpoint::BindError"]],["impl Freeze for ConnectWithOptsError",1,["iroh::endpoint::ConnectWithOptsError"]],["impl Freeze for ConnectionType",1,["iroh::magicsock::endpoint_map::endpoint_state::ConnectionType"]],["impl Freeze for ControlMsg",1,["iroh::magicsock::endpoint_map::endpoint_state::ControlMsg"]],["impl Freeze for DirectAddrType",1,["iroh::magicsock::DirectAddrType"]],["impl Freeze for GetMappingAddressError",1,["iroh::endpoint::GetMappingAddressError"]],["impl Freeze for PathSelection",1,["iroh::endpoint::PathSelection"]],["impl Freeze for RelayMode",1,["iroh::endpoint::RelayMode"]],["impl Freeze for Source",1,["iroh::magicsock::endpoint_map::Source"]],["impl Freeze for Probe",1,["iroh::net_report::probes::Probe"]],["impl Freeze for DnsDiscovery",1,["iroh::discovery::dns::DnsDiscovery"]],["impl Freeze for DnsDiscoveryBuilder",1,["iroh::discovery::dns::DnsDiscoveryBuilder"]],["impl Freeze for MdnsDiscovery",1,["iroh::discovery::mdns::MdnsDiscovery"]],["impl Freeze for MdnsDiscoveryBuilder",1,["iroh::discovery::mdns::MdnsDiscoveryBuilder"]],["impl Freeze for Builder",1,["iroh::discovery::pkarr::dht::Builder"]],["impl Freeze for DhtDiscovery",1,["iroh::discovery::pkarr::dht::DhtDiscovery"]],["impl Freeze for PkarrPublisher",1,["iroh::discovery::pkarr::PkarrPublisher"]],["impl Freeze for PkarrPublisherBuilder",1,["iroh::discovery::pkarr::PkarrPublisherBuilder"]],["impl Freeze for PkarrRelayClient",1,["iroh::discovery::pkarr::PkarrRelayClient"]],["impl Freeze for PkarrResolver",1,["iroh::discovery::pkarr::PkarrResolver"]],["impl Freeze for PkarrResolverBuilder",1,["iroh::discovery::pkarr::PkarrResolverBuilder"]],["impl Freeze for StaticProvider",1,["iroh::discovery::static_provider::StaticProvider"]],["impl Freeze for ConcurrentDiscovery",1,["iroh::discovery::ConcurrentDiscovery"]],["impl Freeze for DiscoveryItem",1,["iroh::discovery::DiscoveryItem"]],["impl Freeze for N0",1,["iroh::endpoint::presets::N0"]],["impl Freeze for Builder",1,["iroh::endpoint::Builder"]],["impl Freeze for ConnectOptions",1,["iroh::endpoint::ConnectOptions"]],["impl Freeze for Connecting",1,["iroh::endpoint::Connecting"]],["impl Freeze for Connection",1,["iroh::endpoint::Connection"]],["impl Freeze for DirectAddr",1,["iroh::magicsock::DirectAddr"]],["impl Freeze for DirectAddrInfo",1,["iroh::magicsock::endpoint_map::endpoint_state::DirectAddrInfo"]],["impl Freeze for Endpoint",1,["iroh::endpoint::Endpoint"]],["impl Freeze for RemoteEndpointIdError",1,["iroh::endpoint::RemoteEndpointIdError"]],["impl Freeze for ZeroRttAccepted",1,["iroh::endpoint::ZeroRttAccepted"]],["impl Freeze for EndpointMetrics",1,["iroh::metrics::EndpointMetrics"]],["impl Freeze for Options",1,["iroh::net_report::options::imp::Options"]],["impl Freeze for QuicConfig",1,["iroh::net_report::reportgen::QuicConfig"]],["impl Freeze for RelayLatencies",1,["iroh::net_report::report::RelayLatencies"]],["impl Freeze for Report",1,["iroh::net_report::report::Report"]],["impl Freeze for Router",1,["iroh::protocol::Router"]],["impl Freeze for RouterBuilder",1,["iroh::protocol::RouterBuilder"]],["impl Freeze for CleanupDropGuard",1,["iroh::test_utils::CleanupDropGuard"]],["impl Freeze for DnsPkarrServer",1,["iroh::test_utils::dns_and_pkarr_servers::DnsPkarrServer"]],["impl<'a> !Freeze for Accept<'a>",1,["iroh::endpoint::Accept"]],["impl<P> Freeze for AccessLimit<P>
where\n P: Freeze,
",1,["iroh::protocol::AccessLimit"]]]],["iroh_base",[["impl Freeze for KeyParsingError",1,["iroh_base::key::KeyParsingError"]],["impl Freeze for ParseError",1,["iroh_base::ticket::ParseError"]],["impl Freeze for EndpointAddr",1,["iroh_base::endpoint_addr::EndpointAddr"]],["impl Freeze for PublicKey",1,["iroh_base::key::PublicKey"]],["impl Freeze for RelayUrl",1,["iroh_base::relay_url::RelayUrl"]],["impl Freeze for RelayUrlParseError",1,["iroh_base::relay_url::RelayUrlParseError"]],["impl Freeze for SecretKey",1,["iroh_base::key::SecretKey"]],["impl Freeze for Signature",1,["iroh_base::key::Signature"]],["impl Freeze for SignatureError",1,["iroh_base::key::SignatureError"]],["impl Freeze for EndpointTicket",1,["iroh_base::ticket::endpoint::EndpointTicket"]]]],["iroh_bench",[["impl Freeze for Commands",1,["iroh_bench::Commands"]],["impl Freeze for ConnectionSelector",1,["iroh_bench::ConnectionSelector"]],["impl Freeze for EndpointSelector",1,["iroh_bench::EndpointSelector"]],["impl Freeze for Opt",1,["iroh_bench::s2n::Opt"]],["impl Freeze for Stats",1,["iroh_bench::stats::Stats"]],["impl Freeze for StreamStats",1,["iroh_bench::stats::StreamStats"]],["impl Freeze for TransferResult",1,["iroh_bench::stats::TransferResult"]],["impl Freeze for ClientStats",1,["iroh_bench::ClientStats"]],["impl Freeze for Opt",1,["iroh_bench::Opt"]]]],["iroh_dns_server",[["impl !Freeze for Metrics",1,["iroh_dns_server::metrics::Metrics"]],["impl Freeze for BootstrapOption",1,["iroh_dns_server::config::BootstrapOption"]],["impl Freeze for CertMode",1,["iroh_dns_server::http::tls::CertMode"]],["impl Freeze for RateLimitConfig",1,["iroh_dns_server::http::rate_limiting::RateLimitConfig"]],["impl Freeze for Config",1,["iroh_dns_server::config::Config"]],["impl Freeze for MainlineConfig",1,["iroh_dns_server::config::MainlineConfig"]],["impl Freeze for MetricsConfig",1,["iroh_dns_server::config::MetricsConfig"]],["impl Freeze for StoreConfig",1,["iroh_dns_server::config::StoreConfig"]],["impl Freeze for DnsConfig",1,["iroh_dns_server::dns::DnsConfig"]],["impl Freeze for DnsHandler",1,["iroh_dns_server::dns::DnsHandler"]],["impl Freeze for DnsServer",1,["iroh_dns_server::dns::DnsServer"]],["impl Freeze for Handle",1,["iroh_dns_server::dns::Handle"]],["impl Freeze for HttpConfig",1,["iroh_dns_server::http::HttpConfig"]],["impl Freeze for HttpServer",1,["iroh_dns_server::http::HttpServer"]],["impl Freeze for HttpsConfig",1,["iroh_dns_server::http::HttpsConfig"]],["impl Freeze for Server",1,["iroh_dns_server::server::Server"]],["impl Freeze for AppState",1,["iroh_dns_server::state::AppState"]],["impl Freeze for ZoneStore",1,["iroh_dns_server::store::ZoneStore"]]]],["iroh_relay",[["impl !Freeze for ConnectError",1,["iroh_relay::client::ConnectError"]],["impl !Freeze for Error",1,["iroh_relay::protos::handshake::Error"]],["impl !Freeze for ClientToRelayMsg",1,["iroh_relay::protos::relay::ClientToRelayMsg"]],["impl !Freeze for RelayToClientMsg",1,["iroh_relay::protos::relay::RelayToClientMsg"]],["impl !Freeze for Error",1,["iroh_relay::quic::Error"]],["impl !Freeze for Client",1,["iroh_relay::client::Client"]],["impl !Freeze for ClientSink",1,["iroh_relay::client::ClientSink"]],["impl !Freeze for Datagrams",1,["iroh_relay::protos::relay::Datagrams"]],["impl !Freeze for Metrics",1,["iroh_relay::server::metrics::Metrics"]],["impl Freeze for DialError",1,["iroh_relay::client::DialError"]],["impl Freeze for RecvError",1,["iroh_relay::client::conn::RecvError"]],["impl Freeze for SendError",1,["iroh_relay::client::conn::SendError"]],["impl Freeze for DnsError",1,["iroh_relay::dns::DnsError"]],["impl Freeze for DnsProtocol",1,["iroh_relay::dns::DnsProtocol"]],["impl Freeze for LookupError",1,["iroh_relay::dns::LookupError"]],["impl Freeze for DecodingError",1,["iroh_relay::endpoint_info::DecodingError"]],["impl Freeze for EncodingError",1,["iroh_relay::endpoint_info::EncodingError"]],["impl Freeze for ParseError",1,["iroh_relay::endpoint_info::ParseError"]],["impl Freeze for FrameType",1,["iroh_relay::protos::common::FrameType"]],["impl Freeze for FrameTypeError",1,["iroh_relay::protos::common::FrameTypeError"]],["impl Freeze for Error",1,["iroh_relay::protos::relay::Error"]],["impl Freeze for Access",1,["iroh_relay::server::Access"]],["impl Freeze for AccessConfig",1,["iroh_relay::server::AccessConfig"]],["impl Freeze for SpawnError",1,["iroh_relay::server::SpawnError"]],["impl Freeze for SupervisorError",1,["iroh_relay::server::SupervisorError"]],["impl Freeze for ClientBuilder",1,["iroh_relay::client::ClientBuilder"]],["impl Freeze for ClientStream",1,["iroh_relay::client::ClientStream"]],["impl Freeze for Builder",1,["iroh_relay::dns::Builder"]],["impl Freeze for DnsResolver",1,["iroh_relay::dns::DnsResolver"]],["impl Freeze for DnsStaggeredError",1,["iroh_relay::dns::DnsStaggeredError"]],["impl Freeze for LookupStaggeredError",1,["iroh_relay::dns::LookupStaggeredError"]],["impl Freeze for TxtRecordData",1,["iroh_relay::dns::TxtRecordData"]],["impl Freeze for EndpointData",1,["iroh_relay::endpoint_info::EndpointData"]],["impl Freeze for EndpointInfo",1,["iroh_relay::endpoint_info::EndpointInfo"]],["impl Freeze for MaxLengthExceededError",1,["iroh_relay::endpoint_info::MaxLengthExceededError"]],["impl Freeze for UserData",1,["iroh_relay::endpoint_info::UserData"]],["impl Freeze for QuicClient",1,["iroh_relay::quic::QuicClient"]],["impl Freeze for ClientRateLimit",1,["iroh_relay::server::ClientRateLimit"]],["impl Freeze for Limits",1,["iroh_relay::server::Limits"]],["impl Freeze for QuicConfig",1,["iroh_relay::server::QuicConfig"]],["impl Freeze for RelayMetrics",1,["iroh_relay::server::metrics::RelayMetrics"]],["impl Freeze for Server",1,["iroh_relay::server::Server"]],["impl Freeze for PingTracker",1,["iroh_relay::ping_tracker::PingTracker"]],["impl Freeze for RelayConfig",1,["iroh_relay::relay_map::RelayConfig"]],["impl Freeze for RelayMap",1,["iroh_relay::relay_map::RelayMap"]],["impl Freeze for RelayQuicConfig",1,["iroh_relay::relay_map::RelayQuicConfig"]],["impl<EC, EA> Freeze for CertConfig<EC, EA>",1,["iroh_relay::server::CertConfig"]],["impl<EC, EA> Freeze for RelayConfig<EC, EA>",1,["iroh_relay::server::RelayConfig"]],["impl<EC, EA> Freeze for ServerConfig<EC, EA>",1,["iroh_relay::server::ServerConfig"]],["impl<EC, EA> Freeze for TlsConfig<EC, EA>",1,["iroh_relay::server::TlsConfig"]],["impl<Loader> Freeze for ReloadingResolver<Loader>",1,["iroh_relay::server::resolver::ReloadingResolver"]]]]]); + var implementors = Object.fromEntries([["iroh",[["impl !Freeze for AlpnError",1,["iroh::endpoint::AlpnError"]],["impl !Freeze for BindError",1,["iroh::endpoint::BindError"]],["impl !Freeze for ConnectError",1,["iroh::endpoint::ConnectError"]],["impl !Freeze for AcceptError",1,["iroh::protocol::AcceptError"]],["impl !Freeze for Incoming",1,["iroh::endpoint::Incoming"]],["impl !Freeze for IncomingFuture",1,["iroh::endpoint::IncomingFuture"]],["impl !Freeze for Metrics",1,["iroh::magicsock::metrics::Metrics"]],["impl !Freeze for Metrics",1,["iroh::net_report::metrics::Metrics"]],["impl Freeze for DiscoveryError",1,["iroh::discovery::DiscoveryError"]],["impl Freeze for IntoDiscoveryError",1,["iroh::discovery::IntoDiscoveryError"]],["impl Freeze for DiscoveryEvent",1,["iroh::discovery::mdns::DiscoveryEvent"]],["impl Freeze for PkarrError",1,["iroh::discovery::pkarr::PkarrError"]],["impl Freeze for AddEndpointAddrError",1,["iroh::magicsock::AddEndpointAddrError"]],["impl Freeze for ConnectWithOptsError",1,["iroh::endpoint::ConnectWithOptsError"]],["impl Freeze for ConnectionType",1,["iroh::magicsock::endpoint_map::endpoint_state::ConnectionType"]],["impl Freeze for ControlMsg",1,["iroh::magicsock::endpoint_map::endpoint_state::ControlMsg"]],["impl Freeze for DirectAddrType",1,["iroh::magicsock::DirectAddrType"]],["impl Freeze for GetMappingAddressError",1,["iroh::endpoint::GetMappingAddressError"]],["impl Freeze for PathSelection",1,["iroh::endpoint::PathSelection"]],["impl Freeze for RelayMode",1,["iroh::endpoint::RelayMode"]],["impl Freeze for Source",1,["iroh::magicsock::endpoint_map::Source"]],["impl Freeze for Probe",1,["iroh::net_report::probes::Probe"]],["impl Freeze for DnsDiscovery",1,["iroh::discovery::dns::DnsDiscovery"]],["impl Freeze for DnsDiscoveryBuilder",1,["iroh::discovery::dns::DnsDiscoveryBuilder"]],["impl Freeze for MdnsDiscovery",1,["iroh::discovery::mdns::MdnsDiscovery"]],["impl Freeze for MdnsDiscoveryBuilder",1,["iroh::discovery::mdns::MdnsDiscoveryBuilder"]],["impl Freeze for Builder",1,["iroh::discovery::pkarr::dht::Builder"]],["impl Freeze for DhtDiscovery",1,["iroh::discovery::pkarr::dht::DhtDiscovery"]],["impl Freeze for PkarrPublisher",1,["iroh::discovery::pkarr::PkarrPublisher"]],["impl Freeze for PkarrPublisherBuilder",1,["iroh::discovery::pkarr::PkarrPublisherBuilder"]],["impl Freeze for PkarrRelayClient",1,["iroh::discovery::pkarr::PkarrRelayClient"]],["impl Freeze for PkarrResolver",1,["iroh::discovery::pkarr::PkarrResolver"]],["impl Freeze for PkarrResolverBuilder",1,["iroh::discovery::pkarr::PkarrResolverBuilder"]],["impl Freeze for StaticProvider",1,["iroh::discovery::static_provider::StaticProvider"]],["impl Freeze for ConcurrentDiscovery",1,["iroh::discovery::ConcurrentDiscovery"]],["impl Freeze for DiscoveryItem",1,["iroh::discovery::DiscoveryItem"]],["impl Freeze for N0",1,["iroh::endpoint::presets::N0"]],["impl Freeze for Builder",1,["iroh::endpoint::Builder"]],["impl Freeze for ConnectOptions",1,["iroh::endpoint::ConnectOptions"]],["impl Freeze for Connecting",1,["iroh::endpoint::Connecting"]],["impl Freeze for Connection",1,["iroh::endpoint::Connection"]],["impl Freeze for DirectAddr",1,["iroh::magicsock::DirectAddr"]],["impl Freeze for DirectAddrInfo",1,["iroh::magicsock::endpoint_map::endpoint_state::DirectAddrInfo"]],["impl Freeze for Endpoint",1,["iroh::endpoint::Endpoint"]],["impl Freeze for RemoteEndpointIdError",1,["iroh::endpoint::RemoteEndpointIdError"]],["impl Freeze for ZeroRttAccepted",1,["iroh::endpoint::ZeroRttAccepted"]],["impl Freeze for EndpointMetrics",1,["iroh::metrics::EndpointMetrics"]],["impl Freeze for Options",1,["iroh::net_report::options::imp::Options"]],["impl Freeze for QuicConfig",1,["iroh::net_report::reportgen::QuicConfig"]],["impl Freeze for RelayLatencies",1,["iroh::net_report::report::RelayLatencies"]],["impl Freeze for Report",1,["iroh::net_report::report::Report"]],["impl Freeze for Router",1,["iroh::protocol::Router"]],["impl Freeze for RouterBuilder",1,["iroh::protocol::RouterBuilder"]],["impl Freeze for CleanupDropGuard",1,["iroh::test_utils::CleanupDropGuard"]],["impl Freeze for DnsPkarrServer",1,["iroh::test_utils::dns_and_pkarr_servers::DnsPkarrServer"]],["impl<'a> !Freeze for Accept<'a>",1,["iroh::endpoint::Accept"]],["impl<P> Freeze for AccessLimit<P>
where\n P: Freeze,
",1,["iroh::protocol::AccessLimit"]]]],["iroh_base",[["impl Freeze for KeyParsingError",1,["iroh_base::key::KeyParsingError"]],["impl Freeze for ParseError",1,["iroh_base::ticket::ParseError"]],["impl Freeze for EndpointAddr",1,["iroh_base::endpoint_addr::EndpointAddr"]],["impl Freeze for PublicKey",1,["iroh_base::key::PublicKey"]],["impl Freeze for RelayUrl",1,["iroh_base::relay_url::RelayUrl"]],["impl Freeze for RelayUrlParseError",1,["iroh_base::relay_url::RelayUrlParseError"]],["impl Freeze for SecretKey",1,["iroh_base::key::SecretKey"]],["impl Freeze for Signature",1,["iroh_base::key::Signature"]],["impl Freeze for SignatureError",1,["iroh_base::key::SignatureError"]],["impl Freeze for EndpointTicket",1,["iroh_base::ticket::endpoint::EndpointTicket"]]]],["iroh_bench",[["impl Freeze for Commands",1,["iroh_bench::Commands"]],["impl Freeze for ConnectionSelector",1,["iroh_bench::ConnectionSelector"]],["impl Freeze for EndpointSelector",1,["iroh_bench::EndpointSelector"]],["impl Freeze for Opt",1,["iroh_bench::s2n::Opt"]],["impl Freeze for Stats",1,["iroh_bench::stats::Stats"]],["impl Freeze for StreamStats",1,["iroh_bench::stats::StreamStats"]],["impl Freeze for TransferResult",1,["iroh_bench::stats::TransferResult"]],["impl Freeze for ClientStats",1,["iroh_bench::ClientStats"]],["impl Freeze for Opt",1,["iroh_bench::Opt"]]]],["iroh_dns_server",[["impl !Freeze for Metrics",1,["iroh_dns_server::metrics::Metrics"]],["impl Freeze for BootstrapOption",1,["iroh_dns_server::config::BootstrapOption"]],["impl Freeze for CertMode",1,["iroh_dns_server::http::tls::CertMode"]],["impl Freeze for RateLimitConfig",1,["iroh_dns_server::http::rate_limiting::RateLimitConfig"]],["impl Freeze for Config",1,["iroh_dns_server::config::Config"]],["impl Freeze for MainlineConfig",1,["iroh_dns_server::config::MainlineConfig"]],["impl Freeze for MetricsConfig",1,["iroh_dns_server::config::MetricsConfig"]],["impl Freeze for StoreConfig",1,["iroh_dns_server::config::StoreConfig"]],["impl Freeze for DnsConfig",1,["iroh_dns_server::dns::DnsConfig"]],["impl Freeze for DnsHandler",1,["iroh_dns_server::dns::DnsHandler"]],["impl Freeze for DnsServer",1,["iroh_dns_server::dns::DnsServer"]],["impl Freeze for Handle",1,["iroh_dns_server::dns::Handle"]],["impl Freeze for HttpConfig",1,["iroh_dns_server::http::HttpConfig"]],["impl Freeze for HttpServer",1,["iroh_dns_server::http::HttpServer"]],["impl Freeze for HttpsConfig",1,["iroh_dns_server::http::HttpsConfig"]],["impl Freeze for Server",1,["iroh_dns_server::server::Server"]],["impl Freeze for AppState",1,["iroh_dns_server::state::AppState"]],["impl Freeze for ZoneStore",1,["iroh_dns_server::store::ZoneStore"]]]],["iroh_relay",[["impl !Freeze for ConnectError",1,["iroh_relay::client::ConnectError"]],["impl !Freeze for Error",1,["iroh_relay::protos::handshake::Error"]],["impl !Freeze for ClientToRelayMsg",1,["iroh_relay::protos::relay::ClientToRelayMsg"]],["impl !Freeze for RelayToClientMsg",1,["iroh_relay::protos::relay::RelayToClientMsg"]],["impl !Freeze for Error",1,["iroh_relay::quic::Error"]],["impl !Freeze for Client",1,["iroh_relay::client::Client"]],["impl !Freeze for ClientSink",1,["iroh_relay::client::ClientSink"]],["impl !Freeze for Datagrams",1,["iroh_relay::protos::relay::Datagrams"]],["impl !Freeze for Metrics",1,["iroh_relay::server::metrics::Metrics"]],["impl Freeze for DialError",1,["iroh_relay::client::DialError"]],["impl Freeze for RecvError",1,["iroh_relay::client::conn::RecvError"]],["impl Freeze for SendError",1,["iroh_relay::client::conn::SendError"]],["impl Freeze for DnsError",1,["iroh_relay::dns::DnsError"]],["impl Freeze for DnsProtocol",1,["iroh_relay::dns::DnsProtocol"]],["impl Freeze for LookupError",1,["iroh_relay::dns::LookupError"]],["impl Freeze for DecodingError",1,["iroh_relay::endpoint_info::DecodingError"]],["impl Freeze for EncodingError",1,["iroh_relay::endpoint_info::EncodingError"]],["impl Freeze for ParseError",1,["iroh_relay::endpoint_info::ParseError"]],["impl Freeze for FrameType",1,["iroh_relay::protos::common::FrameType"]],["impl Freeze for FrameTypeError",1,["iroh_relay::protos::common::FrameTypeError"]],["impl Freeze for Error",1,["iroh_relay::protos::relay::Error"]],["impl Freeze for Access",1,["iroh_relay::server::Access"]],["impl Freeze for AccessConfig",1,["iroh_relay::server::AccessConfig"]],["impl Freeze for SpawnError",1,["iroh_relay::server::SpawnError"]],["impl Freeze for SupervisorError",1,["iroh_relay::server::SupervisorError"]],["impl Freeze for ClientBuilder",1,["iroh_relay::client::ClientBuilder"]],["impl Freeze for ClientStream",1,["iroh_relay::client::ClientStream"]],["impl Freeze for Builder",1,["iroh_relay::dns::Builder"]],["impl Freeze for DnsResolver",1,["iroh_relay::dns::DnsResolver"]],["impl Freeze for DnsStaggeredError",1,["iroh_relay::dns::DnsStaggeredError"]],["impl Freeze for LookupStaggeredError",1,["iroh_relay::dns::LookupStaggeredError"]],["impl Freeze for TxtRecordData",1,["iroh_relay::dns::TxtRecordData"]],["impl Freeze for EndpointData",1,["iroh_relay::endpoint_info::EndpointData"]],["impl Freeze for EndpointInfo",1,["iroh_relay::endpoint_info::EndpointInfo"]],["impl Freeze for MaxLengthExceededError",1,["iroh_relay::endpoint_info::MaxLengthExceededError"]],["impl Freeze for UserData",1,["iroh_relay::endpoint_info::UserData"]],["impl Freeze for QuicClient",1,["iroh_relay::quic::QuicClient"]],["impl Freeze for ClientRateLimit",1,["iroh_relay::server::ClientRateLimit"]],["impl Freeze for Limits",1,["iroh_relay::server::Limits"]],["impl Freeze for QuicConfig",1,["iroh_relay::server::QuicConfig"]],["impl Freeze for RelayMetrics",1,["iroh_relay::server::metrics::RelayMetrics"]],["impl Freeze for Server",1,["iroh_relay::server::Server"]],["impl Freeze for PingTracker",1,["iroh_relay::ping_tracker::PingTracker"]],["impl Freeze for RelayConfig",1,["iroh_relay::relay_map::RelayConfig"]],["impl Freeze for RelayMap",1,["iroh_relay::relay_map::RelayMap"]],["impl Freeze for RelayQuicConfig",1,["iroh_relay::relay_map::RelayQuicConfig"]],["impl<EC, EA> Freeze for CertConfig<EC, EA>",1,["iroh_relay::server::CertConfig"]],["impl<EC, EA> Freeze for RelayConfig<EC, EA>",1,["iroh_relay::server::RelayConfig"]],["impl<EC, EA> Freeze for ServerConfig<EC, EA>",1,["iroh_relay::server::ServerConfig"]],["impl<EC, EA> Freeze for TlsConfig<EC, EA>",1,["iroh_relay::server::TlsConfig"]],["impl<Loader> Freeze for ReloadingResolver<Loader>",1,["iroh_relay::server::resolver::ReloadingResolver"]]]]]); if (window.register_implementors) { window.register_implementors(implementors); } else { window.pending_implementors = implementors; } })() -//{"start":57,"fragment_lengths":[19068,3164,2769,6015,16923]} \ No newline at end of file +//{"start":57,"fragment_lengths":[19069,3164,2769,6015,16923]} \ No newline at end of file diff --git a/pr/3561/docs/type.impl/alloc/boxed/struct.Box.js b/pr/3561/docs/type.impl/alloc/boxed/struct.Box.js index 74912f784d..846828355c 100644 --- a/pr/3561/docs/type.impl/alloc/boxed/struct.Box.js +++ b/pr/3561/docs/type.impl/alloc/boxed/struct.Box.js @@ -1,9 +1,9 @@ (function() { - var type_impls = Object.fromEntries([["iroh_relay",[["
§

impl<T> AsBacktrace for Box<T>
where\n T: AsBacktrace,

§

fn as_backtrace(&self) -> Option<&Backtrace>

Retrieve the optional backtrace
","AsBacktrace","iroh_relay::dns::BoxIter"],["
1.64.0 · Source§

impl<T> AsFd for Box<T>
where\n T: AsFd + ?Sized,

Source§

fn as_fd(&self) -> BorrowedFd<'_>

Borrows the file descriptor. Read more
","AsFd","iroh_relay::dns::BoxIter"],["
1.5.0 · Source§

impl<T, A> AsMut<T> for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn as_mut(&mut self) -> &mut T

Converts this type into a mutable reference of the (usually inferred) input type.
","AsMut","iroh_relay::dns::BoxIter"],["
1.63.0 · Source§

impl<T> AsRawFd for Box<T>
where\n T: AsRawFd,

Source§

fn as_raw_fd(&self) -> i32

Extracts the raw file descriptor. Read more
","AsRawFd","iroh_relay::dns::BoxIter"],["
1.5.0 · Source§

impl<T, A> AsRef<T> for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
","AsRef","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncBufRead for Box<T>
where\n T: AsyncBufRead + Unpin + ?Sized,

§

fn poll_fill_buf(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<&[u8], Error>>

Attempt to return the contents of the internal buffer, filling it with more data\nfrom the inner reader if it is empty. Read more
§

fn consume(self: Pin<&mut Box<T>>, amt: usize)

Tells this buffer that amt bytes have been consumed from the buffer,\nso they should no longer be returned in calls to poll_read. Read more
","AsyncBufRead","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncBufRead for Box<T>
where\n T: AsyncBufRead + Unpin + ?Sized,

§

fn poll_fill_buf(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<&[u8], Error>>

Attempts to return the contents of the internal buffer, filling it with more data\nfrom the inner reader if it is empty. Read more
§

fn consume(self: Pin<&mut Box<T>>, amt: usize)

Tells this buffer that amt bytes have been consumed from the buffer,\nso they should no longer be returned in calls to poll_read. Read more
","AsyncBufRead","iroh_relay::dns::BoxIter"],["
1.85.0 · Source§

impl<Args, F, A> AsyncFn<Args> for Box<F, A>
where\n Args: Tuple,\n F: AsyncFn<Args> + ?Sized,\n A: Allocator,

Source§

extern "rust-call" fn async_call(\n &self,\n args: Args,\n) -> <Box<F, A> as AsyncFnMut<Args>>::CallRefFuture<'_>

🔬This is a nightly-only experimental API. (async_fn_traits)
Call the AsyncFn, returning a future which may borrow from the called closure.
","AsyncFn","iroh_relay::dns::BoxIter"],["
1.85.0 · Source§

impl<Args, F, A> AsyncFnMut<Args> for Box<F, A>
where\n Args: Tuple,\n F: AsyncFnMut<Args> + ?Sized,\n A: Allocator,

Source§

type CallRefFuture<'a> = <F as AsyncFnMut<Args>>::CallRefFuture<'a>\nwhere\n Box<F, A>: 'a

🔬This is a nightly-only experimental API. (async_fn_traits)
Source§

extern "rust-call" fn async_call_mut(\n &mut self,\n args: Args,\n) -> <Box<F, A> as AsyncFnMut<Args>>::CallRefFuture<'_>

🔬This is a nightly-only experimental API. (async_fn_traits)
Call the AsyncFnMut, returning a future which may borrow from the called closure.
","AsyncFnMut","iroh_relay::dns::BoxIter"],["
1.85.0 · Source§

impl<Args, F, A> AsyncFnOnce<Args> for Box<F, A>
where\n Args: Tuple,\n F: AsyncFnOnce<Args> + ?Sized,\n A: Allocator,

Source§

type Output = <F as AsyncFnOnce<Args>>::Output

🔬This is a nightly-only experimental API. (async_fn_traits)
Output type of the called closure’s future.
Source§

type CallOnceFuture = <F as AsyncFnOnce<Args>>::CallOnceFuture

🔬This is a nightly-only experimental API. (async_fn_traits)
Future returned by AsyncFnOnce::async_call_once.
Source§

extern "rust-call" fn async_call_once(\n self,\n args: Args,\n) -> <Box<F, A> as AsyncFnOnce<Args>>::CallOnceFuture

🔬This is a nightly-only experimental API. (async_fn_traits)
Call the AsyncFnOnce, returning a future which may move out of the called closure.
","AsyncFnOnce","iroh_relay::dns::BoxIter"],["
Source§

impl<S> AsyncIterator for Box<S>
where\n S: AsyncIterator + Unpin + ?Sized,

Source§

type Item = <S as AsyncIterator>::Item

🔬This is a nightly-only experimental API. (async_iterator)
The type of items yielded by the async iterator.
Source§

fn poll_next(\n self: Pin<&mut Box<S>>,\n cx: &mut Context<'_>,\n) -> Poll<Option<<Box<S> as AsyncIterator>::Item>>

🔬This is a nightly-only experimental API. (async_iterator)
Attempts to pull out the next value of this async iterator, registering the\ncurrent task for wakeup if the value is not yet available, and returning\nNone if the async iterator is exhausted. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

🔬This is a nightly-only experimental API. (async_iterator)
Returns the bounds on the remaining length of the async iterator. Read more
","AsyncIterator","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncRead for Box<T>
where\n T: AsyncRead + Unpin + ?Sized,

§

fn poll_read(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n buf: &mut ReadBuf<'_>,\n) -> Poll<Result<(), Error>>

Attempts to read from the AsyncRead into buf. Read more
","AsyncRead","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncRead for Box<T>
where\n T: AsyncRead + Unpin + ?Sized,

§

fn poll_read(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n buf: &mut [u8],\n) -> Poll<Result<usize, Error>>

Attempt to read from the AsyncRead into buf. Read more
§

fn poll_read_vectored(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n bufs: &mut [IoSliceMut<'_>],\n) -> Poll<Result<usize, Error>>

Attempt to read from the AsyncRead into bufs using vectored\nIO operations. Read more
","AsyncRead","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncSeek for Box<T>
where\n T: AsyncSeek + Unpin + ?Sized,

§

fn poll_seek(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n pos: SeekFrom,\n) -> Poll<Result<u64, Error>>

Attempt to seek to an offset, in bytes, in a stream. Read more
","AsyncSeek","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncSeek for Box<T>
where\n T: AsyncSeek + Unpin + ?Sized,

§

fn start_seek(self: Pin<&mut Box<T>>, pos: SeekFrom) -> Result<(), Error>

Attempts to seek to an offset, in bytes, in a stream. Read more
§

fn poll_complete(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<u64, Error>>

Waits for a seek operation to complete. Read more
","AsyncSeek","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncWrite for Box<T>
where\n T: AsyncWrite + Unpin + ?Sized,

§

fn poll_write(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n buf: &[u8],\n) -> Poll<Result<usize, Error>>

Attempt to write bytes from buf into the object. Read more
§

fn poll_write_vectored(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n bufs: &[IoSlice<'_>],\n) -> Poll<Result<usize, Error>>

Attempt to write bytes from bufs into the object using vectored\nIO operations. Read more
§

fn poll_flush(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), Error>>

Attempt to flush the object, ensuring that any buffered data reach\ntheir destination. Read more
§

fn poll_close(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), Error>>

Attempt to close the object. Read more
","AsyncWrite","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncWrite for Box<T>
where\n T: AsyncWrite + Unpin + ?Sized,

§

fn poll_write(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n buf: &[u8],\n) -> Poll<Result<usize, Error>>

Attempt to write bytes from buf into the object. Read more
§

fn poll_write_vectored(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n bufs: &[IoSlice<'_>],\n) -> Poll<Result<usize, Error>>

Like poll_write, except that it writes from a slice of buffers. Read more
§

fn is_write_vectored(&self) -> bool

Determines if this writer has an efficient poll_write_vectored\nimplementation. Read more
§

fn poll_flush(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), Error>>

Attempts to flush the object, ensuring that any buffered data reach\ntheir destination. Read more
§

fn poll_shutdown(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), Error>>

Initiates or attempts to shut down this writer, returning success when\nthe I/O connection has completely shut down. Read more
","AsyncWrite","iroh_relay::dns::BoxIter"],["
§

impl<T> Body for Box<T>
where\n T: Body + Unpin + ?Sized,

§

type Data = <T as Body>::Data

Values yielded by the Body.
§

type Error = <T as Body>::Error

The error type this Body might generate.
§

fn poll_frame(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Option<Result<Frame<<Box<T> as Body>::Data>, <Box<T> as Body>::Error>>>

Attempt to pull out the next data buffer of this stream.
§

fn is_end_stream(&self) -> bool

Returns true when the end of stream has been reached. Read more
§

fn size_hint(&self) -> SizeHint

Returns the bounds on the remaining length of the stream. Read more
","Body","iroh_relay::dns::BoxIter"],["
1.1.0 · Source§

impl<T, A> Borrow<T> for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
","Borrow","iroh_relay::dns::BoxIter"],["
1.1.0 · Source§

impl<T, A> BorrowMut<T> for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
","BorrowMut","iroh_relay::dns::BoxIter"],["
Source§

impl<T> Box<T>
where\n T: ?Sized,

1.4.0 · Source

pub unsafe fn from_raw(raw: *mut T) -> Box<T>

Available on crate feature server only.

Constructs a box from a raw pointer.

\n

After calling this function, the raw pointer is owned by the\nresulting Box. Specifically, the Box destructor will call\nthe destructor of T and free the allocated memory. For this\nto be safe, the memory must have been allocated in accordance\nwith the memory layout used by Box .

\n
§Safety
\n

This function is unsafe because improper use may lead to\nmemory problems. For example, a double-free may occur if the\nfunction is called twice on the same raw pointer.

\n

The raw pointer must point to a block of memory allocated by the global allocator.

\n

The safety conditions are described in the memory layout section.

\n
§Examples
\n

Recreate a Box which was previously converted to a raw pointer\nusing Box::into_raw:

\n\n
let x = Box::new(5);\nlet ptr = Box::into_raw(x);\nlet x = unsafe { Box::from_raw(ptr) };
\n

Manually create a Box from scratch by using the global allocator:

\n\n
use std::alloc::{alloc, Layout};\n\nunsafe {\n    let ptr = alloc(Layout::new::<i32>()) as *mut i32;\n    // In general .write is required to avoid attempting to destruct\n    // the (uninitialized) previous contents of `ptr`, though for this\n    // simple example `*ptr = 5` would have worked as well.\n    ptr.write(5);\n    let x = Box::from_raw(ptr);\n}
Source

pub unsafe fn from_non_null(ptr: NonNull<T>) -> Box<T>

🔬This is a nightly-only experimental API. (box_vec_non_null)
Available on crate feature server only.

Constructs a box from a NonNull pointer.

\n

After calling this function, the NonNull pointer is owned by\nthe resulting Box. Specifically, the Box destructor will call\nthe destructor of T and free the allocated memory. For this\nto be safe, the memory must have been allocated in accordance\nwith the memory layout used by Box .

\n
§Safety
\n

This function is unsafe because improper use may lead to\nmemory problems. For example, a double-free may occur if the\nfunction is called twice on the same NonNull pointer.

\n

The non-null pointer must point to a block of memory allocated by the global allocator.

\n

The safety conditions are described in the memory layout section.

\n
§Examples
\n

Recreate a Box which was previously converted to a NonNull\npointer using Box::into_non_null:

\n\n
#![feature(box_vec_non_null)]\n\nlet x = Box::new(5);\nlet non_null = Box::into_non_null(x);\nlet x = unsafe { Box::from_non_null(non_null) };
\n

Manually create a Box from scratch by using the global allocator:

\n\n
#![feature(box_vec_non_null)]\n\nuse std::alloc::{alloc, Layout};\nuse std::ptr::NonNull;\n\nunsafe {\n    let non_null = NonNull::new(alloc(Layout::new::<i32>()).cast::<i32>())\n        .expect(\"allocation failed\");\n    // In general .write is required to avoid attempting to destruct\n    // the (uninitialized) previous contents of `non_null`.\n    non_null.write(5);\n    let x = Box::from_non_null(non_null);\n}
1.4.0 · Source

pub fn into_raw(b: Box<T>) -> *mut T

Available on crate feature server only.

Consumes the Box, returning a wrapped raw pointer.

\n

The pointer will be properly aligned and non-null.

\n

After calling this function, the caller is responsible for the\nmemory previously managed by the Box. In particular, the\ncaller should properly destroy T and release the memory, taking\ninto account the memory layout used by Box. The easiest way to\ndo this is to convert the raw pointer back into a Box with the\nBox::from_raw function, allowing the Box destructor to perform\nthe cleanup.

\n

Note: this is an associated function, which means that you have\nto call it as Box::into_raw(b) instead of b.into_raw(). This\nis so that there is no conflict with a method on the inner type.

\n
§Examples
\n

Converting the raw pointer back into a Box with Box::from_raw\nfor automatic cleanup:

\n\n
let x = Box::new(String::from(\"Hello\"));\nlet ptr = Box::into_raw(x);\nlet x = unsafe { Box::from_raw(ptr) };
\n

Manual cleanup by explicitly running the destructor and deallocating\nthe memory:

\n\n
use std::alloc::{dealloc, Layout};\nuse std::ptr;\n\nlet x = Box::new(String::from(\"Hello\"));\nlet ptr = Box::into_raw(x);\nunsafe {\n    ptr::drop_in_place(ptr);\n    dealloc(ptr as *mut u8, Layout::new::<String>());\n}
\n

Note: This is equivalent to the following:

\n\n
let x = Box::new(String::from(\"Hello\"));\nlet ptr = Box::into_raw(x);\nunsafe {\n    drop(Box::from_raw(ptr));\n}
Source

pub fn into_non_null(b: Box<T>) -> NonNull<T>

🔬This is a nightly-only experimental API. (box_vec_non_null)
Available on crate feature server only.

Consumes the Box, returning a wrapped NonNull pointer.

\n

The pointer will be properly aligned.

\n

After calling this function, the caller is responsible for the\nmemory previously managed by the Box. In particular, the\ncaller should properly destroy T and release the memory, taking\ninto account the memory layout used by Box. The easiest way to\ndo this is to convert the NonNull pointer back into a Box with the\nBox::from_non_null function, allowing the Box destructor to\nperform the cleanup.

\n

Note: this is an associated function, which means that you have\nto call it as Box::into_non_null(b) instead of b.into_non_null().\nThis is so that there is no conflict with a method on the inner type.

\n
§Examples
\n

Converting the NonNull pointer back into a Box with Box::from_non_null\nfor automatic cleanup:

\n\n
#![feature(box_vec_non_null)]\n\nlet x = Box::new(String::from(\"Hello\"));\nlet non_null = Box::into_non_null(x);\nlet x = unsafe { Box::from_non_null(non_null) };
\n

Manual cleanup by explicitly running the destructor and deallocating\nthe memory:

\n\n
#![feature(box_vec_non_null)]\n\nuse std::alloc::{dealloc, Layout};\n\nlet x = Box::new(String::from(\"Hello\"));\nlet non_null = Box::into_non_null(x);\nunsafe {\n    non_null.drop_in_place();\n    dealloc(non_null.as_ptr().cast::<u8>(), Layout::new::<String>());\n}
\n

Note: This is equivalent to the following:

\n\n
#![feature(box_vec_non_null)]\n\nlet x = Box::new(String::from(\"Hello\"));\nlet non_null = Box::into_non_null(x);\nunsafe {\n    drop(Box::from_non_null(non_null));\n}
",0,"iroh_relay::dns::BoxIter"],["
Source§

impl<T> Box<T>

1.0.0 · Source

pub fn new(x: T) -> Box<T>

Available on crate feature server only.

Allocates memory on the heap and then places x into it.

\n

This doesn’t actually allocate if T is zero-sized.

\n
§Examples
\n
let five = Box::new(5);
1.82.0 · Source

pub fn new_uninit() -> Box<MaybeUninit<T>>

Available on crate feature server only.

Constructs a new box with uninitialized contents.

\n
§Examples
\n
let mut five = Box::<u32>::new_uninit();\n// Deferred initialization:\nfive.write(5);\nlet five = unsafe { five.assume_init() };\n\nassert_eq!(*five, 5)
1.92.0 · Source

pub fn new_zeroed() -> Box<MaybeUninit<T>>

Available on crate feature server only.

Constructs a new Box with uninitialized contents, with the memory\nbeing filled with 0 bytes.

\n

See MaybeUninit::zeroed for examples of correct and incorrect usage\nof this method.

\n
§Examples
\n
let zero = Box::<u32>::new_zeroed();\nlet zero = unsafe { zero.assume_init() };\n\nassert_eq!(*zero, 0)
1.33.0 · Source

pub fn pin(x: T) -> Pin<Box<T>>

Available on crate feature server only.

Constructs a new Pin<Box<T>>. If T does not implement Unpin, then\nx will be pinned in memory and unable to be moved.

\n

Constructing and pinning of the Box can also be done in two steps: Box::pin(x)\ndoes the same as Box::into_pin(Box::new(x)). Consider using\ninto_pin if you already have a Box<T>, or if you want to\nconstruct a (pinned) Box in a different way than with Box::new.

\n
Source

pub fn try_new(x: T) -> Result<Box<T>, AllocError>

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Allocates memory on the heap then places x into it,\nreturning an error if the allocation fails

\n

This doesn’t actually allocate if T is zero-sized.

\n
§Examples
\n
#![feature(allocator_api)]\n\nlet five = Box::try_new(5)?;
Source

pub fn try_new_uninit() -> Result<Box<MaybeUninit<T>>, AllocError>

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new box with uninitialized contents on the heap,\nreturning an error if the allocation fails

\n
§Examples
\n
#![feature(allocator_api)]\n\nlet mut five = Box::<u32>::try_new_uninit()?;\n// Deferred initialization:\nfive.write(5);\nlet five = unsafe { five.assume_init() };\n\nassert_eq!(*five, 5);
Source

pub fn try_new_zeroed() -> Result<Box<MaybeUninit<T>>, AllocError>

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new Box with uninitialized contents, with the memory\nbeing filled with 0 bytes on the heap

\n

See MaybeUninit::zeroed for examples of correct and incorrect usage\nof this method.

\n
§Examples
\n
#![feature(allocator_api)]\n\nlet zero = Box::<u32>::try_new_zeroed()?;\nlet zero = unsafe { zero.assume_init() };\n\nassert_eq!(*zero, 0);
",0,"iroh_relay::dns::BoxIter"],["
Source§

impl<T, A> Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source

pub unsafe fn from_raw_in(raw: *mut T, alloc: A) -> Box<T, A>

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a box from a raw pointer in the given allocator.

\n

After calling this function, the raw pointer is owned by the\nresulting Box. Specifically, the Box destructor will call\nthe destructor of T and free the allocated memory. For this\nto be safe, the memory must have been allocated in accordance\nwith the memory layout used by Box .

\n
§Safety
\n

This function is unsafe because improper use may lead to\nmemory problems. For example, a double-free may occur if the\nfunction is called twice on the same raw pointer.

\n

The raw pointer must point to a block of memory allocated by alloc.

\n
§Examples
\n

Recreate a Box which was previously converted to a raw pointer\nusing Box::into_raw_with_allocator:

\n\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet x = Box::new_in(5, System);\nlet (ptr, alloc) = Box::into_raw_with_allocator(x);\nlet x = unsafe { Box::from_raw_in(ptr, alloc) };
\n

Manually create a Box from scratch by using the system allocator:

\n\n
#![feature(allocator_api, slice_ptr_get)]\n\nuse std::alloc::{Allocator, Layout, System};\n\nunsafe {\n    let ptr = System.allocate(Layout::new::<i32>())?.as_mut_ptr() as *mut i32;\n    // In general .write is required to avoid attempting to destruct\n    // the (uninitialized) previous contents of `ptr`, though for this\n    // simple example `*ptr = 5` would have worked as well.\n    ptr.write(5);\n    let x = Box::from_raw_in(ptr, System);\n}
Source

pub unsafe fn from_non_null_in(raw: NonNull<T>, alloc: A) -> Box<T, A>

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a box from a NonNull pointer in the given allocator.

\n

After calling this function, the NonNull pointer is owned by\nthe resulting Box. Specifically, the Box destructor will call\nthe destructor of T and free the allocated memory. For this\nto be safe, the memory must have been allocated in accordance\nwith the memory layout used by Box .

\n
§Safety
\n

This function is unsafe because improper use may lead to\nmemory problems. For example, a double-free may occur if the\nfunction is called twice on the same raw pointer.

\n

The non-null pointer must point to a block of memory allocated by alloc.

\n
§Examples
\n

Recreate a Box which was previously converted to a NonNull pointer\nusing Box::into_non_null_with_allocator:

\n\n
#![feature(allocator_api, box_vec_non_null)]\n\nuse std::alloc::System;\n\nlet x = Box::new_in(5, System);\nlet (non_null, alloc) = Box::into_non_null_with_allocator(x);\nlet x = unsafe { Box::from_non_null_in(non_null, alloc) };
\n

Manually create a Box from scratch by using the system allocator:

\n\n
#![feature(allocator_api, box_vec_non_null, slice_ptr_get)]\n\nuse std::alloc::{Allocator, Layout, System};\n\nunsafe {\n    let non_null = System.allocate(Layout::new::<i32>())?.cast::<i32>();\n    // In general .write is required to avoid attempting to destruct\n    // the (uninitialized) previous contents of `non_null`.\n    non_null.write(5);\n    let x = Box::from_non_null_in(non_null, System);\n}
Source

pub fn into_raw_with_allocator(b: Box<T, A>) -> (*mut T, A)

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Consumes the Box, returning a wrapped raw pointer and the allocator.

\n

The pointer will be properly aligned and non-null.

\n

After calling this function, the caller is responsible for the\nmemory previously managed by the Box. In particular, the\ncaller should properly destroy T and release the memory, taking\ninto account the memory layout used by Box. The easiest way to\ndo this is to convert the raw pointer back into a Box with the\nBox::from_raw_in function, allowing the Box destructor to perform\nthe cleanup.

\n

Note: this is an associated function, which means that you have\nto call it as Box::into_raw_with_allocator(b) instead of b.into_raw_with_allocator(). This\nis so that there is no conflict with a method on the inner type.

\n
§Examples
\n

Converting the raw pointer back into a Box with Box::from_raw_in\nfor automatic cleanup:

\n\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet x = Box::new_in(String::from(\"Hello\"), System);\nlet (ptr, alloc) = Box::into_raw_with_allocator(x);\nlet x = unsafe { Box::from_raw_in(ptr, alloc) };
\n

Manual cleanup by explicitly running the destructor and deallocating\nthe memory:

\n\n
#![feature(allocator_api)]\n\nuse std::alloc::{Allocator, Layout, System};\nuse std::ptr::{self, NonNull};\n\nlet x = Box::new_in(String::from(\"Hello\"), System);\nlet (ptr, alloc) = Box::into_raw_with_allocator(x);\nunsafe {\n    ptr::drop_in_place(ptr);\n    let non_null = NonNull::new_unchecked(ptr);\n    alloc.deallocate(non_null.cast(), Layout::new::<String>());\n}
Source

pub fn into_non_null_with_allocator(b: Box<T, A>) -> (NonNull<T>, A)

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Consumes the Box, returning a wrapped NonNull pointer and the allocator.

\n

The pointer will be properly aligned.

\n

After calling this function, the caller is responsible for the\nmemory previously managed by the Box. In particular, the\ncaller should properly destroy T and release the memory, taking\ninto account the memory layout used by Box. The easiest way to\ndo this is to convert the NonNull pointer back into a Box with the\nBox::from_non_null_in function, allowing the Box destructor to\nperform the cleanup.

\n

Note: this is an associated function, which means that you have\nto call it as Box::into_non_null_with_allocator(b) instead of\nb.into_non_null_with_allocator(). This is so that there is no\nconflict with a method on the inner type.

\n
§Examples
\n

Converting the NonNull pointer back into a Box with\nBox::from_non_null_in for automatic cleanup:

\n\n
#![feature(allocator_api, box_vec_non_null)]\n\nuse std::alloc::System;\n\nlet x = Box::new_in(String::from(\"Hello\"), System);\nlet (non_null, alloc) = Box::into_non_null_with_allocator(x);\nlet x = unsafe { Box::from_non_null_in(non_null, alloc) };
\n

Manual cleanup by explicitly running the destructor and deallocating\nthe memory:

\n\n
#![feature(allocator_api, box_vec_non_null)]\n\nuse std::alloc::{Allocator, Layout, System};\n\nlet x = Box::new_in(String::from(\"Hello\"), System);\nlet (non_null, alloc) = Box::into_non_null_with_allocator(x);\nunsafe {\n    non_null.drop_in_place();\n    alloc.deallocate(non_null.cast::<u8>(), Layout::new::<String>());\n}
Source

pub fn as_mut_ptr(b: &mut Box<T, A>) -> *mut T

🔬This is a nightly-only experimental API. (box_as_ptr)
Available on crate feature server only.

Returns a raw mutable pointer to the Box’s contents.

\n

The caller must ensure that the Box outlives the pointer this\nfunction returns, or else it will end up dangling.

\n

This method guarantees that for the purpose of the aliasing model, this method\ndoes not materialize a reference to the underlying memory, and thus the returned pointer\nwill remain valid when mixed with other calls to as_ptr and as_mut_ptr.\nNote that calling other methods that materialize references to the memory\nmay still invalidate this pointer.\nSee the example below for how this guarantee can be used.

\n
§Examples
\n

Due to the aliasing guarantee, the following code is legal:

\n\n
#![feature(box_as_ptr)]\n\nunsafe {\n    let mut b = Box::new(0);\n    let ptr1 = Box::as_mut_ptr(&mut b);\n    ptr1.write(1);\n    let ptr2 = Box::as_mut_ptr(&mut b);\n    ptr2.write(2);\n    // Notably, the write to `ptr2` did *not* invalidate `ptr1`:\n    ptr1.write(3);\n}
Source

pub fn as_ptr(b: &Box<T, A>) -> *const T

🔬This is a nightly-only experimental API. (box_as_ptr)
Available on crate feature server only.

Returns a raw pointer to the Box’s contents.

\n

The caller must ensure that the Box outlives the pointer this\nfunction returns, or else it will end up dangling.

\n

The caller must also ensure that the memory the pointer (non-transitively) points to\nis never written to (except inside an UnsafeCell) using this pointer or any pointer\nderived from it. If you need to mutate the contents of the Box, use as_mut_ptr.

\n

This method guarantees that for the purpose of the aliasing model, this method\ndoes not materialize a reference to the underlying memory, and thus the returned pointer\nwill remain valid when mixed with other calls to as_ptr and as_mut_ptr.\nNote that calling other methods that materialize mutable references to the memory,\nas well as writing to this memory, may still invalidate this pointer.\nSee the example below for how this guarantee can be used.

\n
§Examples
\n

Due to the aliasing guarantee, the following code is legal:

\n\n
#![feature(box_as_ptr)]\n\nunsafe {\n    let mut v = Box::new(0);\n    let ptr1 = Box::as_ptr(&v);\n    let ptr2 = Box::as_mut_ptr(&mut v);\n    let _val = ptr2.read();\n    // No write to this memory has happened yet, so `ptr1` is still valid.\n    let _val = ptr1.read();\n    // However, once we do a write...\n    ptr2.write(1);\n    // ... `ptr1` is no longer valid.\n    // This would be UB: let _val = ptr1.read();\n}
Source

pub fn allocator(b: &Box<T, A>) -> &A

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Returns a reference to the underlying allocator.

\n

Note: this is an associated function, which means that you have\nto call it as Box::allocator(&b) instead of b.allocator(). This\nis so that there is no conflict with a method on the inner type.

\n
1.26.0 · Source

pub fn leak<'a>(b: Box<T, A>) -> &'a mut T
where\n A: 'a,

Available on crate feature server only.

Consumes and leaks the Box, returning a mutable reference,\n&'a mut T.

\n

Note that the type T must outlive the chosen lifetime 'a. If the type\nhas only static references, or none at all, then this may be chosen to be\n'static.

\n

This function is mainly useful for data that lives for the remainder of\nthe program’s life. Dropping the returned reference will cause a memory\nleak. If this is not acceptable, the reference should first be wrapped\nwith the Box::from_raw function producing a Box. This Box can\nthen be dropped which will properly destroy T and release the\nallocated memory.

\n

Note: this is an associated function, which means that you have\nto call it as Box::leak(b) instead of b.leak(). This\nis so that there is no conflict with a method on the inner type.

\n
§Examples
\n

Simple usage:

\n\n
let x = Box::new(41);\nlet static_ref: &'static mut usize = Box::leak(x);\n*static_ref += 1;\nassert_eq!(*static_ref, 42);
\n

Unsized data:

\n\n
let x = vec![1, 2, 3].into_boxed_slice();\nlet static_ref = Box::leak(x);\nstatic_ref[0] = 4;\nassert_eq!(*static_ref, [4, 2, 3]);
1.63.0 · Source

pub fn into_pin(boxed: Box<T, A>) -> Pin<Box<T, A>>
where\n A: 'static,

Available on crate feature server only.

Converts a Box<T> into a Pin<Box<T>>. If T does not implement Unpin, then\n*boxed will be pinned in memory and unable to be moved.

\n

This conversion does not allocate on the heap and happens in place.

\n

This is also available via From.

\n

Constructing and pinning a Box with Box::into_pin(Box::new(x))\ncan also be written more concisely using Box::pin(x).\nThis into_pin method is useful if you already have a Box<T>, or you are\nconstructing a (pinned) Box in a different way than with Box::new.

\n
§Notes
\n

It’s not recommended that crates add an impl like From<Box<T>> for Pin<T>,\nas it’ll introduce an ambiguity when calling Pin::from.\nA demonstration of such a poor impl is shown below.

\n\n
ⓘ
struct Foo; // A type defined in this crate.\nimpl From<Box<()>> for Pin<Foo> {\n    fn from(_: Box<()>) -> Pin<Foo> {\n        Pin::new(Foo)\n    }\n}\n\nlet foo = Box::new(());\nlet bar = Pin::from(foo);
",0,"iroh_relay::dns::BoxIter"],["
Source§

impl<T, A> Box<T, A>
where\n A: Allocator,

Source

pub fn new_in(x: T, alloc: A) -> Box<T, A>
where\n A: Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Allocates memory in the given allocator then places x into it.

\n

This doesn’t actually allocate if T is zero-sized.

\n
§Examples
\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet five = Box::new_in(5, System);
Source

pub fn try_new_in(x: T, alloc: A) -> Result<Box<T, A>, AllocError>
where\n A: Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Allocates memory in the given allocator then places x into it,\nreturning an error if the allocation fails

\n

This doesn’t actually allocate if T is zero-sized.

\n
§Examples
\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet five = Box::try_new_in(5, System)?;
Source

pub fn new_uninit_in(alloc: A) -> Box<MaybeUninit<T>, A>
where\n A: Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new box with uninitialized contents in the provided allocator.

\n
§Examples
\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet mut five = Box::<u32, _>::new_uninit_in(System);\n// Deferred initialization:\nfive.write(5);\nlet five = unsafe { five.assume_init() };\n\nassert_eq!(*five, 5)
Source

pub fn try_new_uninit_in(alloc: A) -> Result<Box<MaybeUninit<T>, A>, AllocError>
where\n A: Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new box with uninitialized contents in the provided allocator,\nreturning an error if the allocation fails

\n
§Examples
\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet mut five = Box::<u32, _>::try_new_uninit_in(System)?;\n// Deferred initialization:\nfive.write(5);\nlet five = unsafe { five.assume_init() };\n\nassert_eq!(*five, 5);
Source

pub fn new_zeroed_in(alloc: A) -> Box<MaybeUninit<T>, A>
where\n A: Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new Box with uninitialized contents, with the memory\nbeing filled with 0 bytes in the provided allocator.

\n

See MaybeUninit::zeroed for examples of correct and incorrect usage\nof this method.

\n
§Examples
\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet zero = Box::<u32, _>::new_zeroed_in(System);\nlet zero = unsafe { zero.assume_init() };\n\nassert_eq!(*zero, 0)
Source

pub fn try_new_zeroed_in(alloc: A) -> Result<Box<MaybeUninit<T>, A>, AllocError>
where\n A: Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new Box with uninitialized contents, with the memory\nbeing filled with 0 bytes in the provided allocator,\nreturning an error if the allocation fails,

\n

See MaybeUninit::zeroed for examples of correct and incorrect usage\nof this method.

\n
§Examples
\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet zero = Box::<u32, _>::try_new_zeroed_in(System)?;\nlet zero = unsafe { zero.assume_init() };\n\nassert_eq!(*zero, 0);
Source

pub fn pin_in(x: T, alloc: A) -> Pin<Box<T, A>>
where\n A: 'static + Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new Pin<Box<T, A>>. If T does not implement Unpin, then\nx will be pinned in memory and unable to be moved.

\n

Constructing and pinning of the Box can also be done in two steps: Box::pin_in(x, alloc)\ndoes the same as Box::into_pin(Box::new_in(x, alloc)). Consider using\ninto_pin if you already have a Box<T, A>, or if you want to\nconstruct a (pinned) Box in a different way than with Box::new_in.

\n
Source

pub fn into_boxed_slice(boxed: Box<T, A>) -> Box<[T], A>

🔬This is a nightly-only experimental API. (box_into_boxed_slice)
Available on crate feature server only.

Converts a Box<T> into a Box<[T]>

\n

This conversion does not allocate on the heap and happens in place.

\n
Source

pub fn into_inner(boxed: Box<T, A>) -> T

🔬This is a nightly-only experimental API. (box_into_inner)
Available on crate feature server only.

Consumes the Box, returning the wrapped value.

\n
§Examples
\n
#![feature(box_into_inner)]\n\nlet c = Box::new(5);\n\nassert_eq!(Box::into_inner(c), 5);
Source

pub fn take(boxed: Box<T, A>) -> (T, Box<MaybeUninit<T>, A>)

🔬This is a nightly-only experimental API. (box_take)
Available on crate feature server only.

Consumes the Box without consuming its allocation, returning the wrapped value and a Box\nto the uninitialized memory where the wrapped value used to live.

\n

This can be used together with write to reuse the allocation for multiple\nboxed values.

\n
§Examples
\n
#![feature(box_take)]\n\nlet c = Box::new(5);\n\n// take the value out of the box\nlet (value, uninit) = Box::take(c);\nassert_eq!(value, 5);\n\n// reuse the box for a second value\nlet c = Box::write(uninit, 6);\nassert_eq!(*c, 6);
",0,"iroh_relay::dns::BoxIter"],["
§

impl<T> Buf for Box<T>
where\n T: Buf + ?Sized,

§

fn remaining(&self) -> usize

Returns the number of bytes between the current position and the end of\nthe buffer. Read more
§

fn chunk(&self) -> &[u8] ⓘ

Returns a slice starting at the current position and of length between 0\nand Buf::remaining(). Note that this can return a shorter slice (this\nallows non-continuous internal representation). Read more
§

fn chunks_vectored<'b>(&'b self, dst: &mut [IoSlice<'b>]) -> usize

Fills dst with potentially multiple slices starting at self’s\ncurrent position. Read more
§

fn advance(&mut self, cnt: usize)

Advance the internal cursor of the Buf Read more
§

fn has_remaining(&self) -> bool

Returns true if there are any more bytes to consume Read more
§

fn copy_to_slice(&mut self, dst: &mut [u8])

Copies bytes from self into dst. Read more
§

fn get_u8(&mut self) -> u8

Gets an unsigned 8 bit integer from self. Read more
§

fn get_i8(&mut self) -> i8

Gets a signed 8 bit integer from self. Read more
§

fn get_u16(&mut self) -> u16

Gets an unsigned 16 bit integer from self in big-endian byte order. Read more
§

fn get_u16_le(&mut self) -> u16

Gets an unsigned 16 bit integer from self in little-endian byte order. Read more
§

fn get_u16_ne(&mut self) -> u16

Gets an unsigned 16 bit integer from self in native-endian byte order. Read more
§

fn get_i16(&mut self) -> i16

Gets a signed 16 bit integer from self in big-endian byte order. Read more
§

fn get_i16_le(&mut self) -> i16

Gets a signed 16 bit integer from self in little-endian byte order. Read more
§

fn get_i16_ne(&mut self) -> i16

Gets a signed 16 bit integer from self in native-endian byte order. Read more
§

fn get_u32(&mut self) -> u32

Gets an unsigned 32 bit integer from self in the big-endian byte order. Read more
§

fn get_u32_le(&mut self) -> u32

Gets an unsigned 32 bit integer from self in the little-endian byte order. Read more
§

fn get_u32_ne(&mut self) -> u32

Gets an unsigned 32 bit integer from self in native-endian byte order. Read more
§

fn get_i32(&mut self) -> i32

Gets a signed 32 bit integer from self in big-endian byte order. Read more
§

fn get_i32_le(&mut self) -> i32

Gets a signed 32 bit integer from self in little-endian byte order. Read more
§

fn get_i32_ne(&mut self) -> i32

Gets a signed 32 bit integer from self in native-endian byte order. Read more
§

fn get_u64(&mut self) -> u64

Gets an unsigned 64 bit integer from self in big-endian byte order. Read more
§

fn get_u64_le(&mut self) -> u64

Gets an unsigned 64 bit integer from self in little-endian byte order. Read more
§

fn get_u64_ne(&mut self) -> u64

Gets an unsigned 64 bit integer from self in native-endian byte order. Read more
§

fn get_i64(&mut self) -> i64

Gets a signed 64 bit integer from self in big-endian byte order. Read more
§

fn get_i64_le(&mut self) -> i64

Gets a signed 64 bit integer from self in little-endian byte order. Read more
§

fn get_i64_ne(&mut self) -> i64

Gets a signed 64 bit integer from self in native-endian byte order. Read more
§

fn get_u128(&mut self) -> u128

Gets an unsigned 128 bit integer from self in big-endian byte order. Read more
§

fn get_u128_le(&mut self) -> u128

Gets an unsigned 128 bit integer from self in little-endian byte order. Read more
§

fn get_u128_ne(&mut self) -> u128

Gets an unsigned 128 bit integer from self in native-endian byte order. Read more
§

fn get_i128(&mut self) -> i128

Gets a signed 128 bit integer from self in big-endian byte order. Read more
§

fn get_i128_le(&mut self) -> i128

Gets a signed 128 bit integer from self in little-endian byte order. Read more
§

fn get_i128_ne(&mut self) -> i128

Gets a signed 128 bit integer from self in native-endian byte order. Read more
§

fn get_uint(&mut self, nbytes: usize) -> u64

Gets an unsigned n-byte integer from self in big-endian byte order. Read more
§

fn get_uint_le(&mut self, nbytes: usize) -> u64

Gets an unsigned n-byte integer from self in little-endian byte order. Read more
§

fn get_uint_ne(&mut self, nbytes: usize) -> u64

Gets an unsigned n-byte integer from self in native-endian byte order. Read more
§

fn get_int(&mut self, nbytes: usize) -> i64

Gets a signed n-byte integer from self in big-endian byte order. Read more
§

fn get_int_le(&mut self, nbytes: usize) -> i64

Gets a signed n-byte integer from self in little-endian byte order. Read more
§

fn get_int_ne(&mut self, nbytes: usize) -> i64

Gets a signed n-byte integer from self in native-endian byte order. Read more
§

fn get_f32(&mut self) -> f32

Gets an IEEE754 single-precision (4 bytes) floating point number from\nself in big-endian byte order. Read more
§

fn get_f32_le(&mut self) -> f32

Gets an IEEE754 single-precision (4 bytes) floating point number from\nself in little-endian byte order. Read more
§

fn get_f32_ne(&mut self) -> f32

Gets an IEEE754 single-precision (4 bytes) floating point number from\nself in native-endian byte order. Read more
§

fn get_f64(&mut self) -> f64

Gets an IEEE754 double-precision (8 bytes) floating point number from\nself in big-endian byte order. Read more
§

fn get_f64_le(&mut self) -> f64

Gets an IEEE754 double-precision (8 bytes) floating point number from\nself in little-endian byte order. Read more
§

fn get_f64_ne(&mut self) -> f64

Gets an IEEE754 double-precision (8 bytes) floating point number from\nself in native-endian byte order. Read more
§

fn try_copy_to_slice(&mut self, dst: &mut [u8]) -> Result<(), TryGetError>

Copies bytes from self into dst. Read more
§

fn try_get_u8(&mut self) -> Result<u8, TryGetError>

Gets an unsigned 8 bit integer from self. Read more
§

fn try_get_i8(&mut self) -> Result<i8, TryGetError>

Gets a signed 8 bit integer from self. Read more
§

fn try_get_u16(&mut self) -> Result<u16, TryGetError>

Gets an unsigned 16 bit integer from self in big-endian byte order. Read more
§

fn try_get_u16_le(&mut self) -> Result<u16, TryGetError>

Gets an unsigned 16 bit integer from self in little-endian byte order. Read more
§

fn try_get_u16_ne(&mut self) -> Result<u16, TryGetError>

Gets an unsigned 16 bit integer from self in native-endian byte order. Read more
§

fn try_get_i16(&mut self) -> Result<i16, TryGetError>

Gets a signed 16 bit integer from self in big-endian byte order. Read more
§

fn try_get_i16_le(&mut self) -> Result<i16, TryGetError>

Gets an signed 16 bit integer from self in little-endian byte order. Read more
§

fn try_get_i16_ne(&mut self) -> Result<i16, TryGetError>

Gets a signed 16 bit integer from self in native-endian byte order. Read more
§

fn try_get_u32(&mut self) -> Result<u32, TryGetError>

Gets an unsigned 32 bit integer from self in big-endian byte order. Read more
§

fn try_get_u32_le(&mut self) -> Result<u32, TryGetError>

Gets an unsigned 32 bit integer from self in little-endian byte order. Read more
§

fn try_get_u32_ne(&mut self) -> Result<u32, TryGetError>

Gets an unsigned 32 bit integer from self in native-endian byte order. Read more
§

fn try_get_i32(&mut self) -> Result<i32, TryGetError>

Gets a signed 32 bit integer from self in big-endian byte order. Read more
§

fn try_get_i32_le(&mut self) -> Result<i32, TryGetError>

Gets a signed 32 bit integer from self in little-endian byte order. Read more
§

fn try_get_i32_ne(&mut self) -> Result<i32, TryGetError>

Gets a signed 32 bit integer from self in native-endian byte order. Read more
§

fn try_get_u64(&mut self) -> Result<u64, TryGetError>

Gets an unsigned 64 bit integer from self in big-endian byte order. Read more
§

fn try_get_u64_le(&mut self) -> Result<u64, TryGetError>

Gets an unsigned 64 bit integer from self in little-endian byte order. Read more
§

fn try_get_u64_ne(&mut self) -> Result<u64, TryGetError>

Gets an unsigned 64 bit integer from self in native-endian byte order. Read more
§

fn try_get_i64(&mut self) -> Result<i64, TryGetError>

Gets a signed 64 bit integer from self in big-endian byte order. Read more
§

fn try_get_i64_le(&mut self) -> Result<i64, TryGetError>

Gets a signed 64 bit integer from self in little-endian byte order. Read more
§

fn try_get_i64_ne(&mut self) -> Result<i64, TryGetError>

Gets a signed 64 bit integer from self in native-endian byte order. Read more
§

fn try_get_u128(&mut self) -> Result<u128, TryGetError>

Gets an unsigned 128 bit integer from self in big-endian byte order. Read more
§

fn try_get_u128_le(&mut self) -> Result<u128, TryGetError>

Gets an unsigned 128 bit integer from self in little-endian byte order. Read more
§

fn try_get_u128_ne(&mut self) -> Result<u128, TryGetError>

Gets an unsigned 128 bit integer from self in native-endian byte order. Read more
§

fn try_get_i128(&mut self) -> Result<i128, TryGetError>

Gets a signed 128 bit integer from self in big-endian byte order. Read more
§

fn try_get_i128_le(&mut self) -> Result<i128, TryGetError>

Gets a signed 128 bit integer from self in little-endian byte order. Read more
§

fn try_get_i128_ne(&mut self) -> Result<i128, TryGetError>

Gets a signed 128 bit integer from self in native-endian byte order. Read more
§

fn try_get_uint(&mut self, nbytes: usize) -> Result<u64, TryGetError>

Gets an unsigned n-byte integer from self in big-endian byte order. Read more
§

fn try_get_uint_le(&mut self, nbytes: usize) -> Result<u64, TryGetError>

Gets an unsigned n-byte integer from self in little-endian byte order. Read more
§

fn try_get_uint_ne(&mut self, nbytes: usize) -> Result<u64, TryGetError>

Gets an unsigned n-byte integer from self in native-endian byte order. Read more
§

fn try_get_int(&mut self, nbytes: usize) -> Result<i64, TryGetError>

Gets a signed n-byte integer from self in big-endian byte order. Read more
§

fn try_get_int_le(&mut self, nbytes: usize) -> Result<i64, TryGetError>

Gets a signed n-byte integer from self in little-endian byte order. Read more
§

fn try_get_int_ne(&mut self, nbytes: usize) -> Result<i64, TryGetError>

Gets a signed n-byte integer from self in native-endian byte order. Read more
§

fn try_get_f32(&mut self) -> Result<f32, TryGetError>

Gets an IEEE754 single-precision (4 bytes) floating point number from\nself in big-endian byte order. Read more
§

fn try_get_f32_le(&mut self) -> Result<f32, TryGetError>

Gets an IEEE754 single-precision (4 bytes) floating point number from\nself in little-endian byte order. Read more
§

fn try_get_f32_ne(&mut self) -> Result<f32, TryGetError>

Gets an IEEE754 single-precision (4 bytes) floating point number from\nself in native-endian byte order. Read more
§

fn try_get_f64(&mut self) -> Result<f64, TryGetError>

Gets an IEEE754 double-precision (8 bytes) floating point number from\nself in big-endian byte order. Read more
§

fn try_get_f64_le(&mut self) -> Result<f64, TryGetError>

Gets an IEEE754 double-precision (8 bytes) floating point number from\nself in little-endian byte order. Read more
§

fn try_get_f64_ne(&mut self) -> Result<f64, TryGetError>

Gets an IEEE754 double-precision (8 bytes) floating point number from\nself in native-endian byte order. Read more
§

fn copy_to_bytes(&mut self, len: usize) -> Bytes

Consumes len bytes inside self and returns new instance of Bytes\nwith this data. Read more
§

fn take(self, limit: usize) -> Take<Self>
where\n Self: Sized,

Creates an adaptor which will read at most limit bytes from self. Read more
§

fn chain<U>(self, next: U) -> Chain<Self, U>
where\n U: Buf,\n Self: Sized,

Creates an adaptor which will chain this buffer with another. Read more
§

fn reader(self) -> Reader<Self>
where\n Self: Sized,

Creates an adaptor which implements the Read trait for self. Read more
","Buf","iroh_relay::dns::BoxIter"],["
§

impl<T> BufMut for Box<T>
where\n T: BufMut + ?Sized,

§

fn remaining_mut(&self) -> usize

Returns the number of bytes that can be written from the current\nposition until the end of the buffer is reached. Read more
§

fn chunk_mut(&mut self) -> &mut UninitSlice

Returns a mutable slice starting at the current BufMut position and of\nlength between 0 and BufMut::remaining_mut(). Note that this can be shorter than the\nwhole remainder of the buffer (this allows non-continuous implementation). Read more
§

unsafe fn advance_mut(&mut self, cnt: usize)

Advance the internal cursor of the BufMut Read more
§

fn put_slice(&mut self, src: &[u8])

Transfer bytes into self from src and advance the cursor by the\nnumber of bytes written. Read more
§

fn put_u8(&mut self, n: u8)

Writes an unsigned 8 bit integer to self. Read more
§

fn put_i8(&mut self, n: i8)

Writes a signed 8 bit integer to self. Read more
§

fn put_u16(&mut self, n: u16)

Writes an unsigned 16 bit integer to self in big-endian byte order. Read more
§

fn put_u16_le(&mut self, n: u16)

Writes an unsigned 16 bit integer to self in little-endian byte order. Read more
§

fn put_u16_ne(&mut self, n: u16)

Writes an unsigned 16 bit integer to self in native-endian byte order. Read more
§

fn put_i16(&mut self, n: i16)

Writes a signed 16 bit integer to self in big-endian byte order. Read more
§

fn put_i16_le(&mut self, n: i16)

Writes a signed 16 bit integer to self in little-endian byte order. Read more
§

fn put_i16_ne(&mut self, n: i16)

Writes a signed 16 bit integer to self in native-endian byte order. Read more
§

fn put_u32(&mut self, n: u32)

Writes an unsigned 32 bit integer to self in big-endian byte order. Read more
§

fn put_u32_le(&mut self, n: u32)

Writes an unsigned 32 bit integer to self in little-endian byte order. Read more
§

fn put_u32_ne(&mut self, n: u32)

Writes an unsigned 32 bit integer to self in native-endian byte order. Read more
§

fn put_i32(&mut self, n: i32)

Writes a signed 32 bit integer to self in big-endian byte order. Read more
§

fn put_i32_le(&mut self, n: i32)

Writes a signed 32 bit integer to self in little-endian byte order. Read more
§

fn put_i32_ne(&mut self, n: i32)

Writes a signed 32 bit integer to self in native-endian byte order. Read more
§

fn put_u64(&mut self, n: u64)

Writes an unsigned 64 bit integer to self in the big-endian byte order. Read more
§

fn put_u64_le(&mut self, n: u64)

Writes an unsigned 64 bit integer to self in little-endian byte order. Read more
§

fn put_u64_ne(&mut self, n: u64)

Writes an unsigned 64 bit integer to self in native-endian byte order. Read more
§

fn put_i64(&mut self, n: i64)

Writes a signed 64 bit integer to self in the big-endian byte order. Read more
§

fn put_i64_le(&mut self, n: i64)

Writes a signed 64 bit integer to self in little-endian byte order. Read more
§

fn put_i64_ne(&mut self, n: i64)

Writes a signed 64 bit integer to self in native-endian byte order. Read more
§

fn has_remaining_mut(&self) -> bool

Returns true if there is space in self for more bytes. Read more
§

fn put<T>(&mut self, src: T)
where\n T: Buf,\n Self: Sized,

Transfer bytes into self from src and advance the cursor by the\nnumber of bytes written. Read more
§

fn put_bytes(&mut self, val: u8, cnt: usize)

Put cnt bytes val into self. Read more
§

fn put_u128(&mut self, n: u128)

Writes an unsigned 128 bit integer to self in the big-endian byte order. Read more
§

fn put_u128_le(&mut self, n: u128)

Writes an unsigned 128 bit integer to self in little-endian byte order. Read more
§

fn put_u128_ne(&mut self, n: u128)

Writes an unsigned 128 bit integer to self in native-endian byte order. Read more
§

fn put_i128(&mut self, n: i128)

Writes a signed 128 bit integer to self in the big-endian byte order. Read more
§

fn put_i128_le(&mut self, n: i128)

Writes a signed 128 bit integer to self in little-endian byte order. Read more
§

fn put_i128_ne(&mut self, n: i128)

Writes a signed 128 bit integer to self in native-endian byte order. Read more
§

fn put_uint(&mut self, n: u64, nbytes: usize)

Writes an unsigned n-byte integer to self in big-endian byte order. Read more
§

fn put_uint_le(&mut self, n: u64, nbytes: usize)

Writes an unsigned n-byte integer to self in the little-endian byte order. Read more
§

fn put_uint_ne(&mut self, n: u64, nbytes: usize)

Writes an unsigned n-byte integer to self in the native-endian byte order. Read more
§

fn put_int(&mut self, n: i64, nbytes: usize)

Writes low nbytes of a signed integer to self in big-endian byte order. Read more
§

fn put_int_le(&mut self, n: i64, nbytes: usize)

Writes low nbytes of a signed integer to self in little-endian byte order. Read more
§

fn put_int_ne(&mut self, n: i64, nbytes: usize)

Writes low nbytes of a signed integer to self in native-endian byte order. Read more
§

fn put_f32(&mut self, n: f32)

Writes an IEEE754 single-precision (4 bytes) floating point number to\nself in big-endian byte order. Read more
§

fn put_f32_le(&mut self, n: f32)

Writes an IEEE754 single-precision (4 bytes) floating point number to\nself in little-endian byte order. Read more
§

fn put_f32_ne(&mut self, n: f32)

Writes an IEEE754 single-precision (4 bytes) floating point number to\nself in native-endian byte order. Read more
§

fn put_f64(&mut self, n: f64)

Writes an IEEE754 double-precision (8 bytes) floating point number to\nself in big-endian byte order. Read more
§

fn put_f64_le(&mut self, n: f64)

Writes an IEEE754 double-precision (8 bytes) floating point number to\nself in little-endian byte order. Read more
§

fn put_f64_ne(&mut self, n: f64)

Writes an IEEE754 double-precision (8 bytes) floating point number to\nself in native-endian byte order. Read more
§

fn limit(self, limit: usize) -> Limit<Self>
where\n Self: Sized,

Creates an adaptor which can write at most limit bytes to self. Read more
§

fn writer(self) -> Writer<Self>
where\n Self: Sized,

Creates an adaptor which implements the Write trait for self. Read more
§

fn chain_mut<U>(self, next: U) -> Chain<Self, U>
where\n U: BufMut,\n Self: Sized,

Creates an adapter which will chain this buffer with another. Read more
","BufMut","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<B> BufRead for Box<B>
where\n B: BufRead + ?Sized,

Source§

fn fill_buf(&mut self) -> Result<&[u8], Error>

Returns the contents of the internal buffer, filling it with more data, via Read methods, if empty. Read more
Source§

fn consume(&mut self, amt: usize)

Marks the given amount of additional bytes from the internal buffer as having been read.\nSubsequent calls to read only return bytes that have not been marked as read. Read more
Source§

fn has_data_left(&mut self) -> Result<bool, Error>

🔬This is a nightly-only experimental API. (buf_read_has_data_left)
Checks if there is any data left to be read. Read more
Source§

fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize, Error>

Reads all bytes into buf until the delimiter byte or EOF is reached. Read more
Source§

fn skip_until(&mut self, byte: u8) -> Result<usize, Error>

Skips all bytes until the delimiter byte or EOF is reached. Read more
Source§

fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>

Reads all bytes until a newline (the 0xA byte) is reached, and append\nthem to the provided String buffer. Read more
1.0.0 · Source§

fn split(self, byte: u8) -> Split<Self>
where\n Self: Sized,

Returns an iterator over the contents of this reader split on the byte\nbyte. Read more
1.0.0 · Source§

fn lines(self) -> Lines<Self>
where\n Self: Sized,

Returns an iterator over the lines of this reader. Read more
","BufRead","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Clone for Box<T, A>
where\n T: Clone,\n A: Allocator + Clone,

Source§

fn clone(&self) -> Box<T, A>

Returns a new box with a clone() of this box’s contents.

\n
§Examples
\n
let x = Box::new(5);\nlet y = x.clone();\n\n// The value is the same\nassert_eq!(x, y);\n\n// But they are unique objects\nassert_ne!(&*x as *const i32, &*y as *const i32);
Source§

fn clone_from(&mut self, source: &Box<T, A>)

Copies source’s contents into self without creating a new allocation.

\n
§Examples
\n
let x = Box::new(5);\nlet mut y = Box::new(10);\nlet yp: *const i32 = &*y;\n\ny.clone_from(&x);\n\n// The value is the same\nassert_eq!(x, y);\n\n// And no allocation occurred\nassert_eq!(yp, &*y);
","Clone","iroh_relay::dns::BoxIter"],["
Source§

impl<G, R, A> Coroutine<R> for Box<G, A>
where\n G: Coroutine<R> + Unpin + ?Sized,\n A: Allocator,

Source§

type Yield = <G as Coroutine<R>>::Yield

🔬This is a nightly-only experimental API. (coroutine_trait)
The type of value this coroutine yields. Read more
Source§

type Return = <G as Coroutine<R>>::Return

🔬This is a nightly-only experimental API. (coroutine_trait)
The type of value this coroutine returns. Read more
Source§

fn resume(\n self: Pin<&mut Box<G, A>>,\n arg: R,\n) -> CoroutineState<<Box<G, A> as Coroutine<R>>::Yield, <Box<G, A> as Coroutine<R>>::Return>

🔬This is a nightly-only experimental API. (coroutine_trait)
Resumes the execution of this coroutine. Read more
","Coroutine","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Debug for Box<T, A>
where\n T: Debug + ?Sized,\n A: Allocator,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Debug","iroh_relay::dns::BoxIter"],["
§

impl<'a, T> DecodeValue<'a> for Box<T>
where\n T: DecodeValue<'a>,

§

type Error = <T as DecodeValue<'a>>::Error

Type returned in the event of a decoding error.
§

fn decode_value<R>(\n reader: &mut R,\n header: Header,\n) -> Result<Box<T>, <Box<T> as DecodeValue<'a>>::Error>
where\n R: Reader<'a>,

Attempt to decode this message using the provided [Reader].
","DecodeValue<'a>","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T> Default for Box<T>
where\n T: Default,

Source§

fn default() -> Box<T>

Creates a Box<T>, with the Default value for T.

\n
","Default","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Deref for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
","Deref","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> DerefMut for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn deref_mut(&mut self) -> &mut T

Mutably dereferences the value.
","DerefMut","iroh_relay::dns::BoxIter"],["
Source§

impl<'de, T> Deserialize<'de> for Box<T>
where\n T: Deserialize<'de>,

Source§

fn deserialize<D>(\n deserializer: D,\n) -> Result<Box<T>, <D as Deserializer<'de>>::Error>
where\n D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
","Deserialize<'de>","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Display for Box<T, A>
where\n T: Display + ?Sized,\n A: Allocator,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Display","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<I, A> DoubleEndedIterator for Box<I, A>
where\n I: DoubleEndedIterator + ?Sized,\n A: Allocator,

Source§

fn next_back(&mut self) -> Option<<I as Iterator>::Item>

Removes and returns an element from the end of the iterator. Read more
Source§

fn nth_back(&mut self, n: usize) -> Option<<I as Iterator>::Item>

Returns the nth element from the end of the iterator. Read more
Source§

fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator from the back by n elements. Read more
1.27.0 · Source§

fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where\n Self: Sized,\n F: FnMut(B, Self::Item) -> R,\n R: Try<Output = B>,

This is the reverse version of Iterator::try_fold(): it takes\nelements starting from the back of the iterator. Read more
1.27.0 · Source§

fn rfold<B, F>(self, init: B, f: F) -> B
where\n Self: Sized,\n F: FnMut(B, Self::Item) -> B,

An iterator method that reduces the iterator’s elements to a single,\nfinal value, starting from the back. Read more
1.27.0 · Source§

fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator from the back that satisfies a predicate. Read more
","DoubleEndedIterator","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Drop for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
","Drop","iroh_relay::dns::BoxIter"],["
§

impl<T> EncodeAsVarULE<T> for Box<T>
where\n T: VarULE + ?Sized,

§

fn encode_var_ule_as_slices<R>(&self, cb: impl FnOnce(&[&[u8]]) -> R) -> R

Calls cb with a piecewise list of byte slices that when concatenated\nproduce the memory pattern of the corresponding instance of T. Read more
§

fn encode_var_ule_len(&self) -> usize

Return the length, in bytes, of the corresponding [VarULE] type
§

fn encode_var_ule_write(&self, dst: &mut [u8])

Write the corresponding [VarULE] type to the dst buffer. dst should\nbe the size of [Self::encode_var_ule_len()]
","EncodeAsVarULE","iroh_relay::dns::BoxIter"],["
§

impl<T> EncodeValue for Box<T>
where\n T: EncodeValue,

§

fn value_len(&self) -> Result<Length, Error>

Compute the length of this value (sans [Tag]+[Length] header) when\nencoded as ASN.1 DER.
§

fn encode_value(&self, writer: &mut impl Writer) -> Result<(), Error>

Encode value (sans [Tag]+[Length] header) as ASN.1 DER using the\nprovided [Writer].
§

fn header(&self) -> Result<Header, Error>
where\n Self: Tagged,

Get the [Header] used to encode this value.
","EncodeValue","iroh_relay::dns::BoxIter"],["
1.8.0 · Source§

impl<E> Error for Box<E>
where\n E: Error,

Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
Source§

fn provide<'b>(&'b self, request: &mut Request<'b>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
","Error","iroh_relay::dns::BoxIter"],["
§

impl<E> ErrorCompat for Box<E>
where\n E: ErrorCompat,

§

fn backtrace(&self) -> Option<&Backtrace>

Returns a [Backtrace][] that may be printed.
§

fn iter_chain(&self) -> ChainCompat<'_, '_>
where\n Self: AsErrorSource,

Returns an iterator for traversing the chain of errors,\nstarting with the current error\nand continuing with recursive calls to Error::source. Read more
","ErrorCompat","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<I, A> ExactSizeIterator for Box<I, A>
where\n I: ExactSizeIterator + ?Sized,\n A: Allocator,

Source§

fn len(&self) -> usize

Returns the exact remaining length of the iterator. Read more
Source§

fn is_empty(&self) -> bool

🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
","ExactSizeIterator","iroh_relay::dns::BoxIter"],["
1.35.0 · Source§

impl<Args, F, A> Fn<Args> for Box<F, A>
where\n Args: Tuple,\n F: Fn<Args> + ?Sized,\n A: Allocator,

Source§

extern "rust-call" fn call(\n &self,\n args: Args,\n) -> <Box<F, A> as FnOnce<Args>>::Output

🔬This is a nightly-only experimental API. (fn_traits)
Performs the call operation.
","Fn","iroh_relay::dns::BoxIter"],["
1.35.0 · Source§

impl<Args, F, A> FnMut<Args> for Box<F, A>
where\n Args: Tuple,\n F: FnMut<Args> + ?Sized,\n A: Allocator,

Source§

extern "rust-call" fn call_mut(\n &mut self,\n args: Args,\n) -> <Box<F, A> as FnOnce<Args>>::Output

🔬This is a nightly-only experimental API. (fn_traits)
Performs the call operation.
","FnMut","iroh_relay::dns::BoxIter"],["
1.35.0 · Source§

impl<Args, F, A> FnOnce<Args> for Box<F, A>
where\n Args: Tuple,\n F: FnOnce<Args> + ?Sized,\n A: Allocator,

Source§

type Output = <F as FnOnce<Args>>::Output

The returned type after the call operator is used.
Source§

extern "rust-call" fn call_once(\n self,\n args: Args,\n) -> <Box<F, A> as FnOnce<Args>>::Output

🔬This is a nightly-only experimental API. (fn_traits)
Performs the call operation.
","FnOnce","iroh_relay::dns::BoxIter"],["
1.6.0 · Source§

impl<T> From<T> for Box<T>

Source§

fn from(t: T) -> Box<T>

Converts a T into a Box<T>

\n

The conversion allocates on the heap and moves t\nfrom the stack into it.

\n
§Examples
\n
let x = 5;\nlet boxed = Box::new(5);\n\nassert_eq!(Box::from(x), boxed);
","From","iroh_relay::dns::BoxIter"],["
§

impl<F> FusedFuture for Box<F>
where\n F: FusedFuture + Unpin + ?Sized,

§

fn is_terminated(&self) -> bool

Returns true if the underlying future should no longer be polled.
","FusedFuture","iroh_relay::dns::BoxIter"],["
§

impl<S> FusedStream for Box<S>
where\n S: FusedStream + Unpin + ?Sized,

§

fn is_terminated(&self) -> bool

Returns true if the stream should no longer be polled.
","FusedStream","iroh_relay::dns::BoxIter"],["
1.36.0 · Source§

impl<F, A> Future for Box<F, A>
where\n F: Future + Unpin + ?Sized,\n A: Allocator,

Source§

type Output = <F as Future>::Output

The type of value produced on completion.
Source§

fn poll(\n self: Pin<&mut Box<F, A>>,\n cx: &mut Context<'_>,\n) -> Poll<<Box<F, A> as Future>::Output>

Attempts to resolve the future to a final value, registering\nthe current task for wakeup if the value is not yet available. Read more
","Future","iroh_relay::dns::BoxIter"],["
§

impl<T> GenerateImplicitData for Box<T>
where\n T: GenerateImplicitData,

§

fn generate() -> Box<T>

Build the data.
§

fn generate_with_source(source: &dyn Error) -> Box<T>
where\n Box<T>: Sized,

Build the data using the given source
","GenerateImplicitData","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Hash for Box<T, A>
where\n T: Hash + ?Sized,\n A: Allocator,

Source§

fn hash<H>(&self, state: &mut H)
where\n H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where\n H: Hasher,\n Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
","Hash","iroh_relay::dns::BoxIter"],["
1.22.0 · Source§

impl<T, A> Hasher for Box<T, A>
where\n T: Hasher + ?Sized,\n A: Allocator,

Source§

fn finish(&self) -> u64

Returns the hash value for the values written so far. Read more
Source§

fn write(&mut self, bytes: &[u8])

Writes some data into this Hasher. Read more
Source§

fn write_u8(&mut self, i: u8)

Writes a single u8 into this hasher.
Source§

fn write_u16(&mut self, i: u16)

Writes a single u16 into this hasher.
Source§

fn write_u32(&mut self, i: u32)

Writes a single u32 into this hasher.
Source§

fn write_u64(&mut self, i: u64)

Writes a single u64 into this hasher.
Source§

fn write_u128(&mut self, i: u128)

Writes a single u128 into this hasher.
Source§

fn write_usize(&mut self, i: usize)

Writes a single usize into this hasher.
Source§

fn write_i8(&mut self, i: i8)

Writes a single i8 into this hasher.
Source§

fn write_i16(&mut self, i: i16)

Writes a single i16 into this hasher.
Source§

fn write_i32(&mut self, i: i32)

Writes a single i32 into this hasher.
Source§

fn write_i64(&mut self, i: i64)

Writes a single i64 into this hasher.
Source§

fn write_i128(&mut self, i: i128)

Writes a single i128 into this hasher.
Source§

fn write_isize(&mut self, i: isize)

Writes a single isize into this hasher.
Source§

fn write_length_prefix(&mut self, len: usize)

🔬This is a nightly-only experimental API. (hasher_prefixfree_extras)
Writes a length prefix into this hasher, as part of being prefix-free. Read more
Source§

fn write_str(&mut self, s: &str)

🔬This is a nightly-only experimental API. (hasher_prefixfree_extras)
Writes a single str into this hasher. Read more
","Hasher","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<I, A> Iterator for Box<I, A>
where\n I: Iterator + ?Sized,\n A: Allocator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<<I as Iterator>::Item>

Advances the iterator and returns the next value. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
Source§

fn nth(&mut self, n: usize) -> Option<<I as Iterator>::Item>

Returns the nth element of the iterator. Read more
Source§

fn last(self) -> Option<<I as Iterator>::Item>

Consumes the iterator, returning the last element. Read more
Source§

fn next_chunk<const N: usize>(\n &mut self,\n) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn count(self) -> usize
where\n Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where\n Self: Sized,

Creates an iterator starting at the same point, but stepping by\nthe given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where\n Self: Sized,\n U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where\n Self: Sized,\n U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where\n Self: Sized,\n Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent\nitems of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where\n Self: Sized,\n G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator\nbetween adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where\n Self: Sized,\n F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each\nelement. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where\n Self: Sized,\n F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element\nshould be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where\n Self: Sized,\n F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where\n Self: Sized,

Creates an iterator which gives the current iteration count as well as\nthe next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where\n Self: Sized,

Creates an iterator which can use the peek and peek_mut methods\nto look at the next element of the iterator without consuming it. See\ntheir documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where\n Self: Sized,\n P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where\n Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where\n Self: Sized,

Creates an iterator that yields the first n elements, or fewer\nif the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where\n Self: Sized,\n F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but\nunlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where\n Self: Sized,\n U: IntoIterator,\n F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
1.29.0 · Source§

fn flatten(self) -> Flatten<Self>
where\n Self: Sized,\n Self::Item: IntoIterator,

Creates an iterator that flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where\n Self: Sized,\n F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over\nself and returns an iterator over the outputs of f. Like slice::windows(),\nthe windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where\n Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where\n Self: Sized,\n F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where\n Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where\n B: FromIterator<Self::Item>,\n Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn try_collect<B>(\n &mut self,\n) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
where\n Self: Sized,\n Self::Item: Try,\n <Self::Item as Try>::Residual: Residual<B>,\n B: FromIterator<<Self::Item as Try>::Output>,

🔬This is a nightly-only experimental API. (iterator_try_collect)
Fallibly transforms an iterator into a collection, short circuiting if\na failure is encountered. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where\n E: Extend<Self::Item>,\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where\n Self: Sized,\n B: Default + Extend<Self::Item>,\n F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
where\n T: 'a,\n Self: Sized + DoubleEndedIterator<Item = &'a mut T>,\n P: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (iter_partition_in_place)
Reorders the elements of this iterator in-place according to the given predicate,\nsuch that all those that return true precede all those that return false.\nReturns the number of true elements found. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where\n Self: Sized,\n P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate,\nsuch that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where\n Self: Sized,\n F: FnMut(B, Self::Item) -> R,\n R: Try<Output = B>,

An iterator method that applies a function as long as it returns\nsuccessfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where\n Self: Sized,\n F: FnMut(Self::Item) -> R,\n R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the\niterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where\n Self: Sized,\n F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation,\nreturning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where\n Self: Sized,\n F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing\noperation. Read more
Source§

fn try_reduce<R>(\n &mut self,\n f: impl FnMut(Self::Item, Self::Item) -> R,\n) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where\n Self: Sized,\n R: Try<Output = Self::Item>,\n <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the\nclosure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where\n Self: Sized,\n F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where\n Self: Sized,\n F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where\n Self: Sized,\n F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns\nthe first non-none result. Read more
Source§

fn try_find<R>(\n &mut self,\n f: impl FnMut(&Self::Item) -> R,\n) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where\n Self: Sized,\n R: Try<Output = bool>,\n <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns\nthe first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where\n Self: Sized,\n P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · Source§

fn rposition<P>(&mut self, predicate: P) -> Option<usize>
where\n P: FnMut(Self::Item) -> bool,\n Self: Sized + ExactSizeIterator + DoubleEndedIterator,

Searches for an element in an iterator from the right, returning its\nindex. Read more
1.0.0 · Source§

fn max(self) -> Option<Self::Item>
where\n Self: Sized,\n Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · Source§

fn min(self) -> Option<Self::Item>
where\n Self: Sized,\n Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where\n B: Ord,\n Self: Sized,\n F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the\nspecified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the\nspecified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where\n B: Ord,\n Self: Sized,\n F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the\nspecified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the\nspecified comparison function. Read more
1.0.0 · Source§

fn rev(self) -> Rev<Self>
where\n Self: Sized + DoubleEndedIterator,

Reverses an iterator’s direction. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where\n FromA: Default + Extend<A>,\n FromB: Default + Extend<B>,\n Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where\n T: Copy + 'a,\n Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where\n T: Clone + 'a,\n Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
1.0.0 · Source§

fn cycle(self) -> Cycle<Self>
where\n Self: Sized + Clone,

Repeats an iterator endlessly. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where\n Self: Sized,\n S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where\n Self: Sized,\n P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · Source§

fn cmp<I>(self, other: I) -> Ordering
where\n I: IntoIterator<Item = Self::Item>,\n Self::Item: Ord,\n Self: Sized,

Lexicographically compares the elements of this Iterator with those\nof another. Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those\nof another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Lexicographically compares the PartialOrd elements of\nthis Iterator with those of another. The comparison works like short-circuit\nevaluation, returning a result without comparing the remaining elements.\nAs soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those\nof another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialEq<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are equal to those of\nanother. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of\nanother with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialEq<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are not equal to those of\nanother. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\nless than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\nless or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\ngreater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\ngreater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted(self) -> bool
where\n Self: Sized,\n Self::Item: PartialOrd,

Checks if the elements of this iterator are sorted. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where\n Self: Sized,\n F: FnMut(Self::Item) -> K,\n K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction\nfunction. Read more
","Iterator","iroh_relay::dns::BoxIter"],["
§

impl<Sp> LocalSpawn for Box<Sp>
where\n Sp: LocalSpawn + ?Sized,

§

fn spawn_local_obj(\n &self,\n future: LocalFutureObj<'static, ()>,\n) -> Result<(), SpawnError>

Spawns a future that will be run to completion. Read more
§

fn status_local(&self) -> Result<(), SpawnError>

Determines whether the executor is able to spawn new tasks. Read more
","LocalSpawn","iroh_relay::dns::BoxIter"],["
Source§

impl<T> Log for Box<T>
where\n T: Log + ?Sized,

Source§

fn enabled(&self, metadata: &Metadata<'_>) -> bool

Determines if a log message with the specified metadata would be\nlogged. Read more
Source§

fn log(&self, record: &Record<'_>)

Logs the Record. Read more
Source§

fn flush(&self)

Flushes any buffered records. Read more
","Log","iroh_relay::dns::BoxIter"],["
§

impl<T> MaxSize for Box<T>
where\n T: MaxSize,

§

const POSTCARD_MAX_SIZE: usize = T::POSTCARD_MAX_SIZE

The maximum possible size that the serialization of this\ntype can have, in bytes.
","MaxSize","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Ord for Box<T, A>
where\n T: Ord + ?Sized,\n A: Allocator,

Source§

fn cmp(&self, other: &Box<T, A>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where\n Self: Sized,

Restrict a value to a certain interval. Read more
","Ord","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> PartialEq for Box<T, A>
where\n T: PartialEq + ?Sized,\n A: Allocator,

Source§

fn eq(&self, other: &Box<T, A>) -> bool

Tests for self and other values to be equal, and is used by ==.
Source§

fn ne(&self, other: &Box<T, A>) -> bool

Tests for !=. The default implementation is almost always sufficient,\nand should not be overridden without very good reason.
","PartialEq","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> PartialOrd for Box<T, A>
where\n T: PartialOrd + ?Sized,\n A: Allocator,

Source§

fn partial_cmp(&self, other: &Box<T, A>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
Source§

fn lt(&self, other: &Box<T, A>) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
Source§

fn le(&self, other: &Box<T, A>) -> bool

Tests less than or equal to (for self and other) and is used by the\n<= operator. Read more
Source§

fn ge(&self, other: &Box<T, A>) -> bool

Tests greater than or equal to (for self and other) and is used by\nthe >= operator. Read more
Source§

fn gt(&self, other: &Box<T, A>) -> bool

Tests greater than (for self and other) and is used by the >\noperator. Read more
","PartialOrd","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Pointer for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Pointer","iroh_relay::dns::BoxIter"],["
§

impl<B, E, P> Policy<B, E> for Box<P>
where\n P: Policy<B, E> + ?Sized,

§

fn redirect(&mut self, attempt: &Attempt<'_>) -> Result<Action, E>

Invoked when the service received a response with a redirection status code (3xx). Read more
§

fn on_request(&mut self, request: &mut Request<B>)

Invoked right before the service makes a request, regardless of whether it is redirected\nor not. Read more
§

fn clone_body(&self, body: &B) -> Option<B>

Try to clone a request body before the service makes a redirected request. Read more
","Policy","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<R> Read for Box<R>
where\n R: Read + ?Sized,

Source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>

Pull some bytes from this source into the specified buffer, returning\nhow many bytes were read. Read more
Source§

fn read_buf(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
Source§

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Like read, except that it reads into a slice of buffers. Read more
Source§

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Reader has an efficient read_vectored\nimplementation. Read more
Source§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

Reads all bytes until EOF in this source, placing them into buf. Read more
Source§

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

Reads all bytes until EOF in this source, appending them to buf. Read more
Source§

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

Reads the exact number of bytes required to fill buf. Read more
Source§

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Reads the exact number of bytes required to fill cursor. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where\n Self: Sized,

Creates a “by reference” adapter for this instance of Read. Read more
1.0.0 · Source§

fn bytes(self) -> Bytes<Self>
where\n Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more
1.0.0 · Source§

fn chain<R>(self, next: R) -> Chain<Self, R>
where\n R: Read,\n Self: Sized,

Creates an adapter which will chain this stream with another. Read more
1.0.0 · Source§

fn take(self, limit: u64) -> Take<Self>
where\n Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
","Read","iroh_relay::dns::BoxIter"],["
§

impl<T> Read for Box<T>
where\n T: Read + Unpin + ?Sized,

§

fn poll_read(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n buf: ReadBufCursor<'_>,\n) -> Poll<Result<(), Error>>

Attempts to read bytes into the buf. Read more
","Read","iroh_relay::dns::BoxIter"],["
§

impl<R> Rng for Box<R>
where\n R: Rng + ?Sized,

§

fn next_u64(&mut self) -> u64

Generate a random u64.
§

fn next_f64(&mut self) -> f64

Generate a random f64 between [0, 1).
§

fn next_range(&mut self, range: Range<u64>) -> u64

Randomly pick a value within the range. Read more
","Rng","iroh_relay::dns::BoxIter"],["
Source§

impl<R> RngCore for Box<R>
where\n R: RngCore + ?Sized,

Source§

fn next_u32(&mut self) -> u32

Return the next random u32. Read more
Source§

fn next_u64(&mut self) -> u64

Return the next random u64. Read more
Source§

fn fill_bytes(&mut self, dest: &mut [u8])

Fill dest with random data. Read more
Source§

fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>

Fill dest entirely with random data. Read more
","RngCore","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<S> Seek for Box<S>
where\n S: Seek + ?Sized,

Source§

fn seek(&mut self, pos: SeekFrom) -> Result<u64, Error>

Seek to an offset, in bytes, in a stream. Read more
Source§

fn rewind(&mut self) -> Result<(), Error>

Rewind to the beginning of a stream. Read more
Source§

fn stream_len(&mut self) -> Result<u64, Error>

🔬This is a nightly-only experimental API. (seek_stream_len)
Returns the length of this stream (in bytes). Read more
Source§

fn stream_position(&mut self) -> Result<u64, Error>

Returns the current seek position from the start of the stream. Read more
Source§

fn seek_relative(&mut self, offset: i64) -> Result<(), Error>

Seeks relative to the current position. Read more
","Seek","iroh_relay::dns::BoxIter"],["
Source§

impl<T> Serialize for Box<T>
where\n T: Serialize + ?Sized,

Source§

fn serialize<S>(\n &self,\n serializer: S,\n) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where\n S: Serializer,

","Serialize","iroh_relay::dns::BoxIter"],["
Source§

impl<T> Serialize for Box<T>
where\n T: Serialize + ?Sized,

Source§

fn serialize<S>(\n &self,\n serializer: S,\n) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where\n S: Serializer,

Serialize this value into the given Serde serializer. Read more
","Serialize","iroh_relay::dns::BoxIter"],["
§

impl<Request, S> Service<Request> for Box<S>
where\n S: Service<Request> + ?Sized,

§

type Response = <S as Service<Request>>::Response

Responses given by the service.
§

type Error = <S as Service<Request>>::Error

Errors produced by the service. Read more
§

type Future = <S as Service<Request>>::Future

The future response value.
§

fn call(&self, req: Request) -> <Box<S> as Service<Request>>::Future

Process the request and return the response asynchronously.\ncall takes &self instead of mut &self because: Read more
","Service","iroh_relay::dns::BoxIter"],["
§

impl<S, Request> Service<Request> for Box<S>
where\n S: Service<Request> + ?Sized,

§

type Response = <S as Service<Request>>::Response

Responses given by the service.
§

type Error = <S as Service<Request>>::Error

Errors produced by the service.
§

type Future = <S as Service<Request>>::Future

The future response value.
§

fn poll_ready(\n &mut self,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), <S as Service<Request>>::Error>>

Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more
§

fn call(&mut self, request: Request) -> <S as Service<Request>>::Future

Process the request and return the response asynchronously. Read more
","Service","iroh_relay::dns::BoxIter"],["
§

impl<S, Item> Sink<Item> for Box<S>
where\n S: Sink<Item> + Unpin + ?Sized,

§

type Error = <S as Sink<Item>>::Error

The type of value produced by the sink when an error occurs.
§

fn poll_ready(\n self: Pin<&mut Box<S>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), <Box<S> as Sink<Item>>::Error>>

Attempts to prepare the Sink to receive a value. Read more
§

fn start_send(\n self: Pin<&mut Box<S>>,\n item: Item,\n) -> Result<(), <Box<S> as Sink<Item>>::Error>

Begin the process of sending a value to the sink.\nEach call to this function must be preceded by a successful call to\npoll_ready which returned Poll::Ready(Ok(())). Read more
§

fn poll_flush(\n self: Pin<&mut Box<S>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), <Box<S> as Sink<Item>>::Error>>

Flush any remaining output from this sink. Read more
§

fn poll_close(\n self: Pin<&mut Box<S>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), <Box<S> as Sink<Item>>::Error>>

Flush any remaining output and close this sink, if necessary. Read more
","Sink","iroh_relay::dns::BoxIter"],["
§

impl<T> Source for Box<T>
where\n T: Source + ?Sized,

§

fn register(\n &mut self,\n registry: &Registry,\n token: Token,\n interests: Interest,\n) -> Result<(), Error>

Register self with the given Registry instance. Read more
§

fn reregister(\n &mut self,\n registry: &Registry,\n token: Token,\n interests: Interest,\n) -> Result<(), Error>

Re-register self with the given Registry instance. Read more
§

fn deregister(&mut self, registry: &Registry) -> Result<(), Error>

Deregister self from the given Registry instance. Read more
","Source","iroh_relay::dns::BoxIter"],["
§

impl<Sp> Spawn for Box<Sp>
where\n Sp: Spawn + ?Sized,

§

fn spawn_obj(&self, future: FutureObj<'static, ()>) -> Result<(), SpawnError>

Spawns a future that will be run to completion. Read more
§

fn status(&self) -> Result<(), SpawnError>

Determines whether the executor is able to spawn new tasks. Read more
","Spawn","iroh_relay::dns::BoxIter"],["
§

impl<S> Stream for Box<S>
where\n S: Stream + Unpin + ?Sized,

§

type Item = <S as Stream>::Item

Values yielded by the stream.
§

fn poll_next(\n self: Pin<&mut Box<S>>,\n cx: &mut Context<'_>,\n) -> Poll<Option<<Box<S> as Stream>::Item>>

Attempt to pull out the next value of this stream, registering the\ncurrent task for wakeup if the value is not yet available, and returning\nNone if the stream is exhausted. Read more
§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the stream. Read more
","Stream","iroh_relay::dns::BoxIter"],["
§

impl<S> Subscriber for Box<S>
where\n S: Subscriber + ?Sized,

§

fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest

Registers a new callsite with this subscriber, returning whether or not\nthe subscriber is interested in being notified about the callsite. Read more
§

fn enabled(&self, metadata: &Metadata<'_>) -> bool

Returns true if a span or event with the specified metadata would be\nrecorded. Read more
§

fn max_level_hint(&self) -> Option<LevelFilter>

Returns the highest verbosity level that this Subscriber will\nenable, or None, if the subscriber does not implement level-based\nfiltering or chooses not to implement this method. Read more
§

fn new_span(&self, span: &Attributes<'_>) -> Id

Visit the construction of a new span, returning a new span ID for the\nspan being constructed. Read more
§

fn record(&self, span: &Id, values: &Record<'_>)

Record a set of values on a span. Read more
§

fn record_follows_from(&self, span: &Id, follows: &Id)

Adds an indication that span follows from the span with the id\nfollows. Read more
§

fn event_enabled(&self, event: &Event<'_>) -> bool

Determine if an [Event] should be recorded. Read more
§

fn event(&self, event: &Event<'_>)

Records that an Event has occurred. Read more
§

fn enter(&self, span: &Id)

Records that a span has been entered. Read more
§

fn exit(&self, span: &Id)

Records that a span has been exited. Read more
§

fn clone_span(&self, id: &Id) -> Id

Notifies the subscriber that a span ID has been cloned. Read more
§

fn try_close(&self, id: Id) -> bool

Notifies the subscriber that a span ID has been dropped, and returns\ntrue if there are now 0 IDs that refer to that span. Read more
§

fn drop_span(&self, id: Id)

👎Deprecated since 0.1.2: use Subscriber::try_close instead
This method is deprecated. Read more
§

fn current_span(&self) -> Current

Returns a type representing this subscriber’s view of the current span. Read more
§

unsafe fn downcast_raw(&self, id: TypeId) -> Option<*const ()>

If self is the same type as the provided TypeId, returns an untyped\n*const pointer to that type. Otherwise, returns None. Read more
§

fn on_register_dispatch(&self, subscriber: &Dispatch)

Invoked when this subscriber becomes a [Dispatch]. Read more
","Subscriber","iroh_relay::dns::BoxIter"],["
§

impl<'a, T, F> UnsafeFutureObj<'a, T> for Box<F>
where\n F: Future<Output = T> + 'a,

§

fn into_raw(self) -> *mut dyn Future<Output = T> + 'a

Convert an owned instance into a (conceptually owned) fat pointer. Read more
§

unsafe fn drop(ptr: *mut dyn Future<Output = T> + 'a)

Drops the future represented by the given fat pointer. Read more
","UnsafeFutureObj<'a, T>","iroh_relay::dns::BoxIter"],["
§

impl<T> Value for Box<T>
where\n T: Value + ?Sized,

§

fn record(&self, key: &Field, visitor: &mut dyn Visit)

Visits this value with the given Visitor.
","Value","iroh_relay::dns::BoxIter"],["
§

impl<T> Write for Box<T>
where\n T: Write + Unpin + ?Sized,

§

fn poll_write(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n buf: &[u8],\n) -> Poll<Result<usize, Error>>

Attempt to write bytes from buf into the destination. Read more
§

fn poll_write_vectored(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n bufs: &[IoSlice<'_>],\n) -> Poll<Result<usize, Error>>

Like poll_write, except that it writes from a slice of buffers.
§

fn is_write_vectored(&self) -> bool

Returns whether this writer has an efficient poll_write_vectored\nimplementation. Read more
§

fn poll_flush(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), Error>>

Attempts to flush the object. Read more
§

fn poll_shutdown(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), Error>>

Attempts to shut down this writer.
","Write","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<W> Write for Box<W>
where\n W: Write + ?Sized,

Source§

fn write(&mut self, buf: &[u8]) -> Result<usize, Error>

Writes a buffer into this writer, returning how many bytes were written. Read more
Source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored\nimplementation. Read more
Source§

fn flush(&mut self) -> Result<(), Error>

Flushes this output stream, ensuring that all intermediately buffered\ncontents reach their destination. Read more
Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

Attempts to write an entire buffer into this writer. Read more
Source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
Source§

fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error\nencountered. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where\n Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more
","Write","iroh_relay::dns::BoxIter"],["
§

impl<'a, T> Writeable for Box<T>
where\n T: Writeable + ?Sized,

§

fn write_to<W>(&self, sink: &mut W) -> Result<(), Error>
where\n W: Write + ?Sized,

Writes a string to the given sink. Errors from the sink are bubbled up.\nThe default implementation delegates to write_to_parts, and discards any\nPart annotations.
§

fn write_to_parts<W>(&self, sink: &mut W) -> Result<(), Error>
where\n W: PartsWrite + ?Sized,

Write bytes and Part annotations to the given sink. Errors from the\nsink are bubbled up. The default implementation delegates to write_to,\nand doesn’t produce any Part annotations.
§

fn writeable_length_hint(&self) -> LengthHint

Returns a hint for the number of UTF-8 bytes that will be written to the sink. Read more
§

fn write_to_string(&self) -> Cow<'_, str>

Creates a new String with the data from this Writeable. Like ToString,\nbut smaller and faster. Read more
","Writeable","iroh_relay::dns::BoxIter"],["
§

impl<T> CartablePointerLike for Box<T>

","CartablePointerLike","iroh_relay::dns::BoxIter"],["
Source§

impl<T, U, A> CoerceUnsized<Box<U, A>> for Box<T, A>
where\n T: Unsize<U> + ?Sized,\n A: Allocator,\n U: ?Sized,

","CoerceUnsized>","iroh_relay::dns::BoxIter"],["
Source§

impl<R> CryptoRng for Box<R>
where\n R: CryptoRng + ?Sized,

","CryptoRng","iroh_relay::dns::BoxIter"],["
Source§

impl<T, A> DerefPure for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

","DerefPure","iroh_relay::dns::BoxIter"],["
Source§

impl<T, U> DispatchFromDyn<Box<U>> for Box<T>
where\n T: Unsize<U> + ?Sized,\n U: ?Sized,

","DispatchFromDyn>","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Eq for Box<T, A>
where\n T: Eq + ?Sized,\n A: Allocator,

","Eq","iroh_relay::dns::BoxIter"],["
1.26.0 · Source§

impl<I, A> FusedIterator for Box<I, A>
where\n I: FusedIterator + ?Sized,\n A: Allocator,

","FusedIterator","iroh_relay::dns::BoxIter"],["
Source§

impl<T, A> PinCoerceUnsized for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

","PinCoerceUnsized","iroh_relay::dns::BoxIter"],["
§

impl<'a, T> Sequence<'a> for Box<T>
where\n T: Sequence<'a>,

","Sequence<'a>","iroh_relay::dns::BoxIter"],["
§

impl<T> StableDeref for Box<T>
where\n T: ?Sized,

","StableDeref","iroh_relay::dns::BoxIter"],["
1.33.0 · Source§

impl<T, A> Unpin for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

","Unpin","iroh_relay::dns::BoxIter"]]]]); + var type_impls = Object.fromEntries([["iroh_relay",[["
§

impl<T> AsBacktrace for Box<T>
where\n T: AsBacktrace,

§

fn as_backtrace(&self) -> Option<&Backtrace>

Retrieve the optional backtrace
","AsBacktrace","iroh_relay::dns::BoxIter"],["
1.64.0 · Source§

impl<T> AsFd for Box<T>
where\n T: AsFd + ?Sized,

Source§

fn as_fd(&self) -> BorrowedFd<'_>

Borrows the file descriptor. Read more
","AsFd","iroh_relay::dns::BoxIter"],["
1.5.0 · Source§

impl<T, A> AsMut<T> for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn as_mut(&mut self) -> &mut T

Converts this type into a mutable reference of the (usually inferred) input type.
","AsMut","iroh_relay::dns::BoxIter"],["
1.63.0 · Source§

impl<T> AsRawFd for Box<T>
where\n T: AsRawFd,

Source§

fn as_raw_fd(&self) -> i32

Extracts the raw file descriptor. Read more
","AsRawFd","iroh_relay::dns::BoxIter"],["
1.5.0 · Source§

impl<T, A> AsRef<T> for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn as_ref(&self) -> &T

Converts this type into a shared reference of the (usually inferred) input type.
","AsRef","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncBufRead for Box<T>
where\n T: AsyncBufRead + Unpin + ?Sized,

§

fn poll_fill_buf(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<&[u8], Error>>

Attempt to return the contents of the internal buffer, filling it with more data\nfrom the inner reader if it is empty. Read more
§

fn consume(self: Pin<&mut Box<T>>, amt: usize)

Tells this buffer that amt bytes have been consumed from the buffer,\nso they should no longer be returned in calls to poll_read. Read more
","AsyncBufRead","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncBufRead for Box<T>
where\n T: AsyncBufRead + Unpin + ?Sized,

§

fn poll_fill_buf(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<&[u8], Error>>

Attempts to return the contents of the internal buffer, filling it with more data\nfrom the inner reader if it is empty. Read more
§

fn consume(self: Pin<&mut Box<T>>, amt: usize)

Tells this buffer that amt bytes have been consumed from the buffer,\nso they should no longer be returned in calls to poll_read. Read more
","AsyncBufRead","iroh_relay::dns::BoxIter"],["
1.85.0 · Source§

impl<Args, F, A> AsyncFn<Args> for Box<F, A>
where\n Args: Tuple,\n F: AsyncFn<Args> + ?Sized,\n A: Allocator,

Source§

extern "rust-call" fn async_call(\n &self,\n args: Args,\n) -> <Box<F, A> as AsyncFnMut<Args>>::CallRefFuture<'_>

🔬This is a nightly-only experimental API. (async_fn_traits)
Call the AsyncFn, returning a future which may borrow from the called closure.
","AsyncFn","iroh_relay::dns::BoxIter"],["
1.85.0 · Source§

impl<Args, F, A> AsyncFnMut<Args> for Box<F, A>
where\n Args: Tuple,\n F: AsyncFnMut<Args> + ?Sized,\n A: Allocator,

Source§

type CallRefFuture<'a> = <F as AsyncFnMut<Args>>::CallRefFuture<'a>\nwhere\n Box<F, A>: 'a

🔬This is a nightly-only experimental API. (async_fn_traits)
Source§

extern "rust-call" fn async_call_mut(\n &mut self,\n args: Args,\n) -> <Box<F, A> as AsyncFnMut<Args>>::CallRefFuture<'_>

🔬This is a nightly-only experimental API. (async_fn_traits)
Call the AsyncFnMut, returning a future which may borrow from the called closure.
","AsyncFnMut","iroh_relay::dns::BoxIter"],["
1.85.0 · Source§

impl<Args, F, A> AsyncFnOnce<Args> for Box<F, A>
where\n Args: Tuple,\n F: AsyncFnOnce<Args> + ?Sized,\n A: Allocator,

Source§

type Output = <F as AsyncFnOnce<Args>>::Output

🔬This is a nightly-only experimental API. (async_fn_traits)
Output type of the called closure’s future.
Source§

type CallOnceFuture = <F as AsyncFnOnce<Args>>::CallOnceFuture

🔬This is a nightly-only experimental API. (async_fn_traits)
Future returned by AsyncFnOnce::async_call_once.
Source§

extern "rust-call" fn async_call_once(\n self,\n args: Args,\n) -> <Box<F, A> as AsyncFnOnce<Args>>::CallOnceFuture

🔬This is a nightly-only experimental API. (async_fn_traits)
Call the AsyncFnOnce, returning a future which may move out of the called closure.
","AsyncFnOnce","iroh_relay::dns::BoxIter"],["
Source§

impl<S> AsyncIterator for Box<S>
where\n S: AsyncIterator + Unpin + ?Sized,

Source§

type Item = <S as AsyncIterator>::Item

🔬This is a nightly-only experimental API. (async_iterator)
The type of items yielded by the async iterator.
Source§

fn poll_next(\n self: Pin<&mut Box<S>>,\n cx: &mut Context<'_>,\n) -> Poll<Option<<Box<S> as AsyncIterator>::Item>>

🔬This is a nightly-only experimental API. (async_iterator)
Attempts to pull out the next value of this async iterator, registering the\ncurrent task for wakeup if the value is not yet available, and returning\nNone if the async iterator is exhausted. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

🔬This is a nightly-only experimental API. (async_iterator)
Returns the bounds on the remaining length of the async iterator. Read more
","AsyncIterator","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncRead for Box<T>
where\n T: AsyncRead + Unpin + ?Sized,

§

fn poll_read(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n buf: &mut ReadBuf<'_>,\n) -> Poll<Result<(), Error>>

Attempts to read from the AsyncRead into buf. Read more
","AsyncRead","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncRead for Box<T>
where\n T: AsyncRead + Unpin + ?Sized,

§

fn poll_read(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n buf: &mut [u8],\n) -> Poll<Result<usize, Error>>

Attempt to read from the AsyncRead into buf. Read more
§

fn poll_read_vectored(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n bufs: &mut [IoSliceMut<'_>],\n) -> Poll<Result<usize, Error>>

Attempt to read from the AsyncRead into bufs using vectored\nIO operations. Read more
","AsyncRead","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncSeek for Box<T>
where\n T: AsyncSeek + Unpin + ?Sized,

§

fn poll_seek(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n pos: SeekFrom,\n) -> Poll<Result<u64, Error>>

Attempt to seek to an offset, in bytes, in a stream. Read more
","AsyncSeek","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncSeek for Box<T>
where\n T: AsyncSeek + Unpin + ?Sized,

§

fn start_seek(self: Pin<&mut Box<T>>, pos: SeekFrom) -> Result<(), Error>

Attempts to seek to an offset, in bytes, in a stream. Read more
§

fn poll_complete(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<u64, Error>>

Waits for a seek operation to complete. Read more
","AsyncSeek","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncWrite for Box<T>
where\n T: AsyncWrite + Unpin + ?Sized,

§

fn poll_write(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n buf: &[u8],\n) -> Poll<Result<usize, Error>>

Attempt to write bytes from buf into the object. Read more
§

fn poll_write_vectored(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n bufs: &[IoSlice<'_>],\n) -> Poll<Result<usize, Error>>

Attempt to write bytes from bufs into the object using vectored\nIO operations. Read more
§

fn poll_flush(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), Error>>

Attempt to flush the object, ensuring that any buffered data reach\ntheir destination. Read more
§

fn poll_close(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), Error>>

Attempt to close the object. Read more
","AsyncWrite","iroh_relay::dns::BoxIter"],["
§

impl<T> AsyncWrite for Box<T>
where\n T: AsyncWrite + Unpin + ?Sized,

§

fn poll_write(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n buf: &[u8],\n) -> Poll<Result<usize, Error>>

Attempt to write bytes from buf into the object. Read more
§

fn poll_write_vectored(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n bufs: &[IoSlice<'_>],\n) -> Poll<Result<usize, Error>>

Like poll_write, except that it writes from a slice of buffers. Read more
§

fn is_write_vectored(&self) -> bool

Determines if this writer has an efficient poll_write_vectored\nimplementation. Read more
§

fn poll_flush(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), Error>>

Attempts to flush the object, ensuring that any buffered data reach\ntheir destination. Read more
§

fn poll_shutdown(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), Error>>

Initiates or attempts to shut down this writer, returning success when\nthe I/O connection has completely shut down. Read more
","AsyncWrite","iroh_relay::dns::BoxIter"],["
§

impl<T> Body for Box<T>
where\n T: Body + Unpin + ?Sized,

§

type Data = <T as Body>::Data

Values yielded by the Body.
§

type Error = <T as Body>::Error

The error type this Body might generate.
§

fn poll_frame(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Option<Result<Frame<<Box<T> as Body>::Data>, <Box<T> as Body>::Error>>>

Attempt to pull out the next data buffer of this stream.
§

fn is_end_stream(&self) -> bool

Returns true when the end of stream has been reached. Read more
§

fn size_hint(&self) -> SizeHint

Returns the bounds on the remaining length of the stream. Read more
","Body","iroh_relay::dns::BoxIter"],["
1.1.0 · Source§

impl<T, A> Borrow<T> for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
","Borrow","iroh_relay::dns::BoxIter"],["
1.1.0 · Source§

impl<T, A> BorrowMut<T> for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
","BorrowMut","iroh_relay::dns::BoxIter"],["
Source§

impl<T> Box<T>
where\n T: ?Sized,

1.4.0 · Source

pub unsafe fn from_raw(raw: *mut T) -> Box<T>

Available on crate feature server only.

Constructs a box from a raw pointer.

\n

After calling this function, the raw pointer is owned by the\nresulting Box. Specifically, the Box destructor will call\nthe destructor of T and free the allocated memory. For this\nto be safe, the memory must have been allocated in accordance\nwith the memory layout used by Box .

\n
§Safety
\n

This function is unsafe because improper use may lead to\nmemory problems. For example, a double-free may occur if the\nfunction is called twice on the same raw pointer.

\n

The raw pointer must point to a block of memory allocated by the global allocator.

\n

The safety conditions are described in the memory layout section.

\n
§Examples
\n

Recreate a Box which was previously converted to a raw pointer\nusing Box::into_raw:

\n\n
let x = Box::new(5);\nlet ptr = Box::into_raw(x);\nlet x = unsafe { Box::from_raw(ptr) };
\n

Manually create a Box from scratch by using the global allocator:

\n\n
use std::alloc::{alloc, Layout};\n\nunsafe {\n    let ptr = alloc(Layout::new::<i32>()) as *mut i32;\n    // In general .write is required to avoid attempting to destruct\n    // the (uninitialized) previous contents of `ptr`, though for this\n    // simple example `*ptr = 5` would have worked as well.\n    ptr.write(5);\n    let x = Box::from_raw(ptr);\n}
Source

pub unsafe fn from_non_null(ptr: NonNull<T>) -> Box<T>

🔬This is a nightly-only experimental API. (box_vec_non_null)
Available on crate feature server only.

Constructs a box from a NonNull pointer.

\n

After calling this function, the NonNull pointer is owned by\nthe resulting Box. Specifically, the Box destructor will call\nthe destructor of T and free the allocated memory. For this\nto be safe, the memory must have been allocated in accordance\nwith the memory layout used by Box .

\n
§Safety
\n

This function is unsafe because improper use may lead to\nmemory problems. For example, a double-free may occur if the\nfunction is called twice on the same NonNull pointer.

\n

The non-null pointer must point to a block of memory allocated by the global allocator.

\n

The safety conditions are described in the memory layout section.

\n
§Examples
\n

Recreate a Box which was previously converted to a NonNull\npointer using Box::into_non_null:

\n\n
#![feature(box_vec_non_null)]\n\nlet x = Box::new(5);\nlet non_null = Box::into_non_null(x);\nlet x = unsafe { Box::from_non_null(non_null) };
\n

Manually create a Box from scratch by using the global allocator:

\n\n
#![feature(box_vec_non_null)]\n\nuse std::alloc::{alloc, Layout};\nuse std::ptr::NonNull;\n\nunsafe {\n    let non_null = NonNull::new(alloc(Layout::new::<i32>()).cast::<i32>())\n        .expect(\"allocation failed\");\n    // In general .write is required to avoid attempting to destruct\n    // the (uninitialized) previous contents of `non_null`.\n    non_null.write(5);\n    let x = Box::from_non_null(non_null);\n}
1.4.0 · Source

pub fn into_raw(b: Box<T>) -> *mut T

Available on crate feature server only.

Consumes the Box, returning a wrapped raw pointer.

\n

The pointer will be properly aligned and non-null.

\n

After calling this function, the caller is responsible for the\nmemory previously managed by the Box. In particular, the\ncaller should properly destroy T and release the memory, taking\ninto account the memory layout used by Box. The easiest way to\ndo this is to convert the raw pointer back into a Box with the\nBox::from_raw function, allowing the Box destructor to perform\nthe cleanup.

\n

Note: this is an associated function, which means that you have\nto call it as Box::into_raw(b) instead of b.into_raw(). This\nis so that there is no conflict with a method on the inner type.

\n
§Examples
\n

Converting the raw pointer back into a Box with Box::from_raw\nfor automatic cleanup:

\n\n
let x = Box::new(String::from(\"Hello\"));\nlet ptr = Box::into_raw(x);\nlet x = unsafe { Box::from_raw(ptr) };
\n

Manual cleanup by explicitly running the destructor and deallocating\nthe memory:

\n\n
use std::alloc::{dealloc, Layout};\nuse std::ptr;\n\nlet x = Box::new(String::from(\"Hello\"));\nlet ptr = Box::into_raw(x);\nunsafe {\n    ptr::drop_in_place(ptr);\n    dealloc(ptr as *mut u8, Layout::new::<String>());\n}
\n

Note: This is equivalent to the following:

\n\n
let x = Box::new(String::from(\"Hello\"));\nlet ptr = Box::into_raw(x);\nunsafe {\n    drop(Box::from_raw(ptr));\n}
Source

pub fn into_non_null(b: Box<T>) -> NonNull<T>

🔬This is a nightly-only experimental API. (box_vec_non_null)
Available on crate feature server only.

Consumes the Box, returning a wrapped NonNull pointer.

\n

The pointer will be properly aligned.

\n

After calling this function, the caller is responsible for the\nmemory previously managed by the Box. In particular, the\ncaller should properly destroy T and release the memory, taking\ninto account the memory layout used by Box. The easiest way to\ndo this is to convert the NonNull pointer back into a Box with the\nBox::from_non_null function, allowing the Box destructor to\nperform the cleanup.

\n

Note: this is an associated function, which means that you have\nto call it as Box::into_non_null(b) instead of b.into_non_null().\nThis is so that there is no conflict with a method on the inner type.

\n
§Examples
\n

Converting the NonNull pointer back into a Box with Box::from_non_null\nfor automatic cleanup:

\n\n
#![feature(box_vec_non_null)]\n\nlet x = Box::new(String::from(\"Hello\"));\nlet non_null = Box::into_non_null(x);\nlet x = unsafe { Box::from_non_null(non_null) };
\n

Manual cleanup by explicitly running the destructor and deallocating\nthe memory:

\n\n
#![feature(box_vec_non_null)]\n\nuse std::alloc::{dealloc, Layout};\n\nlet x = Box::new(String::from(\"Hello\"));\nlet non_null = Box::into_non_null(x);\nunsafe {\n    non_null.drop_in_place();\n    dealloc(non_null.as_ptr().cast::<u8>(), Layout::new::<String>());\n}
\n

Note: This is equivalent to the following:

\n\n
#![feature(box_vec_non_null)]\n\nlet x = Box::new(String::from(\"Hello\"));\nlet non_null = Box::into_non_null(x);\nunsafe {\n    drop(Box::from_non_null(non_null));\n}
",0,"iroh_relay::dns::BoxIter"],["
Source§

impl<T> Box<T>

1.0.0 · Source

pub fn new(x: T) -> Box<T>

Available on crate feature server only.

Allocates memory on the heap and then places x into it.

\n

This doesn’t actually allocate if T is zero-sized.

\n
§Examples
\n
let five = Box::new(5);
1.82.0 · Source

pub fn new_uninit() -> Box<MaybeUninit<T>>

Available on crate feature server only.

Constructs a new box with uninitialized contents.

\n
§Examples
\n
let mut five = Box::<u32>::new_uninit();\n// Deferred initialization:\nfive.write(5);\nlet five = unsafe { five.assume_init() };\n\nassert_eq!(*five, 5)
1.92.0 · Source

pub fn new_zeroed() -> Box<MaybeUninit<T>>

Available on crate feature server only.

Constructs a new Box with uninitialized contents, with the memory\nbeing filled with 0 bytes.

\n

See MaybeUninit::zeroed for examples of correct and incorrect usage\nof this method.

\n
§Examples
\n
let zero = Box::<u32>::new_zeroed();\nlet zero = unsafe { zero.assume_init() };\n\nassert_eq!(*zero, 0)
1.33.0 · Source

pub fn pin(x: T) -> Pin<Box<T>>

Available on crate feature server only.

Constructs a new Pin<Box<T>>. If T does not implement Unpin, then\nx will be pinned in memory and unable to be moved.

\n

Constructing and pinning of the Box can also be done in two steps: Box::pin(x)\ndoes the same as Box::into_pin(Box::new(x)). Consider using\ninto_pin if you already have a Box<T>, or if you want to\nconstruct a (pinned) Box in a different way than with Box::new.

\n
Source

pub fn try_new(x: T) -> Result<Box<T>, AllocError>

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Allocates memory on the heap then places x into it,\nreturning an error if the allocation fails

\n

This doesn’t actually allocate if T is zero-sized.

\n
§Examples
\n
#![feature(allocator_api)]\n\nlet five = Box::try_new(5)?;
Source

pub fn try_new_uninit() -> Result<Box<MaybeUninit<T>>, AllocError>

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new box with uninitialized contents on the heap,\nreturning an error if the allocation fails

\n
§Examples
\n
#![feature(allocator_api)]\n\nlet mut five = Box::<u32>::try_new_uninit()?;\n// Deferred initialization:\nfive.write(5);\nlet five = unsafe { five.assume_init() };\n\nassert_eq!(*five, 5);
Source

pub fn try_new_zeroed() -> Result<Box<MaybeUninit<T>>, AllocError>

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new Box with uninitialized contents, with the memory\nbeing filled with 0 bytes on the heap

\n

See MaybeUninit::zeroed for examples of correct and incorrect usage\nof this method.

\n
§Examples
\n
#![feature(allocator_api)]\n\nlet zero = Box::<u32>::try_new_zeroed()?;\nlet zero = unsafe { zero.assume_init() };\n\nassert_eq!(*zero, 0);
",0,"iroh_relay::dns::BoxIter"],["
Source§

impl<T, A> Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source

pub unsafe fn from_raw_in(raw: *mut T, alloc: A) -> Box<T, A>

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a box from a raw pointer in the given allocator.

\n

After calling this function, the raw pointer is owned by the\nresulting Box. Specifically, the Box destructor will call\nthe destructor of T and free the allocated memory. For this\nto be safe, the memory must have been allocated in accordance\nwith the memory layout used by Box .

\n
§Safety
\n

This function is unsafe because improper use may lead to\nmemory problems. For example, a double-free may occur if the\nfunction is called twice on the same raw pointer.

\n

The raw pointer must point to a block of memory allocated by alloc.

\n
§Examples
\n

Recreate a Box which was previously converted to a raw pointer\nusing Box::into_raw_with_allocator:

\n\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet x = Box::new_in(5, System);\nlet (ptr, alloc) = Box::into_raw_with_allocator(x);\nlet x = unsafe { Box::from_raw_in(ptr, alloc) };
\n

Manually create a Box from scratch by using the system allocator:

\n\n
#![feature(allocator_api, slice_ptr_get)]\n\nuse std::alloc::{Allocator, Layout, System};\n\nunsafe {\n    let ptr = System.allocate(Layout::new::<i32>())?.as_mut_ptr() as *mut i32;\n    // In general .write is required to avoid attempting to destruct\n    // the (uninitialized) previous contents of `ptr`, though for this\n    // simple example `*ptr = 5` would have worked as well.\n    ptr.write(5);\n    let x = Box::from_raw_in(ptr, System);\n}
Source

pub unsafe fn from_non_null_in(raw: NonNull<T>, alloc: A) -> Box<T, A>

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a box from a NonNull pointer in the given allocator.

\n

After calling this function, the NonNull pointer is owned by\nthe resulting Box. Specifically, the Box destructor will call\nthe destructor of T and free the allocated memory. For this\nto be safe, the memory must have been allocated in accordance\nwith the memory layout used by Box .

\n
§Safety
\n

This function is unsafe because improper use may lead to\nmemory problems. For example, a double-free may occur if the\nfunction is called twice on the same raw pointer.

\n

The non-null pointer must point to a block of memory allocated by alloc.

\n
§Examples
\n

Recreate a Box which was previously converted to a NonNull pointer\nusing Box::into_non_null_with_allocator:

\n\n
#![feature(allocator_api, box_vec_non_null)]\n\nuse std::alloc::System;\n\nlet x = Box::new_in(5, System);\nlet (non_null, alloc) = Box::into_non_null_with_allocator(x);\nlet x = unsafe { Box::from_non_null_in(non_null, alloc) };
\n

Manually create a Box from scratch by using the system allocator:

\n\n
#![feature(allocator_api, box_vec_non_null, slice_ptr_get)]\n\nuse std::alloc::{Allocator, Layout, System};\n\nunsafe {\n    let non_null = System.allocate(Layout::new::<i32>())?.cast::<i32>();\n    // In general .write is required to avoid attempting to destruct\n    // the (uninitialized) previous contents of `non_null`.\n    non_null.write(5);\n    let x = Box::from_non_null_in(non_null, System);\n}
Source

pub fn into_raw_with_allocator(b: Box<T, A>) -> (*mut T, A)

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Consumes the Box, returning a wrapped raw pointer and the allocator.

\n

The pointer will be properly aligned and non-null.

\n

After calling this function, the caller is responsible for the\nmemory previously managed by the Box. In particular, the\ncaller should properly destroy T and release the memory, taking\ninto account the memory layout used by Box. The easiest way to\ndo this is to convert the raw pointer back into a Box with the\nBox::from_raw_in function, allowing the Box destructor to perform\nthe cleanup.

\n

Note: this is an associated function, which means that you have\nto call it as Box::into_raw_with_allocator(b) instead of b.into_raw_with_allocator(). This\nis so that there is no conflict with a method on the inner type.

\n
§Examples
\n

Converting the raw pointer back into a Box with Box::from_raw_in\nfor automatic cleanup:

\n\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet x = Box::new_in(String::from(\"Hello\"), System);\nlet (ptr, alloc) = Box::into_raw_with_allocator(x);\nlet x = unsafe { Box::from_raw_in(ptr, alloc) };
\n

Manual cleanup by explicitly running the destructor and deallocating\nthe memory:

\n\n
#![feature(allocator_api)]\n\nuse std::alloc::{Allocator, Layout, System};\nuse std::ptr::{self, NonNull};\n\nlet x = Box::new_in(String::from(\"Hello\"), System);\nlet (ptr, alloc) = Box::into_raw_with_allocator(x);\nunsafe {\n    ptr::drop_in_place(ptr);\n    let non_null = NonNull::new_unchecked(ptr);\n    alloc.deallocate(non_null.cast(), Layout::new::<String>());\n}
Source

pub fn into_non_null_with_allocator(b: Box<T, A>) -> (NonNull<T>, A)

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Consumes the Box, returning a wrapped NonNull pointer and the allocator.

\n

The pointer will be properly aligned.

\n

After calling this function, the caller is responsible for the\nmemory previously managed by the Box. In particular, the\ncaller should properly destroy T and release the memory, taking\ninto account the memory layout used by Box. The easiest way to\ndo this is to convert the NonNull pointer back into a Box with the\nBox::from_non_null_in function, allowing the Box destructor to\nperform the cleanup.

\n

Note: this is an associated function, which means that you have\nto call it as Box::into_non_null_with_allocator(b) instead of\nb.into_non_null_with_allocator(). This is so that there is no\nconflict with a method on the inner type.

\n
§Examples
\n

Converting the NonNull pointer back into a Box with\nBox::from_non_null_in for automatic cleanup:

\n\n
#![feature(allocator_api, box_vec_non_null)]\n\nuse std::alloc::System;\n\nlet x = Box::new_in(String::from(\"Hello\"), System);\nlet (non_null, alloc) = Box::into_non_null_with_allocator(x);\nlet x = unsafe { Box::from_non_null_in(non_null, alloc) };
\n

Manual cleanup by explicitly running the destructor and deallocating\nthe memory:

\n\n
#![feature(allocator_api, box_vec_non_null)]\n\nuse std::alloc::{Allocator, Layout, System};\n\nlet x = Box::new_in(String::from(\"Hello\"), System);\nlet (non_null, alloc) = Box::into_non_null_with_allocator(x);\nunsafe {\n    non_null.drop_in_place();\n    alloc.deallocate(non_null.cast::<u8>(), Layout::new::<String>());\n}
Source

pub fn as_mut_ptr(b: &mut Box<T, A>) -> *mut T

🔬This is a nightly-only experimental API. (box_as_ptr)
Available on crate feature server only.

Returns a raw mutable pointer to the Box’s contents.

\n

The caller must ensure that the Box outlives the pointer this\nfunction returns, or else it will end up dangling.

\n

This method guarantees that for the purpose of the aliasing model, this method\ndoes not materialize a reference to the underlying memory, and thus the returned pointer\nwill remain valid when mixed with other calls to as_ptr and as_mut_ptr.\nNote that calling other methods that materialize references to the memory\nmay still invalidate this pointer.\nSee the example below for how this guarantee can be used.

\n
§Examples
\n

Due to the aliasing guarantee, the following code is legal:

\n\n
#![feature(box_as_ptr)]\n\nunsafe {\n    let mut b = Box::new(0);\n    let ptr1 = Box::as_mut_ptr(&mut b);\n    ptr1.write(1);\n    let ptr2 = Box::as_mut_ptr(&mut b);\n    ptr2.write(2);\n    // Notably, the write to `ptr2` did *not* invalidate `ptr1`:\n    ptr1.write(3);\n}
Source

pub fn as_ptr(b: &Box<T, A>) -> *const T

🔬This is a nightly-only experimental API. (box_as_ptr)
Available on crate feature server only.

Returns a raw pointer to the Box’s contents.

\n

The caller must ensure that the Box outlives the pointer this\nfunction returns, or else it will end up dangling.

\n

The caller must also ensure that the memory the pointer (non-transitively) points to\nis never written to (except inside an UnsafeCell) using this pointer or any pointer\nderived from it. If you need to mutate the contents of the Box, use as_mut_ptr.

\n

This method guarantees that for the purpose of the aliasing model, this method\ndoes not materialize a reference to the underlying memory, and thus the returned pointer\nwill remain valid when mixed with other calls to as_ptr and as_mut_ptr.\nNote that calling other methods that materialize mutable references to the memory,\nas well as writing to this memory, may still invalidate this pointer.\nSee the example below for how this guarantee can be used.

\n
§Examples
\n

Due to the aliasing guarantee, the following code is legal:

\n\n
#![feature(box_as_ptr)]\n\nunsafe {\n    let mut v = Box::new(0);\n    let ptr1 = Box::as_ptr(&v);\n    let ptr2 = Box::as_mut_ptr(&mut v);\n    let _val = ptr2.read();\n    // No write to this memory has happened yet, so `ptr1` is still valid.\n    let _val = ptr1.read();\n    // However, once we do a write...\n    ptr2.write(1);\n    // ... `ptr1` is no longer valid.\n    // This would be UB: let _val = ptr1.read();\n}
Source

pub fn allocator(b: &Box<T, A>) -> &A

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Returns a reference to the underlying allocator.

\n

Note: this is an associated function, which means that you have\nto call it as Box::allocator(&b) instead of b.allocator(). This\nis so that there is no conflict with a method on the inner type.

\n
1.26.0 · Source

pub fn leak<'a>(b: Box<T, A>) -> &'a mut T
where\n A: 'a,

Available on crate feature server only.

Consumes and leaks the Box, returning a mutable reference,\n&'a mut T.

\n

Note that the type T must outlive the chosen lifetime 'a. If the type\nhas only static references, or none at all, then this may be chosen to be\n'static.

\n

This function is mainly useful for data that lives for the remainder of\nthe program’s life. Dropping the returned reference will cause a memory\nleak. If this is not acceptable, the reference should first be wrapped\nwith the Box::from_raw function producing a Box. This Box can\nthen be dropped which will properly destroy T and release the\nallocated memory.

\n

Note: this is an associated function, which means that you have\nto call it as Box::leak(b) instead of b.leak(). This\nis so that there is no conflict with a method on the inner type.

\n
§Examples
\n

Simple usage:

\n\n
let x = Box::new(41);\nlet static_ref: &'static mut usize = Box::leak(x);\n*static_ref += 1;\nassert_eq!(*static_ref, 42);
\n

Unsized data:

\n\n
let x = vec![1, 2, 3].into_boxed_slice();\nlet static_ref = Box::leak(x);\nstatic_ref[0] = 4;\nassert_eq!(*static_ref, [4, 2, 3]);
1.63.0 · Source

pub fn into_pin(boxed: Box<T, A>) -> Pin<Box<T, A>>
where\n A: 'static,

Available on crate feature server only.

Converts a Box<T> into a Pin<Box<T>>. If T does not implement Unpin, then\n*boxed will be pinned in memory and unable to be moved.

\n

This conversion does not allocate on the heap and happens in place.

\n

This is also available via From.

\n

Constructing and pinning a Box with Box::into_pin(Box::new(x))\ncan also be written more concisely using Box::pin(x).\nThis into_pin method is useful if you already have a Box<T>, or you are\nconstructing a (pinned) Box in a different way than with Box::new.

\n
§Notes
\n

It’s not recommended that crates add an impl like From<Box<T>> for Pin<T>,\nas it’ll introduce an ambiguity when calling Pin::from.\nA demonstration of such a poor impl is shown below.

\n\n
ⓘ
struct Foo; // A type defined in this crate.\nimpl From<Box<()>> for Pin<Foo> {\n    fn from(_: Box<()>) -> Pin<Foo> {\n        Pin::new(Foo)\n    }\n}\n\nlet foo = Box::new(());\nlet bar = Pin::from(foo);
",0,"iroh_relay::dns::BoxIter"],["
Source§

impl<T, A> Box<T, A>
where\n A: Allocator,

Source

pub fn new_in(x: T, alloc: A) -> Box<T, A>
where\n A: Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Allocates memory in the given allocator then places x into it.

\n

This doesn’t actually allocate if T is zero-sized.

\n
§Examples
\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet five = Box::new_in(5, System);
Source

pub fn try_new_in(x: T, alloc: A) -> Result<Box<T, A>, AllocError>
where\n A: Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Allocates memory in the given allocator then places x into it,\nreturning an error if the allocation fails

\n

This doesn’t actually allocate if T is zero-sized.

\n
§Examples
\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet five = Box::try_new_in(5, System)?;
Source

pub fn new_uninit_in(alloc: A) -> Box<MaybeUninit<T>, A>
where\n A: Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new box with uninitialized contents in the provided allocator.

\n
§Examples
\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet mut five = Box::<u32, _>::new_uninit_in(System);\n// Deferred initialization:\nfive.write(5);\nlet five = unsafe { five.assume_init() };\n\nassert_eq!(*five, 5)
Source

pub fn try_new_uninit_in(alloc: A) -> Result<Box<MaybeUninit<T>, A>, AllocError>
where\n A: Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new box with uninitialized contents in the provided allocator,\nreturning an error if the allocation fails

\n
§Examples
\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet mut five = Box::<u32, _>::try_new_uninit_in(System)?;\n// Deferred initialization:\nfive.write(5);\nlet five = unsafe { five.assume_init() };\n\nassert_eq!(*five, 5);
Source

pub fn new_zeroed_in(alloc: A) -> Box<MaybeUninit<T>, A>
where\n A: Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new Box with uninitialized contents, with the memory\nbeing filled with 0 bytes in the provided allocator.

\n

See MaybeUninit::zeroed for examples of correct and incorrect usage\nof this method.

\n
§Examples
\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet zero = Box::<u32, _>::new_zeroed_in(System);\nlet zero = unsafe { zero.assume_init() };\n\nassert_eq!(*zero, 0)
Source

pub fn try_new_zeroed_in(alloc: A) -> Result<Box<MaybeUninit<T>, A>, AllocError>
where\n A: Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new Box with uninitialized contents, with the memory\nbeing filled with 0 bytes in the provided allocator,\nreturning an error if the allocation fails,

\n

See MaybeUninit::zeroed for examples of correct and incorrect usage\nof this method.

\n
§Examples
\n
#![feature(allocator_api)]\n\nuse std::alloc::System;\n\nlet zero = Box::<u32, _>::try_new_zeroed_in(System)?;\nlet zero = unsafe { zero.assume_init() };\n\nassert_eq!(*zero, 0);
Source

pub fn pin_in(x: T, alloc: A) -> Pin<Box<T, A>>
where\n A: 'static + Allocator,

🔬This is a nightly-only experimental API. (allocator_api)
Available on crate feature server only.

Constructs a new Pin<Box<T, A>>. If T does not implement Unpin, then\nx will be pinned in memory and unable to be moved.

\n

Constructing and pinning of the Box can also be done in two steps: Box::pin_in(x, alloc)\ndoes the same as Box::into_pin(Box::new_in(x, alloc)). Consider using\ninto_pin if you already have a Box<T, A>, or if you want to\nconstruct a (pinned) Box in a different way than with Box::new_in.

\n
Source

pub fn into_boxed_slice(boxed: Box<T, A>) -> Box<[T], A>

🔬This is a nightly-only experimental API. (box_into_boxed_slice)
Available on crate feature server only.

Converts a Box<T> into a Box<[T]>

\n

This conversion does not allocate on the heap and happens in place.

\n
Source

pub fn into_inner(boxed: Box<T, A>) -> T

🔬This is a nightly-only experimental API. (box_into_inner)
Available on crate feature server only.

Consumes the Box, returning the wrapped value.

\n
§Examples
\n
#![feature(box_into_inner)]\n\nlet c = Box::new(5);\n\nassert_eq!(Box::into_inner(c), 5);
Source

pub fn take(boxed: Box<T, A>) -> (T, Box<MaybeUninit<T>, A>)

🔬This is a nightly-only experimental API. (box_take)
Available on crate feature server only.

Consumes the Box without consuming its allocation, returning the wrapped value and a Box\nto the uninitialized memory where the wrapped value used to live.

\n

This can be used together with write to reuse the allocation for multiple\nboxed values.

\n
§Examples
\n
#![feature(box_take)]\n\nlet c = Box::new(5);\n\n// take the value out of the box\nlet (value, uninit) = Box::take(c);\nassert_eq!(value, 5);\n\n// reuse the box for a second value\nlet c = Box::write(uninit, 6);\nassert_eq!(*c, 6);
",0,"iroh_relay::dns::BoxIter"],["
§

impl<T> Buf for Box<T>
where\n T: Buf + ?Sized,

§

fn remaining(&self) -> usize

Returns the number of bytes between the current position and the end of\nthe buffer. Read more
§

fn chunk(&self) -> &[u8] ⓘ

Returns a slice starting at the current position and of length between 0\nand Buf::remaining(). Note that this can return a shorter slice (this\nallows non-continuous internal representation). Read more
§

fn chunks_vectored<'b>(&'b self, dst: &mut [IoSlice<'b>]) -> usize

Fills dst with potentially multiple slices starting at self’s\ncurrent position. Read more
§

fn advance(&mut self, cnt: usize)

Advance the internal cursor of the Buf Read more
§

fn has_remaining(&self) -> bool

Returns true if there are any more bytes to consume Read more
§

fn copy_to_slice(&mut self, dst: &mut [u8])

Copies bytes from self into dst. Read more
§

fn get_u8(&mut self) -> u8

Gets an unsigned 8 bit integer from self. Read more
§

fn get_i8(&mut self) -> i8

Gets a signed 8 bit integer from self. Read more
§

fn get_u16(&mut self) -> u16

Gets an unsigned 16 bit integer from self in big-endian byte order. Read more
§

fn get_u16_le(&mut self) -> u16

Gets an unsigned 16 bit integer from self in little-endian byte order. Read more
§

fn get_u16_ne(&mut self) -> u16

Gets an unsigned 16 bit integer from self in native-endian byte order. Read more
§

fn get_i16(&mut self) -> i16

Gets a signed 16 bit integer from self in big-endian byte order. Read more
§

fn get_i16_le(&mut self) -> i16

Gets a signed 16 bit integer from self in little-endian byte order. Read more
§

fn get_i16_ne(&mut self) -> i16

Gets a signed 16 bit integer from self in native-endian byte order. Read more
§

fn get_u32(&mut self) -> u32

Gets an unsigned 32 bit integer from self in the big-endian byte order. Read more
§

fn get_u32_le(&mut self) -> u32

Gets an unsigned 32 bit integer from self in the little-endian byte order. Read more
§

fn get_u32_ne(&mut self) -> u32

Gets an unsigned 32 bit integer from self in native-endian byte order. Read more
§

fn get_i32(&mut self) -> i32

Gets a signed 32 bit integer from self in big-endian byte order. Read more
§

fn get_i32_le(&mut self) -> i32

Gets a signed 32 bit integer from self in little-endian byte order. Read more
§

fn get_i32_ne(&mut self) -> i32

Gets a signed 32 bit integer from self in native-endian byte order. Read more
§

fn get_u64(&mut self) -> u64

Gets an unsigned 64 bit integer from self in big-endian byte order. Read more
§

fn get_u64_le(&mut self) -> u64

Gets an unsigned 64 bit integer from self in little-endian byte order. Read more
§

fn get_u64_ne(&mut self) -> u64

Gets an unsigned 64 bit integer from self in native-endian byte order. Read more
§

fn get_i64(&mut self) -> i64

Gets a signed 64 bit integer from self in big-endian byte order. Read more
§

fn get_i64_le(&mut self) -> i64

Gets a signed 64 bit integer from self in little-endian byte order. Read more
§

fn get_i64_ne(&mut self) -> i64

Gets a signed 64 bit integer from self in native-endian byte order. Read more
§

fn get_u128(&mut self) -> u128

Gets an unsigned 128 bit integer from self in big-endian byte order. Read more
§

fn get_u128_le(&mut self) -> u128

Gets an unsigned 128 bit integer from self in little-endian byte order. Read more
§

fn get_u128_ne(&mut self) -> u128

Gets an unsigned 128 bit integer from self in native-endian byte order. Read more
§

fn get_i128(&mut self) -> i128

Gets a signed 128 bit integer from self in big-endian byte order. Read more
§

fn get_i128_le(&mut self) -> i128

Gets a signed 128 bit integer from self in little-endian byte order. Read more
§

fn get_i128_ne(&mut self) -> i128

Gets a signed 128 bit integer from self in native-endian byte order. Read more
§

fn get_uint(&mut self, nbytes: usize) -> u64

Gets an unsigned n-byte integer from self in big-endian byte order. Read more
§

fn get_uint_le(&mut self, nbytes: usize) -> u64

Gets an unsigned n-byte integer from self in little-endian byte order. Read more
§

fn get_uint_ne(&mut self, nbytes: usize) -> u64

Gets an unsigned n-byte integer from self in native-endian byte order. Read more
§

fn get_int(&mut self, nbytes: usize) -> i64

Gets a signed n-byte integer from self in big-endian byte order. Read more
§

fn get_int_le(&mut self, nbytes: usize) -> i64

Gets a signed n-byte integer from self in little-endian byte order. Read more
§

fn get_int_ne(&mut self, nbytes: usize) -> i64

Gets a signed n-byte integer from self in native-endian byte order. Read more
§

fn get_f32(&mut self) -> f32

Gets an IEEE754 single-precision (4 bytes) floating point number from\nself in big-endian byte order. Read more
§

fn get_f32_le(&mut self) -> f32

Gets an IEEE754 single-precision (4 bytes) floating point number from\nself in little-endian byte order. Read more
§

fn get_f32_ne(&mut self) -> f32

Gets an IEEE754 single-precision (4 bytes) floating point number from\nself in native-endian byte order. Read more
§

fn get_f64(&mut self) -> f64

Gets an IEEE754 double-precision (8 bytes) floating point number from\nself in big-endian byte order. Read more
§

fn get_f64_le(&mut self) -> f64

Gets an IEEE754 double-precision (8 bytes) floating point number from\nself in little-endian byte order. Read more
§

fn get_f64_ne(&mut self) -> f64

Gets an IEEE754 double-precision (8 bytes) floating point number from\nself in native-endian byte order. Read more
§

fn try_copy_to_slice(&mut self, dst: &mut [u8]) -> Result<(), TryGetError>

Copies bytes from self into dst. Read more
§

fn try_get_u8(&mut self) -> Result<u8, TryGetError>

Gets an unsigned 8 bit integer from self. Read more
§

fn try_get_i8(&mut self) -> Result<i8, TryGetError>

Gets a signed 8 bit integer from self. Read more
§

fn try_get_u16(&mut self) -> Result<u16, TryGetError>

Gets an unsigned 16 bit integer from self in big-endian byte order. Read more
§

fn try_get_u16_le(&mut self) -> Result<u16, TryGetError>

Gets an unsigned 16 bit integer from self in little-endian byte order. Read more
§

fn try_get_u16_ne(&mut self) -> Result<u16, TryGetError>

Gets an unsigned 16 bit integer from self in native-endian byte order. Read more
§

fn try_get_i16(&mut self) -> Result<i16, TryGetError>

Gets a signed 16 bit integer from self in big-endian byte order. Read more
§

fn try_get_i16_le(&mut self) -> Result<i16, TryGetError>

Gets an signed 16 bit integer from self in little-endian byte order. Read more
§

fn try_get_i16_ne(&mut self) -> Result<i16, TryGetError>

Gets a signed 16 bit integer from self in native-endian byte order. Read more
§

fn try_get_u32(&mut self) -> Result<u32, TryGetError>

Gets an unsigned 32 bit integer from self in big-endian byte order. Read more
§

fn try_get_u32_le(&mut self) -> Result<u32, TryGetError>

Gets an unsigned 32 bit integer from self in little-endian byte order. Read more
§

fn try_get_u32_ne(&mut self) -> Result<u32, TryGetError>

Gets an unsigned 32 bit integer from self in native-endian byte order. Read more
§

fn try_get_i32(&mut self) -> Result<i32, TryGetError>

Gets a signed 32 bit integer from self in big-endian byte order. Read more
§

fn try_get_i32_le(&mut self) -> Result<i32, TryGetError>

Gets a signed 32 bit integer from self in little-endian byte order. Read more
§

fn try_get_i32_ne(&mut self) -> Result<i32, TryGetError>

Gets a signed 32 bit integer from self in native-endian byte order. Read more
§

fn try_get_u64(&mut self) -> Result<u64, TryGetError>

Gets an unsigned 64 bit integer from self in big-endian byte order. Read more
§

fn try_get_u64_le(&mut self) -> Result<u64, TryGetError>

Gets an unsigned 64 bit integer from self in little-endian byte order. Read more
§

fn try_get_u64_ne(&mut self) -> Result<u64, TryGetError>

Gets an unsigned 64 bit integer from self in native-endian byte order. Read more
§

fn try_get_i64(&mut self) -> Result<i64, TryGetError>

Gets a signed 64 bit integer from self in big-endian byte order. Read more
§

fn try_get_i64_le(&mut self) -> Result<i64, TryGetError>

Gets a signed 64 bit integer from self in little-endian byte order. Read more
§

fn try_get_i64_ne(&mut self) -> Result<i64, TryGetError>

Gets a signed 64 bit integer from self in native-endian byte order. Read more
§

fn try_get_u128(&mut self) -> Result<u128, TryGetError>

Gets an unsigned 128 bit integer from self in big-endian byte order. Read more
§

fn try_get_u128_le(&mut self) -> Result<u128, TryGetError>

Gets an unsigned 128 bit integer from self in little-endian byte order. Read more
§

fn try_get_u128_ne(&mut self) -> Result<u128, TryGetError>

Gets an unsigned 128 bit integer from self in native-endian byte order. Read more
§

fn try_get_i128(&mut self) -> Result<i128, TryGetError>

Gets a signed 128 bit integer from self in big-endian byte order. Read more
§

fn try_get_i128_le(&mut self) -> Result<i128, TryGetError>

Gets a signed 128 bit integer from self in little-endian byte order. Read more
§

fn try_get_i128_ne(&mut self) -> Result<i128, TryGetError>

Gets a signed 128 bit integer from self in native-endian byte order. Read more
§

fn try_get_uint(&mut self, nbytes: usize) -> Result<u64, TryGetError>

Gets an unsigned n-byte integer from self in big-endian byte order. Read more
§

fn try_get_uint_le(&mut self, nbytes: usize) -> Result<u64, TryGetError>

Gets an unsigned n-byte integer from self in little-endian byte order. Read more
§

fn try_get_uint_ne(&mut self, nbytes: usize) -> Result<u64, TryGetError>

Gets an unsigned n-byte integer from self in native-endian byte order. Read more
§

fn try_get_int(&mut self, nbytes: usize) -> Result<i64, TryGetError>

Gets a signed n-byte integer from self in big-endian byte order. Read more
§

fn try_get_int_le(&mut self, nbytes: usize) -> Result<i64, TryGetError>

Gets a signed n-byte integer from self in little-endian byte order. Read more
§

fn try_get_int_ne(&mut self, nbytes: usize) -> Result<i64, TryGetError>

Gets a signed n-byte integer from self in native-endian byte order. Read more
§

fn try_get_f32(&mut self) -> Result<f32, TryGetError>

Gets an IEEE754 single-precision (4 bytes) floating point number from\nself in big-endian byte order. Read more
§

fn try_get_f32_le(&mut self) -> Result<f32, TryGetError>

Gets an IEEE754 single-precision (4 bytes) floating point number from\nself in little-endian byte order. Read more
§

fn try_get_f32_ne(&mut self) -> Result<f32, TryGetError>

Gets an IEEE754 single-precision (4 bytes) floating point number from\nself in native-endian byte order. Read more
§

fn try_get_f64(&mut self) -> Result<f64, TryGetError>

Gets an IEEE754 double-precision (8 bytes) floating point number from\nself in big-endian byte order. Read more
§

fn try_get_f64_le(&mut self) -> Result<f64, TryGetError>

Gets an IEEE754 double-precision (8 bytes) floating point number from\nself in little-endian byte order. Read more
§

fn try_get_f64_ne(&mut self) -> Result<f64, TryGetError>

Gets an IEEE754 double-precision (8 bytes) floating point number from\nself in native-endian byte order. Read more
§

fn copy_to_bytes(&mut self, len: usize) -> Bytes

Consumes len bytes inside self and returns new instance of Bytes\nwith this data. Read more
§

fn take(self, limit: usize) -> Take<Self>
where\n Self: Sized,

Creates an adaptor which will read at most limit bytes from self. Read more
§

fn chain<U>(self, next: U) -> Chain<Self, U>
where\n U: Buf,\n Self: Sized,

Creates an adaptor which will chain this buffer with another. Read more
§

fn reader(self) -> Reader<Self>
where\n Self: Sized,

Creates an adaptor which implements the Read trait for self. Read more
","Buf","iroh_relay::dns::BoxIter"],["
§

impl<T> BufMut for Box<T>
where\n T: BufMut + ?Sized,

§

fn remaining_mut(&self) -> usize

Returns the number of bytes that can be written from the current\nposition until the end of the buffer is reached. Read more
§

fn chunk_mut(&mut self) -> &mut UninitSlice

Returns a mutable slice starting at the current BufMut position and of\nlength between 0 and BufMut::remaining_mut(). Note that this can be shorter than the\nwhole remainder of the buffer (this allows non-continuous implementation). Read more
§

unsafe fn advance_mut(&mut self, cnt: usize)

Advance the internal cursor of the BufMut Read more
§

fn put_slice(&mut self, src: &[u8])

Transfer bytes into self from src and advance the cursor by the\nnumber of bytes written. Read more
§

fn put_u8(&mut self, n: u8)

Writes an unsigned 8 bit integer to self. Read more
§

fn put_i8(&mut self, n: i8)

Writes a signed 8 bit integer to self. Read more
§

fn put_u16(&mut self, n: u16)

Writes an unsigned 16 bit integer to self in big-endian byte order. Read more
§

fn put_u16_le(&mut self, n: u16)

Writes an unsigned 16 bit integer to self in little-endian byte order. Read more
§

fn put_u16_ne(&mut self, n: u16)

Writes an unsigned 16 bit integer to self in native-endian byte order. Read more
§

fn put_i16(&mut self, n: i16)

Writes a signed 16 bit integer to self in big-endian byte order. Read more
§

fn put_i16_le(&mut self, n: i16)

Writes a signed 16 bit integer to self in little-endian byte order. Read more
§

fn put_i16_ne(&mut self, n: i16)

Writes a signed 16 bit integer to self in native-endian byte order. Read more
§

fn put_u32(&mut self, n: u32)

Writes an unsigned 32 bit integer to self in big-endian byte order. Read more
§

fn put_u32_le(&mut self, n: u32)

Writes an unsigned 32 bit integer to self in little-endian byte order. Read more
§

fn put_u32_ne(&mut self, n: u32)

Writes an unsigned 32 bit integer to self in native-endian byte order. Read more
§

fn put_i32(&mut self, n: i32)

Writes a signed 32 bit integer to self in big-endian byte order. Read more
§

fn put_i32_le(&mut self, n: i32)

Writes a signed 32 bit integer to self in little-endian byte order. Read more
§

fn put_i32_ne(&mut self, n: i32)

Writes a signed 32 bit integer to self in native-endian byte order. Read more
§

fn put_u64(&mut self, n: u64)

Writes an unsigned 64 bit integer to self in the big-endian byte order. Read more
§

fn put_u64_le(&mut self, n: u64)

Writes an unsigned 64 bit integer to self in little-endian byte order. Read more
§

fn put_u64_ne(&mut self, n: u64)

Writes an unsigned 64 bit integer to self in native-endian byte order. Read more
§

fn put_i64(&mut self, n: i64)

Writes a signed 64 bit integer to self in the big-endian byte order. Read more
§

fn put_i64_le(&mut self, n: i64)

Writes a signed 64 bit integer to self in little-endian byte order. Read more
§

fn put_i64_ne(&mut self, n: i64)

Writes a signed 64 bit integer to self in native-endian byte order. Read more
§

fn has_remaining_mut(&self) -> bool

Returns true if there is space in self for more bytes. Read more
§

fn put<T>(&mut self, src: T)
where\n T: Buf,\n Self: Sized,

Transfer bytes into self from src and advance the cursor by the\nnumber of bytes written. Read more
§

fn put_bytes(&mut self, val: u8, cnt: usize)

Put cnt bytes val into self. Read more
§

fn put_u128(&mut self, n: u128)

Writes an unsigned 128 bit integer to self in the big-endian byte order. Read more
§

fn put_u128_le(&mut self, n: u128)

Writes an unsigned 128 bit integer to self in little-endian byte order. Read more
§

fn put_u128_ne(&mut self, n: u128)

Writes an unsigned 128 bit integer to self in native-endian byte order. Read more
§

fn put_i128(&mut self, n: i128)

Writes a signed 128 bit integer to self in the big-endian byte order. Read more
§

fn put_i128_le(&mut self, n: i128)

Writes a signed 128 bit integer to self in little-endian byte order. Read more
§

fn put_i128_ne(&mut self, n: i128)

Writes a signed 128 bit integer to self in native-endian byte order. Read more
§

fn put_uint(&mut self, n: u64, nbytes: usize)

Writes an unsigned n-byte integer to self in big-endian byte order. Read more
§

fn put_uint_le(&mut self, n: u64, nbytes: usize)

Writes an unsigned n-byte integer to self in the little-endian byte order. Read more
§

fn put_uint_ne(&mut self, n: u64, nbytes: usize)

Writes an unsigned n-byte integer to self in the native-endian byte order. Read more
§

fn put_int(&mut self, n: i64, nbytes: usize)

Writes low nbytes of a signed integer to self in big-endian byte order. Read more
§

fn put_int_le(&mut self, n: i64, nbytes: usize)

Writes low nbytes of a signed integer to self in little-endian byte order. Read more
§

fn put_int_ne(&mut self, n: i64, nbytes: usize)

Writes low nbytes of a signed integer to self in native-endian byte order. Read more
§

fn put_f32(&mut self, n: f32)

Writes an IEEE754 single-precision (4 bytes) floating point number to\nself in big-endian byte order. Read more
§

fn put_f32_le(&mut self, n: f32)

Writes an IEEE754 single-precision (4 bytes) floating point number to\nself in little-endian byte order. Read more
§

fn put_f32_ne(&mut self, n: f32)

Writes an IEEE754 single-precision (4 bytes) floating point number to\nself in native-endian byte order. Read more
§

fn put_f64(&mut self, n: f64)

Writes an IEEE754 double-precision (8 bytes) floating point number to\nself in big-endian byte order. Read more
§

fn put_f64_le(&mut self, n: f64)

Writes an IEEE754 double-precision (8 bytes) floating point number to\nself in little-endian byte order. Read more
§

fn put_f64_ne(&mut self, n: f64)

Writes an IEEE754 double-precision (8 bytes) floating point number to\nself in native-endian byte order. Read more
§

fn limit(self, limit: usize) -> Limit<Self>
where\n Self: Sized,

Creates an adaptor which can write at most limit bytes to self. Read more
§

fn writer(self) -> Writer<Self>
where\n Self: Sized,

Creates an adaptor which implements the Write trait for self. Read more
§

fn chain_mut<U>(self, next: U) -> Chain<Self, U>
where\n U: BufMut,\n Self: Sized,

Creates an adapter which will chain this buffer with another. Read more
","BufMut","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<B> BufRead for Box<B>
where\n B: BufRead + ?Sized,

Source§

fn fill_buf(&mut self) -> Result<&[u8], Error>

Returns the contents of the internal buffer, filling it with more data, via Read methods, if empty. Read more
Source§

fn consume(&mut self, amt: usize)

Marks the given amount of additional bytes from the internal buffer as having been read.\nSubsequent calls to read only return bytes that have not been marked as read. Read more
Source§

fn has_data_left(&mut self) -> Result<bool, Error>

🔬This is a nightly-only experimental API. (buf_read_has_data_left)
Checks if there is any data left to be read. Read more
Source§

fn read_until(&mut self, byte: u8, buf: &mut Vec<u8>) -> Result<usize, Error>

Reads all bytes into buf until the delimiter byte or EOF is reached. Read more
Source§

fn skip_until(&mut self, byte: u8) -> Result<usize, Error>

Skips all bytes until the delimiter byte or EOF is reached. Read more
Source§

fn read_line(&mut self, buf: &mut String) -> Result<usize, Error>

Reads all bytes until a newline (the 0xA byte) is reached, and append\nthem to the provided String buffer. Read more
1.0.0 · Source§

fn split(self, byte: u8) -> Split<Self>
where\n Self: Sized,

Returns an iterator over the contents of this reader split on the byte\nbyte. Read more
1.0.0 · Source§

fn lines(self) -> Lines<Self>
where\n Self: Sized,

Returns an iterator over the lines of this reader. Read more
","BufRead","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Clone for Box<T, A>
where\n T: Clone,\n A: Allocator + Clone,

Source§

fn clone(&self) -> Box<T, A>

Returns a new box with a clone() of this box’s contents.

\n
§Examples
\n
let x = Box::new(5);\nlet y = x.clone();\n\n// The value is the same\nassert_eq!(x, y);\n\n// But they are unique objects\nassert_ne!(&*x as *const i32, &*y as *const i32);
Source§

fn clone_from(&mut self, source: &Box<T, A>)

Copies source’s contents into self without creating a new allocation.

\n
§Examples
\n
let x = Box::new(5);\nlet mut y = Box::new(10);\nlet yp: *const i32 = &*y;\n\ny.clone_from(&x);\n\n// The value is the same\nassert_eq!(x, y);\n\n// And no allocation occurred\nassert_eq!(yp, &*y);
","Clone","iroh_relay::dns::BoxIter"],["
Source§

impl<G, R, A> Coroutine<R> for Box<G, A>
where\n G: Coroutine<R> + Unpin + ?Sized,\n A: Allocator,

Source§

type Yield = <G as Coroutine<R>>::Yield

🔬This is a nightly-only experimental API. (coroutine_trait)
The type of value this coroutine yields. Read more
Source§

type Return = <G as Coroutine<R>>::Return

🔬This is a nightly-only experimental API. (coroutine_trait)
The type of value this coroutine returns. Read more
Source§

fn resume(\n self: Pin<&mut Box<G, A>>,\n arg: R,\n) -> CoroutineState<<Box<G, A> as Coroutine<R>>::Yield, <Box<G, A> as Coroutine<R>>::Return>

🔬This is a nightly-only experimental API. (coroutine_trait)
Resumes the execution of this coroutine. Read more
","Coroutine","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Debug for Box<T, A>
where\n T: Debug + ?Sized,\n A: Allocator,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Debug","iroh_relay::dns::BoxIter"],["
§

impl<'a, T> DecodeValue<'a> for Box<T>
where\n T: DecodeValue<'a>,

§

type Error = <T as DecodeValue<'a>>::Error

Type returned in the event of a decoding error.
§

fn decode_value<R>(\n reader: &mut R,\n header: Header,\n) -> Result<Box<T>, <Box<T> as DecodeValue<'a>>::Error>
where\n R: Reader<'a>,

Attempt to decode this message using the provided [Reader].
","DecodeValue<'a>","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T> Default for Box<T>
where\n T: Default,

Source§

fn default() -> Box<T>

Creates a Box<T>, with the Default value for T.

\n
","Default","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Deref for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

type Target = T

The resulting type after dereferencing.
Source§

fn deref(&self) -> &T

Dereferences the value.
","Deref","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> DerefMut for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn deref_mut(&mut self) -> &mut T

Mutably dereferences the value.
","DerefMut","iroh_relay::dns::BoxIter"],["
Source§

impl<'de, T> Deserialize<'de> for Box<T>
where\n T: Deserialize<'de>,

Source§

fn deserialize<D>(\n deserializer: D,\n) -> Result<Box<T>, <D as Deserializer<'de>>::Error>
where\n D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
","Deserialize<'de>","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Display for Box<T, A>
where\n T: Display + ?Sized,\n A: Allocator,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Display","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<I, A> DoubleEndedIterator for Box<I, A>
where\n I: DoubleEndedIterator + ?Sized,\n A: Allocator,

Source§

fn next_back(&mut self) -> Option<<I as Iterator>::Item>

Removes and returns an element from the end of the iterator. Read more
Source§

fn nth_back(&mut self, n: usize) -> Option<<I as Iterator>::Item>

Returns the nth element from the end of the iterator. Read more
Source§

fn advance_back_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator from the back by n elements. Read more
1.27.0 · Source§

fn try_rfold<B, F, R>(&mut self, init: B, f: F) -> R
where\n Self: Sized,\n F: FnMut(B, Self::Item) -> R,\n R: Try<Output = B>,

This is the reverse version of Iterator::try_fold(): it takes\nelements starting from the back of the iterator. Read more
1.27.0 · Source§

fn rfold<B, F>(self, init: B, f: F) -> B
where\n Self: Sized,\n F: FnMut(B, Self::Item) -> B,

An iterator method that reduces the iterator’s elements to a single,\nfinal value, starting from the back. Read more
1.27.0 · Source§

fn rfind<P>(&mut self, predicate: P) -> Option<Self::Item>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator from the back that satisfies a predicate. Read more
","DoubleEndedIterator","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Drop for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
","Drop","iroh_relay::dns::BoxIter"],["
§

impl<T> EncodeAsVarULE<T> for Box<T>
where\n T: VarULE + ?Sized,

§

fn encode_var_ule_as_slices<R>(&self, cb: impl FnOnce(&[&[u8]]) -> R) -> R

Calls cb with a piecewise list of byte slices that when concatenated\nproduce the memory pattern of the corresponding instance of T. Read more
§

fn encode_var_ule_len(&self) -> usize

Return the length, in bytes, of the corresponding [VarULE] type
§

fn encode_var_ule_write(&self, dst: &mut [u8])

Write the corresponding [VarULE] type to the dst buffer. dst should\nbe the size of [Self::encode_var_ule_len()]
","EncodeAsVarULE","iroh_relay::dns::BoxIter"],["
§

impl<T> EncodeValue for Box<T>
where\n T: EncodeValue,

§

fn value_len(&self) -> Result<Length, Error>

Compute the length of this value (sans [Tag]+[Length] header) when\nencoded as ASN.1 DER.
§

fn encode_value(&self, writer: &mut impl Writer) -> Result<(), Error>

Encode value (sans [Tag]+[Length] header) as ASN.1 DER using the\nprovided [Writer].
§

fn header(&self) -> Result<Header, Error>
where\n Self: Tagged,

Get the [Header] used to encode this value.
","EncodeValue","iroh_relay::dns::BoxIter"],["
1.8.0 · Source§

impl<E> Error for Box<E>
where\n E: Error,

Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
Source§

fn provide<'b>(&'b self, request: &mut Request<'b>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
","Error","iroh_relay::dns::BoxIter"],["
§

impl<E> ErrorCompat for Box<E>
where\n E: ErrorCompat,

§

fn backtrace(&self) -> Option<&Backtrace>

Returns a Backtrace that may be printed.
§

fn iter_chain(&self) -> ChainCompat<'_, '_>
where\n Self: AsErrorSource,

Returns an iterator for traversing the chain of errors,\nstarting with the current error\nand continuing with recursive calls to Error::source. Read more
","ErrorCompat","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<I, A> ExactSizeIterator for Box<I, A>
where\n I: ExactSizeIterator + ?Sized,\n A: Allocator,

Source§

fn len(&self) -> usize

Returns the exact remaining length of the iterator. Read more
Source§

fn is_empty(&self) -> bool

🔬This is a nightly-only experimental API. (exact_size_is_empty)
Returns true if the iterator is empty. Read more
","ExactSizeIterator","iroh_relay::dns::BoxIter"],["
1.35.0 · Source§

impl<Args, F, A> Fn<Args> for Box<F, A>
where\n Args: Tuple,\n F: Fn<Args> + ?Sized,\n A: Allocator,

Source§

extern "rust-call" fn call(\n &self,\n args: Args,\n) -> <Box<F, A> as FnOnce<Args>>::Output

🔬This is a nightly-only experimental API. (fn_traits)
Performs the call operation.
","Fn","iroh_relay::dns::BoxIter"],["
1.35.0 · Source§

impl<Args, F, A> FnMut<Args> for Box<F, A>
where\n Args: Tuple,\n F: FnMut<Args> + ?Sized,\n A: Allocator,

Source§

extern "rust-call" fn call_mut(\n &mut self,\n args: Args,\n) -> <Box<F, A> as FnOnce<Args>>::Output

🔬This is a nightly-only experimental API. (fn_traits)
Performs the call operation.
","FnMut","iroh_relay::dns::BoxIter"],["
1.35.0 · Source§

impl<Args, F, A> FnOnce<Args> for Box<F, A>
where\n Args: Tuple,\n F: FnOnce<Args> + ?Sized,\n A: Allocator,

Source§

type Output = <F as FnOnce<Args>>::Output

The returned type after the call operator is used.
Source§

extern "rust-call" fn call_once(\n self,\n args: Args,\n) -> <Box<F, A> as FnOnce<Args>>::Output

🔬This is a nightly-only experimental API. (fn_traits)
Performs the call operation.
","FnOnce","iroh_relay::dns::BoxIter"],["
1.6.0 · Source§

impl<T> From<T> for Box<T>

Source§

fn from(t: T) -> Box<T>

Converts a T into a Box<T>

\n

The conversion allocates on the heap and moves t\nfrom the stack into it.

\n
§Examples
\n
let x = 5;\nlet boxed = Box::new(5);\n\nassert_eq!(Box::from(x), boxed);
","From","iroh_relay::dns::BoxIter"],["
§

impl<F> FusedFuture for Box<F>
where\n F: FusedFuture + Unpin + ?Sized,

§

fn is_terminated(&self) -> bool

Returns true if the underlying future should no longer be polled.
","FusedFuture","iroh_relay::dns::BoxIter"],["
§

impl<S> FusedStream for Box<S>
where\n S: FusedStream + Unpin + ?Sized,

§

fn is_terminated(&self) -> bool

Returns true if the stream should no longer be polled.
","FusedStream","iroh_relay::dns::BoxIter"],["
1.36.0 · Source§

impl<F, A> Future for Box<F, A>
where\n F: Future + Unpin + ?Sized,\n A: Allocator,

Source§

type Output = <F as Future>::Output

The type of value produced on completion.
Source§

fn poll(\n self: Pin<&mut Box<F, A>>,\n cx: &mut Context<'_>,\n) -> Poll<<Box<F, A> as Future>::Output>

Attempts to resolve the future to a final value, registering\nthe current task for wakeup if the value is not yet available. Read more
","Future","iroh_relay::dns::BoxIter"],["
§

impl<T> GenerateImplicitData for Box<T>
where\n T: GenerateImplicitData,

§

fn generate() -> Box<T>

Build the data.
§

fn generate_with_source(source: &dyn Error) -> Box<T>
where\n Box<T>: Sized,

Build the data using the given source
","GenerateImplicitData","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Hash for Box<T, A>
where\n T: Hash + ?Sized,\n A: Allocator,

Source§

fn hash<H>(&self, state: &mut H)
where\n H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where\n H: Hasher,\n Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
","Hash","iroh_relay::dns::BoxIter"],["
1.22.0 · Source§

impl<T, A> Hasher for Box<T, A>
where\n T: Hasher + ?Sized,\n A: Allocator,

Source§

fn finish(&self) -> u64

Returns the hash value for the values written so far. Read more
Source§

fn write(&mut self, bytes: &[u8])

Writes some data into this Hasher. Read more
Source§

fn write_u8(&mut self, i: u8)

Writes a single u8 into this hasher.
Source§

fn write_u16(&mut self, i: u16)

Writes a single u16 into this hasher.
Source§

fn write_u32(&mut self, i: u32)

Writes a single u32 into this hasher.
Source§

fn write_u64(&mut self, i: u64)

Writes a single u64 into this hasher.
Source§

fn write_u128(&mut self, i: u128)

Writes a single u128 into this hasher.
Source§

fn write_usize(&mut self, i: usize)

Writes a single usize into this hasher.
Source§

fn write_i8(&mut self, i: i8)

Writes a single i8 into this hasher.
Source§

fn write_i16(&mut self, i: i16)

Writes a single i16 into this hasher.
Source§

fn write_i32(&mut self, i: i32)

Writes a single i32 into this hasher.
Source§

fn write_i64(&mut self, i: i64)

Writes a single i64 into this hasher.
Source§

fn write_i128(&mut self, i: i128)

Writes a single i128 into this hasher.
Source§

fn write_isize(&mut self, i: isize)

Writes a single isize into this hasher.
Source§

fn write_length_prefix(&mut self, len: usize)

🔬This is a nightly-only experimental API. (hasher_prefixfree_extras)
Writes a length prefix into this hasher, as part of being prefix-free. Read more
Source§

fn write_str(&mut self, s: &str)

🔬This is a nightly-only experimental API. (hasher_prefixfree_extras)
Writes a single str into this hasher. Read more
","Hasher","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<I, A> Iterator for Box<I, A>
where\n I: Iterator + ?Sized,\n A: Allocator,

Source§

type Item = <I as Iterator>::Item

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<<I as Iterator>::Item>

Advances the iterator and returns the next value. Read more
Source§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the iterator. Read more
Source§

fn nth(&mut self, n: usize) -> Option<<I as Iterator>::Item>

Returns the nth element of the iterator. Read more
Source§

fn last(self) -> Option<<I as Iterator>::Item>

Consumes the iterator, returning the last element. Read more
Source§

fn next_chunk<const N: usize>(\n &mut self,\n) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>
where\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_next_chunk)
Advances the iterator and returns an array containing the next N values. Read more
1.0.0 · Source§

fn count(self) -> usize
where\n Self: Sized,

Consumes the iterator, counting the number of iterations and returning it. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>

🔬This is a nightly-only experimental API. (iter_advance_by)
Advances the iterator by n elements. Read more
1.28.0 · Source§

fn step_by(self, step: usize) -> StepBy<Self>
where\n Self: Sized,

Creates an iterator starting at the same point, but stepping by\nthe given amount at each iteration. Read more
1.0.0 · Source§

fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
where\n Self: Sized,\n U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both in sequence. Read more
1.0.0 · Source§

fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>
where\n Self: Sized,\n U: IntoIterator,

‘Zips up’ two iterators into a single iterator of pairs. Read more
Source§

fn intersperse(self, separator: Self::Item) -> Intersperse<Self>
where\n Self: Sized,\n Self::Item: Clone,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places a copy of separator between adjacent\nitems of the original iterator. Read more
Source§

fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
where\n Self: Sized,\n G: FnMut() -> Self::Item,

🔬This is a nightly-only experimental API. (iter_intersperse)
Creates a new iterator which places an item generated by separator\nbetween adjacent items of the original iterator. Read more
1.0.0 · Source§

fn map<B, F>(self, f: F) -> Map<Self, F>
where\n Self: Sized,\n F: FnMut(Self::Item) -> B,

Takes a closure and creates an iterator which calls that closure on each\nelement. Read more
1.21.0 · Source§

fn for_each<F>(self, f: F)
where\n Self: Sized,\n F: FnMut(Self::Item),

Calls a closure on each element of an iterator. Read more
1.0.0 · Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator which uses a closure to determine if an element\nshould be yielded. Read more
1.0.0 · Source§

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
where\n Self: Sized,\n F: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both filters and maps. Read more
1.0.0 · Source§

fn enumerate(self) -> Enumerate<Self>
where\n Self: Sized,

Creates an iterator which gives the current iteration count as well as\nthe next value. Read more
1.0.0 · Source§

fn peekable(self) -> Peekable<Self>
where\n Self: Sized,

Creates an iterator which can use the peek and peek_mut methods\nto look at the next element of the iterator without consuming it. See\ntheir documentation for more information. Read more
1.0.0 · Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator that skips elements based on a predicate. Read more
1.0.0 · Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Creates an iterator that yields elements based on a predicate. Read more
1.57.0 · Source§

fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
where\n Self: Sized,\n P: FnMut(Self::Item) -> Option<B>,

Creates an iterator that both yields elements based on a predicate and maps. Read more
1.0.0 · Source§

fn skip(self, n: usize) -> Skip<Self>
where\n Self: Sized,

Creates an iterator that skips the first n elements. Read more
1.0.0 · Source§

fn take(self, n: usize) -> Take<Self>
where\n Self: Sized,

Creates an iterator that yields the first n elements, or fewer\nif the underlying iterator ends sooner. Read more
1.0.0 · Source§

fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where\n Self: Sized,\n F: FnMut(&mut St, Self::Item) -> Option<B>,

An iterator adapter which, like fold, holds internal state, but\nunlike fold, produces a new iterator. Read more
1.0.0 · Source§

fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
where\n Self: Sized,\n U: IntoIterator,\n F: FnMut(Self::Item) -> U,

Creates an iterator that works like map, but flattens nested structure. Read more
1.29.0 · Source§

fn flatten(self) -> Flatten<Self>
where\n Self: Sized,\n Self::Item: IntoIterator,

Creates an iterator that flattens nested structure. Read more
Source§

fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
where\n Self: Sized,\n F: FnMut(&[Self::Item; N]) -> R,

🔬This is a nightly-only experimental API. (iter_map_windows)
Calls the given function f for each contiguous window of size N over\nself and returns an iterator over the outputs of f. Like slice::windows(),\nthe windows during mapping overlap as well. Read more
1.0.0 · Source§

fn fuse(self) -> Fuse<Self>
where\n Self: Sized,

Creates an iterator which ends after the first None. Read more
1.0.0 · Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where\n Self: Sized,\n F: FnMut(&Self::Item),

Does something with each element of an iterator, passing the value on. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where\n Self: Sized,

Creates a “by reference” adapter for this instance of Iterator. Read more
1.0.0 · Source§

fn collect<B>(self) -> B
where\n B: FromIterator<Self::Item>,\n Self: Sized,

Transforms an iterator into a collection. Read more
Source§

fn try_collect<B>(\n &mut self,\n) -> <<Self::Item as Try>::Residual as Residual<B>>::TryType
where\n Self: Sized,\n Self::Item: Try,\n <Self::Item as Try>::Residual: Residual<B>,\n B: FromIterator<<Self::Item as Try>::Output>,

🔬This is a nightly-only experimental API. (iterator_try_collect)
Fallibly transforms an iterator into a collection, short circuiting if\na failure is encountered. Read more
Source§

fn collect_into<E>(self, collection: &mut E) -> &mut E
where\n E: Extend<Self::Item>,\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_collect_into)
Collects all the items from an iterator into a collection. Read more
1.0.0 · Source§

fn partition<B, F>(self, f: F) -> (B, B)
where\n Self: Sized,\n B: Default + Extend<Self::Item>,\n F: FnMut(&Self::Item) -> bool,

Consumes an iterator, creating two collections from it. Read more
Source§

fn partition_in_place<'a, T, P>(self, predicate: P) -> usize
where\n T: 'a,\n Self: Sized + DoubleEndedIterator<Item = &'a mut T>,\n P: FnMut(&T) -> bool,

🔬This is a nightly-only experimental API. (iter_partition_in_place)
Reorders the elements of this iterator in-place according to the given predicate,\nsuch that all those that return true precede all those that return false.\nReturns the number of true elements found. Read more
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where\n Self: Sized,\n P: FnMut(Self::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_is_partitioned)
Checks if the elements of this iterator are partitioned according to the given predicate,\nsuch that all those that return true precede all those that return false. Read more
1.27.0 · Source§

fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
where\n Self: Sized,\n F: FnMut(B, Self::Item) -> R,\n R: Try<Output = B>,

An iterator method that applies a function as long as it returns\nsuccessfully, producing a single, final value. Read more
1.27.0 · Source§

fn try_for_each<F, R>(&mut self, f: F) -> R
where\n Self: Sized,\n F: FnMut(Self::Item) -> R,\n R: Try<Output = ()>,

An iterator method that applies a fallible function to each item in the\niterator, stopping at the first error and returning that error. Read more
1.0.0 · Source§

fn fold<B, F>(self, init: B, f: F) -> B
where\n Self: Sized,\n F: FnMut(B, Self::Item) -> B,

Folds every element into an accumulator by applying an operation,\nreturning the final result. Read more
1.51.0 · Source§

fn reduce<F>(self, f: F) -> Option<Self::Item>
where\n Self: Sized,\n F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing\noperation. Read more
Source§

fn try_reduce<R>(\n &mut self,\n f: impl FnMut(Self::Item, Self::Item) -> R,\n) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
where\n Self: Sized,\n R: Try<Output = Self::Item>,\n <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (iterator_try_reduce)
Reduces the elements to a single one by repeatedly applying a reducing operation. If the\nclosure returns a failure, the failure is propagated back to the caller immediately. Read more
1.0.0 · Source§

fn all<F>(&mut self, f: F) -> bool
where\n Self: Sized,\n F: FnMut(Self::Item) -> bool,

Tests if every element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn any<F>(&mut self, f: F) -> bool
where\n Self: Sized,\n F: FnMut(Self::Item) -> bool,

Tests if any element of the iterator matches a predicate. Read more
1.0.0 · Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
where\n Self: Sized,\n P: FnMut(&Self::Item) -> bool,

Searches for an element of an iterator that satisfies a predicate. Read more
1.30.0 · Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where\n Self: Sized,\n F: FnMut(Self::Item) -> Option<B>,

Applies function to the elements of iterator and returns\nthe first non-none result. Read more
Source§

fn try_find<R>(\n &mut self,\n f: impl FnMut(&Self::Item) -> R,\n) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
where\n Self: Sized,\n R: Try<Output = bool>,\n <R as Try>::Residual: Residual<Option<Self::Item>>,

🔬This is a nightly-only experimental API. (try_find)
Applies function to the elements of iterator and returns\nthe first true result or the first error. Read more
1.0.0 · Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where\n Self: Sized,\n P: FnMut(Self::Item) -> bool,

Searches for an element in an iterator, returning its index. Read more
1.0.0 · Source§

fn rposition<P>(&mut self, predicate: P) -> Option<usize>
where\n P: FnMut(Self::Item) -> bool,\n Self: Sized + ExactSizeIterator + DoubleEndedIterator,

Searches for an element in an iterator from the right, returning its\nindex. Read more
1.0.0 · Source§

fn max(self) -> Option<Self::Item>
where\n Self: Sized,\n Self::Item: Ord,

Returns the maximum element of an iterator. Read more
1.0.0 · Source§

fn min(self) -> Option<Self::Item>
where\n Self: Sized,\n Self::Item: Ord,

Returns the minimum element of an iterator. Read more
1.6.0 · Source§

fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
where\n B: Ord,\n Self: Sized,\n F: FnMut(&Self::Item) -> B,

Returns the element that gives the maximum value from the\nspecified function. Read more
1.15.0 · Source§

fn max_by<F>(self, compare: F) -> Option<Self::Item>
where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the\nspecified comparison function. Read more
1.6.0 · Source§

fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
where\n B: Ord,\n Self: Sized,\n F: FnMut(&Self::Item) -> B,

Returns the element that gives the minimum value from the\nspecified function. Read more
1.15.0 · Source§

fn min_by<F>(self, compare: F) -> Option<Self::Item>
where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the\nspecified comparison function. Read more
1.0.0 · Source§

fn rev(self) -> Rev<Self>
where\n Self: Sized + DoubleEndedIterator,

Reverses an iterator’s direction. Read more
1.0.0 · Source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
where\n FromA: Default + Extend<A>,\n FromB: Default + Extend<B>,\n Self: Sized + Iterator<Item = (A, B)>,

Converts an iterator of pairs into a pair of containers. Read more
1.36.0 · Source§

fn copied<'a, T>(self) -> Copied<Self>
where\n T: Copy + 'a,\n Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which copies all of its elements. Read more
1.0.0 · Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where\n T: Clone + 'a,\n Self: Sized + Iterator<Item = &'a T>,

Creates an iterator which clones all of its elements. Read more
1.0.0 · Source§

fn cycle(self) -> Cycle<Self>
where\n Self: Sized + Clone,

Repeats an iterator endlessly. Read more
Source§

fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where\n Self: Sized,

🔬This is a nightly-only experimental API. (iter_array_chunks)
Returns an iterator over N elements of the iterator at a time. Read more
1.11.0 · Source§

fn sum<S>(self) -> S
where\n Self: Sized,\n S: Sum<Self::Item>,

Sums the elements of an iterator. Read more
1.11.0 · Source§

fn product<P>(self) -> P
where\n Self: Sized,\n P: Product<Self::Item>,

Iterates over the entire iterator, multiplying all the elements Read more
1.5.0 · Source§

fn cmp<I>(self, other: I) -> Ordering
where\n I: IntoIterator<Item = Self::Item>,\n Self::Item: Ord,\n Self: Sized,

Lexicographically compares the elements of this Iterator with those\nof another. Read more
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Ordering,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those\nof another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Lexicographically compares the PartialOrd elements of\nthis Iterator with those of another. The comparison works like short-circuit\nevaluation, returning a result without comparing the remaining elements.\nAs soon as an order can be determined, the evaluation stops and a result is returned. Read more
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,

🔬This is a nightly-only experimental API. (iter_order_by)
Lexicographically compares the elements of this Iterator with those\nof another with respect to the specified comparison function. Read more
1.5.0 · Source§

fn eq<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialEq<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are equal to those of\nanother. Read more
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where\n Self: Sized,\n I: IntoIterator,\n F: FnMut(Self::Item, <I as IntoIterator>::Item) -> bool,

🔬This is a nightly-only experimental API. (iter_order_by)
Determines if the elements of this Iterator are equal to those of\nanother with respect to the specified equality function. Read more
1.5.0 · Source§

fn ne<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialEq<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are not equal to those of\nanother. Read more
1.5.0 · Source§

fn lt<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\nless than those of another. Read more
1.5.0 · Source§

fn le<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\nless or equal to those of another. Read more
1.5.0 · Source§

fn gt<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\ngreater than those of another. Read more
1.5.0 · Source§

fn ge<I>(self, other: I) -> bool
where\n I: IntoIterator,\n Self::Item: PartialOrd<<I as IntoIterator>::Item>,\n Self: Sized,

Determines if the elements of this Iterator are lexicographically\ngreater than or equal to those of another. Read more
1.82.0 · Source§

fn is_sorted(self) -> bool
where\n Self: Sized,\n Self::Item: PartialOrd,

Checks if the elements of this iterator are sorted. Read more
1.82.0 · Source§

fn is_sorted_by<F>(self, compare: F) -> bool
where\n Self: Sized,\n F: FnMut(&Self::Item, &Self::Item) -> bool,

Checks if the elements of this iterator are sorted using the given comparator function. Read more
1.82.0 · Source§

fn is_sorted_by_key<F, K>(self, f: F) -> bool
where\n Self: Sized,\n F: FnMut(Self::Item) -> K,\n K: PartialOrd,

Checks if the elements of this iterator are sorted using the given key extraction\nfunction. Read more
","Iterator","iroh_relay::dns::BoxIter"],["
§

impl<Sp> LocalSpawn for Box<Sp>
where\n Sp: LocalSpawn + ?Sized,

§

fn spawn_local_obj(\n &self,\n future: LocalFutureObj<'static, ()>,\n) -> Result<(), SpawnError>

Spawns a future that will be run to completion. Read more
§

fn status_local(&self) -> Result<(), SpawnError>

Determines whether the executor is able to spawn new tasks. Read more
","LocalSpawn","iroh_relay::dns::BoxIter"],["
Source§

impl<T> Log for Box<T>
where\n T: Log + ?Sized,

Source§

fn enabled(&self, metadata: &Metadata<'_>) -> bool

Determines if a log message with the specified metadata would be\nlogged. Read more
Source§

fn log(&self, record: &Record<'_>)

Logs the Record. Read more
Source§

fn flush(&self)

Flushes any buffered records. Read more
","Log","iroh_relay::dns::BoxIter"],["
§

impl<T> MaxSize for Box<T>
where\n T: MaxSize,

§

const POSTCARD_MAX_SIZE: usize = T::POSTCARD_MAX_SIZE

The maximum possible size that the serialization of this\ntype can have, in bytes.
","MaxSize","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Ord for Box<T, A>
where\n T: Ord + ?Sized,\n A: Allocator,

Source§

fn cmp(&self, other: &Box<T, A>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where\n Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where\n Self: Sized,

Restrict a value to a certain interval. Read more
","Ord","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> PartialEq for Box<T, A>
where\n T: PartialEq + ?Sized,\n A: Allocator,

Source§

fn eq(&self, other: &Box<T, A>) -> bool

Tests for self and other values to be equal, and is used by ==.
Source§

fn ne(&self, other: &Box<T, A>) -> bool

Tests for !=. The default implementation is almost always sufficient,\nand should not be overridden without very good reason.
","PartialEq","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> PartialOrd for Box<T, A>
where\n T: PartialOrd + ?Sized,\n A: Allocator,

Source§

fn partial_cmp(&self, other: &Box<T, A>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
Source§

fn lt(&self, other: &Box<T, A>) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
Source§

fn le(&self, other: &Box<T, A>) -> bool

Tests less than or equal to (for self and other) and is used by the\n<= operator. Read more
Source§

fn ge(&self, other: &Box<T, A>) -> bool

Tests greater than or equal to (for self and other) and is used by\nthe >= operator. Read more
Source§

fn gt(&self, other: &Box<T, A>) -> bool

Tests greater than (for self and other) and is used by the >\noperator. Read more
","PartialOrd","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Pointer for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
","Pointer","iroh_relay::dns::BoxIter"],["
§

impl<B, E, P> Policy<B, E> for Box<P>
where\n P: Policy<B, E> + ?Sized,

§

fn redirect(&mut self, attempt: &Attempt<'_>) -> Result<Action, E>

Invoked when the service received a response with a redirection status code (3xx). Read more
§

fn on_request(&mut self, request: &mut Request<B>)

Invoked right before the service makes a request, regardless of whether it is redirected\nor not. Read more
§

fn clone_body(&self, body: &B) -> Option<B>

Try to clone a request body before the service makes a redirected request. Read more
","Policy","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<R> Read for Box<R>
where\n R: Read + ?Sized,

Source§

fn read(&mut self, buf: &mut [u8]) -> Result<usize, Error>

Pull some bytes from this source into the specified buffer, returning\nhow many bytes were read. Read more
Source§

fn read_buf(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Pull some bytes from this source into the specified buffer. Read more
Source§

fn read_vectored(&mut self, bufs: &mut [IoSliceMut<'_>]) -> Result<usize, Error>

Like read, except that it reads into a slice of buffers. Read more
Source§

fn is_read_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Reader has an efficient read_vectored\nimplementation. Read more
Source§

fn read_to_end(&mut self, buf: &mut Vec<u8>) -> Result<usize, Error>

Reads all bytes until EOF in this source, placing them into buf. Read more
Source§

fn read_to_string(&mut self, buf: &mut String) -> Result<usize, Error>

Reads all bytes until EOF in this source, appending them to buf. Read more
Source§

fn read_exact(&mut self, buf: &mut [u8]) -> Result<(), Error>

Reads the exact number of bytes required to fill buf. Read more
Source§

fn read_buf_exact(&mut self, cursor: BorrowedCursor<'_>) -> Result<(), Error>

🔬This is a nightly-only experimental API. (read_buf)
Reads the exact number of bytes required to fill cursor. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where\n Self: Sized,

Creates a “by reference” adapter for this instance of Read. Read more
1.0.0 · Source§

fn bytes(self) -> Bytes<Self>
where\n Self: Sized,

Transforms this Read instance to an Iterator over its bytes. Read more
1.0.0 · Source§

fn chain<R>(self, next: R) -> Chain<Self, R>
where\n R: Read,\n Self: Sized,

Creates an adapter which will chain this stream with another. Read more
1.0.0 · Source§

fn take(self, limit: u64) -> Take<Self>
where\n Self: Sized,

Creates an adapter which will read at most limit bytes from it. Read more
","Read","iroh_relay::dns::BoxIter"],["
§

impl<T> Read for Box<T>
where\n T: Read + Unpin + ?Sized,

§

fn poll_read(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n buf: ReadBufCursor<'_>,\n) -> Poll<Result<(), Error>>

Attempts to read bytes into the buf. Read more
","Read","iroh_relay::dns::BoxIter"],["
§

impl<R> Rng for Box<R>
where\n R: Rng + ?Sized,

§

fn next_u64(&mut self) -> u64

Generate a random u64.
§

fn next_f64(&mut self) -> f64

Generate a random f64 between [0, 1).
§

fn next_range(&mut self, range: Range<u64>) -> u64

Randomly pick a value within the range. Read more
","Rng","iroh_relay::dns::BoxIter"],["
Source§

impl<R> RngCore for Box<R>
where\n R: RngCore + ?Sized,

Source§

fn next_u32(&mut self) -> u32

Return the next random u32. Read more
Source§

fn next_u64(&mut self) -> u64

Return the next random u64. Read more
Source§

fn fill_bytes(&mut self, dest: &mut [u8])

Fill dest with random data. Read more
Source§

fn try_fill_bytes(&mut self, dest: &mut [u8]) -> Result<(), Error>

Fill dest entirely with random data. Read more
","RngCore","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<S> Seek for Box<S>
where\n S: Seek + ?Sized,

Source§

fn seek(&mut self, pos: SeekFrom) -> Result<u64, Error>

Seek to an offset, in bytes, in a stream. Read more
Source§

fn rewind(&mut self) -> Result<(), Error>

Rewind to the beginning of a stream. Read more
Source§

fn stream_len(&mut self) -> Result<u64, Error>

🔬This is a nightly-only experimental API. (seek_stream_len)
Returns the length of this stream (in bytes). Read more
Source§

fn stream_position(&mut self) -> Result<u64, Error>

Returns the current seek position from the start of the stream. Read more
Source§

fn seek_relative(&mut self, offset: i64) -> Result<(), Error>

Seeks relative to the current position. Read more
","Seek","iroh_relay::dns::BoxIter"],["
Source§

impl<T> Serialize for Box<T>
where\n T: Serialize + ?Sized,

Source§

fn serialize<S>(\n &self,\n serializer: S,\n) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where\n S: Serializer,

","Serialize","iroh_relay::dns::BoxIter"],["
Source§

impl<T> Serialize for Box<T>
where\n T: Serialize + ?Sized,

Source§

fn serialize<S>(\n &self,\n serializer: S,\n) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>
where\n S: Serializer,

Serialize this value into the given Serde serializer. Read more
","Serialize","iroh_relay::dns::BoxIter"],["
§

impl<Request, S> Service<Request> for Box<S>
where\n S: Service<Request> + ?Sized,

§

type Response = <S as Service<Request>>::Response

Responses given by the service.
§

type Error = <S as Service<Request>>::Error

Errors produced by the service. Read more
§

type Future = <S as Service<Request>>::Future

The future response value.
§

fn call(&self, req: Request) -> <Box<S> as Service<Request>>::Future

Process the request and return the response asynchronously.\ncall takes &self instead of mut &self because: Read more
","Service","iroh_relay::dns::BoxIter"],["
§

impl<S, Request> Service<Request> for Box<S>
where\n S: Service<Request> + ?Sized,

§

type Response = <S as Service<Request>>::Response

Responses given by the service.
§

type Error = <S as Service<Request>>::Error

Errors produced by the service.
§

type Future = <S as Service<Request>>::Future

The future response value.
§

fn poll_ready(\n &mut self,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), <S as Service<Request>>::Error>>

Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more
§

fn call(&mut self, request: Request) -> <S as Service<Request>>::Future

Process the request and return the response asynchronously. Read more
","Service","iroh_relay::dns::BoxIter"],["
§

impl<S, Item> Sink<Item> for Box<S>
where\n S: Sink<Item> + Unpin + ?Sized,

§

type Error = <S as Sink<Item>>::Error

The type of value produced by the sink when an error occurs.
§

fn poll_ready(\n self: Pin<&mut Box<S>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), <Box<S> as Sink<Item>>::Error>>

Attempts to prepare the Sink to receive a value. Read more
§

fn start_send(\n self: Pin<&mut Box<S>>,\n item: Item,\n) -> Result<(), <Box<S> as Sink<Item>>::Error>

Begin the process of sending a value to the sink.\nEach call to this function must be preceded by a successful call to\npoll_ready which returned Poll::Ready(Ok(())). Read more
§

fn poll_flush(\n self: Pin<&mut Box<S>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), <Box<S> as Sink<Item>>::Error>>

Flush any remaining output from this sink. Read more
§

fn poll_close(\n self: Pin<&mut Box<S>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), <Box<S> as Sink<Item>>::Error>>

Flush any remaining output and close this sink, if necessary. Read more
","Sink","iroh_relay::dns::BoxIter"],["
§

impl<T> Source for Box<T>
where\n T: Source + ?Sized,

§

fn register(\n &mut self,\n registry: &Registry,\n token: Token,\n interests: Interest,\n) -> Result<(), Error>

Register self with the given Registry instance. Read more
§

fn reregister(\n &mut self,\n registry: &Registry,\n token: Token,\n interests: Interest,\n) -> Result<(), Error>

Re-register self with the given Registry instance. Read more
§

fn deregister(&mut self, registry: &Registry) -> Result<(), Error>

Deregister self from the given Registry instance. Read more
","Source","iroh_relay::dns::BoxIter"],["
§

impl<Sp> Spawn for Box<Sp>
where\n Sp: Spawn + ?Sized,

§

fn spawn_obj(&self, future: FutureObj<'static, ()>) -> Result<(), SpawnError>

Spawns a future that will be run to completion. Read more
§

fn status(&self) -> Result<(), SpawnError>

Determines whether the executor is able to spawn new tasks. Read more
","Spawn","iroh_relay::dns::BoxIter"],["
§

impl<S> Stream for Box<S>
where\n S: Stream + Unpin + ?Sized,

§

type Item = <S as Stream>::Item

Values yielded by the stream.
§

fn poll_next(\n self: Pin<&mut Box<S>>,\n cx: &mut Context<'_>,\n) -> Poll<Option<<Box<S> as Stream>::Item>>

Attempt to pull out the next value of this stream, registering the\ncurrent task for wakeup if the value is not yet available, and returning\nNone if the stream is exhausted. Read more
§

fn size_hint(&self) -> (usize, Option<usize>)

Returns the bounds on the remaining length of the stream. Read more
","Stream","iroh_relay::dns::BoxIter"],["
§

impl<S> Subscriber for Box<S>
where\n S: Subscriber + ?Sized,

§

fn register_callsite(&self, metadata: &'static Metadata<'static>) -> Interest

Registers a new callsite with this subscriber, returning whether or not\nthe subscriber is interested in being notified about the callsite. Read more
§

fn enabled(&self, metadata: &Metadata<'_>) -> bool

Returns true if a span or event with the specified metadata would be\nrecorded. Read more
§

fn max_level_hint(&self) -> Option<LevelFilter>

Returns the highest verbosity level that this Subscriber will\nenable, or None, if the subscriber does not implement level-based\nfiltering or chooses not to implement this method. Read more
§

fn new_span(&self, span: &Attributes<'_>) -> Id

Visit the construction of a new span, returning a new span ID for the\nspan being constructed. Read more
§

fn record(&self, span: &Id, values: &Record<'_>)

Record a set of values on a span. Read more
§

fn record_follows_from(&self, span: &Id, follows: &Id)

Adds an indication that span follows from the span with the id\nfollows. Read more
§

fn event_enabled(&self, event: &Event<'_>) -> bool

Determine if an [Event] should be recorded. Read more
§

fn event(&self, event: &Event<'_>)

Records that an Event has occurred. Read more
§

fn enter(&self, span: &Id)

Records that a span has been entered. Read more
§

fn exit(&self, span: &Id)

Records that a span has been exited. Read more
§

fn clone_span(&self, id: &Id) -> Id

Notifies the subscriber that a span ID has been cloned. Read more
§

fn try_close(&self, id: Id) -> bool

Notifies the subscriber that a span ID has been dropped, and returns\ntrue if there are now 0 IDs that refer to that span. Read more
§

fn drop_span(&self, id: Id)

👎Deprecated since 0.1.2: use Subscriber::try_close instead
This method is deprecated. Read more
§

fn current_span(&self) -> Current

Returns a type representing this subscriber’s view of the current span. Read more
§

unsafe fn downcast_raw(&self, id: TypeId) -> Option<*const ()>

If self is the same type as the provided TypeId, returns an untyped\n*const pointer to that type. Otherwise, returns None. Read more
§

fn on_register_dispatch(&self, subscriber: &Dispatch)

Invoked when this subscriber becomes a [Dispatch]. Read more
","Subscriber","iroh_relay::dns::BoxIter"],["
§

impl<'a, T, F> UnsafeFutureObj<'a, T> for Box<F>
where\n F: Future<Output = T> + 'a,

§

fn into_raw(self) -> *mut dyn Future<Output = T> + 'a

Convert an owned instance into a (conceptually owned) fat pointer. Read more
§

unsafe fn drop(ptr: *mut dyn Future<Output = T> + 'a)

Drops the future represented by the given fat pointer. Read more
","UnsafeFutureObj<'a, T>","iroh_relay::dns::BoxIter"],["
§

impl<T> Value for Box<T>
where\n T: Value + ?Sized,

§

fn record(&self, key: &Field, visitor: &mut dyn Visit)

Visits this value with the given Visitor.
","Value","iroh_relay::dns::BoxIter"],["
§

impl<T> Write for Box<T>
where\n T: Write + Unpin + ?Sized,

§

fn poll_write(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n buf: &[u8],\n) -> Poll<Result<usize, Error>>

Attempt to write bytes from buf into the destination. Read more
§

fn poll_write_vectored(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n bufs: &[IoSlice<'_>],\n) -> Poll<Result<usize, Error>>

Like poll_write, except that it writes from a slice of buffers.
§

fn is_write_vectored(&self) -> bool

Returns whether this writer has an efficient poll_write_vectored\nimplementation. Read more
§

fn poll_flush(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), Error>>

Attempts to flush the object. Read more
§

fn poll_shutdown(\n self: Pin<&mut Box<T>>,\n cx: &mut Context<'_>,\n) -> Poll<Result<(), Error>>

Attempts to shut down this writer.
","Write","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<W> Write for Box<W>
where\n W: Write + ?Sized,

Source§

fn write(&mut self, buf: &[u8]) -> Result<usize, Error>

Writes a buffer into this writer, returning how many bytes were written. Read more
Source§

fn write_vectored(&mut self, bufs: &[IoSlice<'_>]) -> Result<usize, Error>

Like write, except that it writes from a slice of buffers. Read more
Source§

fn is_write_vectored(&self) -> bool

🔬This is a nightly-only experimental API. (can_vector)
Determines if this Writer has an efficient write_vectored\nimplementation. Read more
Source§

fn flush(&mut self) -> Result<(), Error>

Flushes this output stream, ensuring that all intermediately buffered\ncontents reach their destination. Read more
Source§

fn write_all(&mut self, buf: &[u8]) -> Result<(), Error>

Attempts to write an entire buffer into this writer. Read more
Source§

fn write_all_vectored(&mut self, bufs: &mut [IoSlice<'_>]) -> Result<(), Error>

🔬This is a nightly-only experimental API. (write_all_vectored)
Attempts to write multiple buffers into this writer. Read more
Source§

fn write_fmt(&mut self, fmt: Arguments<'_>) -> Result<(), Error>

Writes a formatted string into this writer, returning any error\nencountered. Read more
1.0.0 · Source§

fn by_ref(&mut self) -> &mut Self
where\n Self: Sized,

Creates a “by reference” adapter for this instance of Write. Read more
","Write","iroh_relay::dns::BoxIter"],["
§

impl<'a, T> Writeable for Box<T>
where\n T: Writeable + ?Sized,

§

fn write_to<W>(&self, sink: &mut W) -> Result<(), Error>
where\n W: Write + ?Sized,

Writes a string to the given sink. Errors from the sink are bubbled up.\nThe default implementation delegates to write_to_parts, and discards any\nPart annotations.
§

fn write_to_parts<W>(&self, sink: &mut W) -> Result<(), Error>
where\n W: PartsWrite + ?Sized,

Write bytes and Part annotations to the given sink. Errors from the\nsink are bubbled up. The default implementation delegates to write_to,\nand doesn’t produce any Part annotations.
§

fn writeable_length_hint(&self) -> LengthHint

Returns a hint for the number of UTF-8 bytes that will be written to the sink. Read more
§

fn write_to_string(&self) -> Cow<'_, str>

Creates a new String with the data from this Writeable. Like ToString,\nbut smaller and faster. Read more
","Writeable","iroh_relay::dns::BoxIter"],["
§

impl<T> CartablePointerLike for Box<T>

","CartablePointerLike","iroh_relay::dns::BoxIter"],["
Source§

impl<T, U, A> CoerceUnsized<Box<U, A>> for Box<T, A>
where\n T: Unsize<U> + ?Sized,\n A: Allocator,\n U: ?Sized,

","CoerceUnsized>","iroh_relay::dns::BoxIter"],["
Source§

impl<R> CryptoRng for Box<R>
where\n R: CryptoRng + ?Sized,

","CryptoRng","iroh_relay::dns::BoxIter"],["
Source§

impl<T, A> DerefPure for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

","DerefPure","iroh_relay::dns::BoxIter"],["
Source§

impl<T, U> DispatchFromDyn<Box<U>> for Box<T>
where\n T: Unsize<U> + ?Sized,\n U: ?Sized,

","DispatchFromDyn>","iroh_relay::dns::BoxIter"],["
1.0.0 · Source§

impl<T, A> Eq for Box<T, A>
where\n T: Eq + ?Sized,\n A: Allocator,

","Eq","iroh_relay::dns::BoxIter"],["
1.26.0 · Source§

impl<I, A> FusedIterator for Box<I, A>
where\n I: FusedIterator + ?Sized,\n A: Allocator,

","FusedIterator","iroh_relay::dns::BoxIter"],["
Source§

impl<T, A> PinCoerceUnsized for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

","PinCoerceUnsized","iroh_relay::dns::BoxIter"],["
§

impl<'a, T> Sequence<'a> for Box<T>
where\n T: Sequence<'a>,

","Sequence<'a>","iroh_relay::dns::BoxIter"],["
§

impl<T> StableDeref for Box<T>
where\n T: ?Sized,

","StableDeref","iroh_relay::dns::BoxIter"],["
1.33.0 · Source§

impl<T, A> Unpin for Box<T, A>
where\n A: Allocator,\n T: ?Sized,

","Unpin","iroh_relay::dns::BoxIter"]]]]); if (window.register_type_impls) { window.register_type_impls(type_impls); } else { window.pending_type_impls = type_impls; } })() -//{"start":55,"fragment_lengths":[607168]} \ No newline at end of file +//{"start":55,"fragment_lengths":[607585]} \ No newline at end of file