Skip to main content

Config

Struct Config 

Source
pub struct Config {
    pub initial_stream_window: u32,
    pub max_frame_size: u32,
    pub max_streams: usize,
    pub keepalive_interval: Option<Duration>,
    pub keepalive_timeout: Duration,
    pub open_timeout: Duration,
}
Expand description

Tunable parameters for a Session.

Build via Config::builder or take Config::default for sensible defaults. Once a Session is constructed the configuration is immutable.

Fields§

§initial_stream_window: u32

Initial credit (in bytes) granted to each newly-opened receive stream. Doubles as the maximum amount of pending unread data the session will buffer per stream before exerting back-pressure on the peer.

§max_frame_size: u32

Hard upper bound on the payload of a single Data frame. Larger user writes are transparently fragmented.

§max_streams: usize

Hard cap on concurrently open streams. Attempts to exceed this raise Error::TooManyStreams.

§keepalive_interval: Option<Duration>

Interval between automatic Ping frames. None disables keepalive.

§keepalive_timeout: Duration

How long to wait for a Ping reply before declaring the session dead.

§open_timeout: Duration

Maximum time Session::open will wait for the peer’s ACK.

Implementations§

Source§

impl Config

Source

pub const DEFAULT_INITIAL_STREAM_WINDOW: u32

Default initial per-stream window: 256 KiB.

Source

pub const DEFAULT_MAX_FRAME_SIZE: u32

Default maximum single-frame payload: 64 KiB.

Source

pub const DEFAULT_MAX_STREAMS: usize = 1024

Default maximum concurrent streams: 1024.

Source

pub const DEFAULT_KEEPALIVE_INTERVAL: Duration

Default keepalive interval: 30 seconds.

Source

pub const DEFAULT_KEEPALIVE_TIMEOUT: Duration

Default keepalive timeout: 30 seconds.

Source

pub const DEFAULT_OPEN_TIMEOUT: Duration

Default open timeout: 10 seconds.

Source

pub fn builder() -> ConfigBuilder

Start a new builder using the default configuration.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

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 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

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
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more