Skip to main content

Config

Struct Config 

Source
#[non_exhaustive]
pub struct Config {
Show 13 fields pub block_check: BlockCheck, pub eight_bit_clean: bool, pub repeat: bool, pub timeout: Duration, pub retries: u32, pub first_packet_retries: Option<u32>, pub first_packet_nak_window: Option<Duration>, pub first_packet_nak_grace: Option<Duration>, pub first_packet_nak_byte_time: Option<Duration>, pub packet_pause: Duration, pub nak_grace: Duration, pub linger: Duration, pub max_size: Option<usize>,
}
Expand description

Tunables of a Client.

Non-exhaustive: start from Config::default and set the fields you need.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§block_check: BlockCheck

Block check we offer in our Send-Init (default type 3).

§eight_bit_clean: bool

true (default): we offer QBIN Y (no 8th-bit prefixing unless the peer asks); false: we ask for 8th-bit prefixing with &.

§repeat: bool

true (default): we offer REPT ~; false: no repeat compression.

§timeout: Duration

Our receive timeout per packet (default 20 s).

§retries: u32

Retransmissions per packet before giving up (default 5).

§first_packet_retries: Option<u32>

Retransmissions of the packet that starts a server transaction (the C, R, G or I) while no reply to it has arrived; None (default) means Config::retries. Once the server answers (its S), Config::retries applies to the rest of the transaction. Some(0) sends a host command exactly once: a server cannot tell a resent C from a new one and runs it again, while a damaged reply packet is still re-requested.

§first_packet_nak_window: Option<Duration>

Immediate-NAK window for the first packet (default None: off). When Config::first_packet_retries forbids another resend of the packet that starts a transaction, a NAK of it (seq 0) that arrives within this window after Client::poll_output handed the packet out allows exactly one more resend: the server rejected the packet (damaged on the line, sent while it was busy). The resend goes out after Config::first_packet_nak_grace unless the server’s S (or another answer) arrives first. A later NAK, a second NAK and a timeout never allow it. Set it to the time the packet takes on the wire plus slack: an idle server’s periodic NAK is byte-identical to a rejection, and one that crosses the packet inside the window (the server did take it) makes the command run twice if its answer takes longer than the grace.

§first_packet_nak_grace: Option<Duration>

Wait after a NAK inside Config::first_packet_nak_window before the one resend it allows; None (default) means Config::nak_grace. Capped by the receive timeout. Further NAKs while the granted resend waits do not shorten it.

§first_packet_nak_byte_time: Option<Duration>

Lower bound of Config::first_packet_nak_window: the time one byte takes on the link (10 bits / baud, ~1.04 ms at 9600 baud). A NAK that arrives sooner after the packet was handed out than the packet’s length times this cannot be the server’s answer to it (the packet had not finished arriving): it is stale (input that was waiting, or the idle server’s NAK sent while ours was on the wire). None (default): no lower bound.

§packet_pause: Duration

Delay before each packet we send in reply to input (default 0).

§nak_grace: Duration

How long a NAK received while waiting for the reply to the first packet is tolerated before we resend (default 1 s); such a NAK is usually a stale one from the idle server.

§linger: Duration

After we ACK the final B packet of a receive, keep answering a retransmitted B with the same ACK for this long (default 1 s), in case our ACK was damaged or lost. Done is emitted when the ACK is queued; the linger emits nothing. Client::is_idle is false while it lasts; Client::start ends it early. Duration::ZERO turns it off. A peer that only retransmits after its own timeout (the TIME we send, Config::timeout) is caught only by a linger that long.

§max_size: Option<usize>

Receive: most decoded data bytes accepted in one transaction (all files and server text together); more fails the transaction with Error::TooLarge and an E packet. Default 4 MiB, well above the largest HP object; None means no limit.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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§

§

impl Forget for Config

§

impl Freeze for Config

§

impl Move for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnsafeUnpin 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
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, 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.