Struct axum_server::Server[][src]

pub struct Server { /* fields omitted */ }
Expand description

Configurable HTTP server, supporting HTTP/1.1 and HTTP2.

Server can conveniently be turned into a TlsServer with related methods.

See main page for HTTP example. See axum_server::tls module for HTTPS example.

Implementations

Create a new Server.

Must bind to an address before calling serve.

Bind to a single address or multiple addresses.

This is supported on crate feature tls-rustls only.

Bind to a single address or multiple addresses. Using tls protocol on streams.

Certificate and private key must be set before or after calling this.

This is supported on crate feature tls-rustls only.

Provide a loaded TlsLoader.

This will overwrite any previously set private key and certificate(s) with its own ones.

This is supported on crate feature tls-rustls only.

Provide ServerConfig containing private key and certificate(s).

When this value is set, other tls configurations are ignored.

Successive calls will overwrite last value.

This is supported on crate feature tls-rustls only.

Set private key in PEM format.

Successive calls will overwrite last private key.

This is supported on crate feature tls-rustls only.

Set certificate(s) in PEM format.

Successive calls will overwrite last certificate.

This is supported on crate feature tls-rustls only.

Set private key from file in PEM format.

Successive calls will overwrite last private key.

This is supported on crate feature tls-rustls only.

Set certificate(s) from file in PEM format.

Successive calls will overwrite last certificate.

Provide a Handle.

Successive calls will overwrite last Handle.

Serve provided cloneable service on all binded addresses.

If accepting connection fails in any one of binded addresses, listening in all binded addresses will be stopped and then an error will be returned.

This is supported on crate feature record only.

Serve provided cloneable service on all binded addresses.

Record sent and received bytes for each connection independently. Sent and received bytes through a connection can be accessed through Request extensions.

See axum_server::record module for examples.

If accepting connection fails in any one of binded addresses, listening in all binded addresses will be stopped and then an error will be returned.

Trait Implementations

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

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

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

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.