Skip to main content

WebAppConfig

Struct WebAppConfig 

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

Application configuration

Implementations§

Source§

impl WebAppConfig

Source

pub fn new() -> Self

Create an default WebAppConfig instance.

Source

pub fn with(name: &str, secure: bool, addr: SocketAddr, host: String) -> Self

Create an WebAppConfig instance.

Source

pub fn name(&self) -> &ByteString

Server name

Source

pub fn host(&self) -> &str

Server host name

Host name is used by application router as a hostname for url generation. Check ConnectionInfo::host() documentation for more information.

By default host name is set to a “localhost:8080” value.

Source

pub fn secure(&self) -> bool

Returns true if connection is secure(https)

Source

pub fn local_addr(&self) -> SocketAddr

Returns the socket address of the local half of this TCP connection

Source

pub fn state<T: 'static>(&self) -> Option<&T>

Get an application state object stored with .set_state() method.

Source

pub fn set_host(self, host: String) -> Self

Set server host name.

By default host name is set to a “localhost:8080” value.

Source

pub fn set_secure(self) -> Self

Connection is secure(https).

Source

pub fn set_local_addr(self, addr: SocketAddr) -> Self

Set the socket address of the local half of the TCP connection.

Source

pub fn set_pool_size(self, size: usize) -> Self

Set size of HttpRequest pool size.

By default pool size is 128.

Source

pub fn set_state<T: Send + Sync + 'static>(self, val: T) -> Self

Set application level arbitrary state item.

Application state stored with .set_state() method is available via HttpRequest::app_state() method at runtime.

Trait Implementations§

Source§

impl Configuration for WebAppConfig

Source§

const NAME: &str = "Web app configuration"

Human-readable configuration name used in diagnostics.
Source§

fn ctx(&self) -> &CfgContext

Returns the shared context associated with this value.
Source§

fn set_ctx(&mut self, ctx: CfgContext)

Associates this value with a shared configuration context.
Source§

impl Debug for WebAppConfig

Source§

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

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

impl Default for WebAppConfig

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