RestConf

Struct RestConf 

Source
pub struct RestConf {
Show 22 fields pub service: ServiceConf, pub host: String, pub port: u16, pub cert_file: Option<String>, pub key_file: Option<String>, pub max_connections: i64, pub max_bytes: i64, pub timeout: Option<u64>, pub cpu_threshold: i64, pub signature: Option<SignatureConf>, pub middlewares: MiddlewaresConf, pub trace_ignore_paths: Vec<String>, pub workers: Option<usize>, pub reuse_port: bool, pub cpu_affinity: Option<Vec<usize>>, pub http2: bool, pub h2c: bool, pub http1_keep_alive: bool, pub http1_max_buf_size: Option<usize>, pub tcp_keepalive_secs: Option<u64>, pub rate_limit: Option<RateLimitConf>, pub concurrency_limit: Option<usize>,
}
Expand description

RestConf definition (rest package).

Fields§

§service: ServiceConf

Equivalent to embedding service.ServiceConf

§host: String§port: u16§cert_file: Option<String>§key_file: Option<String>§max_connections: i64§max_bytes: i64§timeout: Option<u64>

Per-request timeout in milliseconds. None disables it. Default 3000ms.

§cpu_threshold: i64

range: [0, 1000)

§signature: Option<SignatureConf>§middlewares: MiddlewaresConf

There are default values for all the items in Middlewares.

§trace_ignore_paths: Vec<String>

TraceIgnorePaths is paths blacklist for trace middleware.

§workers: Option<usize>

Tokio worker threads (None => tokio default).

§reuse_port: bool

Enable SO_REUSEPORT multi-listener (Linux recommended for multi-core).

§cpu_affinity: Option<Vec<usize>>

CPU affinity (Linux only). Ignored on unsupported platforms.

§http2: bool

Enable HTTP/2 (TLS or h2c). Default off (HTTP/1.1).

§h2c: bool

Enable h2c (HTTP/2 without TLS). Default off.

§http1_keep_alive: bool

http1 keep-alive toggle.

§http1_max_buf_size: Option<usize>

http1 max buffer size.

§tcp_keepalive_secs: Option<u64>

TCP keepalive seconds (None => OS default).

§rate_limit: Option<RateLimitConf>

Global rate limit config (tokens/s, burst). None => disabled.

§concurrency_limit: Option<usize>

Global concurrent in-flight request limit. None => disabled.

Implementations§

Source§

impl RestConf

Source

pub fn new() -> Self

Source§

impl RestConf

Source

pub fn addr_string(&self) -> String

Source

pub fn validate(&self) -> Result<(), String>

Trait Implementations§

Source§

impl Clone for RestConf

Source§

fn clone(&self) -> RestConf

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 RestConf

Source§

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

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

impl Default for RestConf

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for RestConf

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 RestConf

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

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,