Skip to main content

IoConfig

Struct IoConfig 

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

Base io configuration

Implementations§

Source§

impl IoConfig

Source

pub fn new() -> IoConfig

Create new config object

Source

pub fn tag(&self) -> &str

Get tag

Source

pub fn connect_timeout(&self) -> Millis

Get connect timeout

Source

pub fn keepalive_timeout(&self) -> Seconds

Get keep-alive timeout

Source

pub fn disconnect_timeout(&self) -> Seconds

Get disconnect timeout

Source

pub fn frame_read_rate(&self) -> Option<&FrameReadRate>

Get frame read params

Source

pub fn read_buf(&self) -> &BufConfig

Get read buffer parameters

Source

pub fn write_buf(&self) -> &BufConfig

Get write buffer parameters

Source

pub fn write_page_size(&self) -> BytePageSize

Get write page size

Source

pub fn write_buf_threshold(&self) -> usize

The write buffer threshold that triggers earlier sending.

Source

pub fn set_connect_timeout<T>(self, timeout: T) -> IoConfig
where T: Into<Millis>,

Set connect timeout in seconds.

To disable timeout set value to 0.

By default connect timeout is disabled.

Source

pub fn set_keepalive_timeout<T>(self, timeout: T) -> IoConfig
where T: Into<Seconds>,

Set keep-alive timeout in seconds.

To disable timeout set value to 0.

By default keep-alive timeout is disabled.

Source

pub fn set_disconnect_timeout<T>(self, timeout: T) -> IoConfig
where T: Into<Seconds>,

Set connection disconnect timeout.

Defines a timeout for disconnect connection. If a disconnect procedure does not complete within this time, the connection get dropped.

To disable timeout set value to 0.

By default disconnect timeout is set to 1 seconds.

Source

pub fn set_frame_read_rate( self, timeout: Seconds, max_timeout: Seconds, rate: u32, ) -> IoConfig

Set read rate parameters for single frame.

Set read timeout, max timeout and rate for reading payload. If the client sends rate amount of data within timeout period of time, extend timeout by timeout seconds. But no more than max_timeout timeout.

By default frame read rate is disabled.

Source

pub fn set_read_buf( self, high_watermark: usize, low_watermark: usize, cache_size: usize, ) -> IoConfig

Set read buffer parameters.

By default high watermark is set to 16Kb, low watermark 1kb.

Source

pub fn set_write_page_size(self, size: BytePageSize) -> IoConfig

Set write buffer page size.

By default page size is set to 16kb.

Source

pub fn set_write_buf_threshold(self, size: usize) -> IoConfig

Sets the write buffer threshold.

The app encodes data in response to incoming data, continuing to fill the write buffer until all data has been processed. Only then can the runtime wake the write task to send the buffered data.

By that time, the buffer may have accumulated a large amount of data, causing it to be sent in large bursts, which introduces latency. To prevent this behavior and flatten data delivery to the peer, ntex’s io can initiate out-of-order writes based on a configured threshold.

Set 0 to disable send-buf.

Source

pub fn set_write_buf( self, high_watermark: usize, low_watermark: usize, cache_size: usize, ) -> IoConfig

Set write buffer parameters.

By default high watermark is set to 16Kb, low watermark 1kb.

Trait Implementations§

Source§

impl Configuration for IoConfig

Source§

const NAME: &'static str = "IO Configuration"

Source§

fn ctx(&self) -> &CfgContext

Source§

fn set_ctx(&mut self, ctx: CfgContext)

Source§

impl Debug for IoConfig

Source§

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

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

impl Default for IoConfig

Source§

fn default() -> IoConfig

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Same for T

Source§

type Output = T

Should always be Self
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.