pub struct Application<H = AlwaysReadyAndAlive, T = Empty, V = DefaultVersion> { /* private fields */ }Expand description
Application to set up HTTP server with given config AppConfig
Implementations§
Source§impl<T> Application<T>
impl<T> Application<T>
Sourcepub fn new(
config: AppConfig<T>,
) -> Application<AlwaysReadyAndAlive, T, DefaultVersion>
pub fn new( config: AppConfig<T>, ) -> Application<AlwaysReadyAndAlive, T, DefaultVersion>
Creates new Application with health checks always returning [200 OK]
Sourcepub fn new_from_arced(
config: Arc<AppConfig<T>>,
) -> Application<AlwaysReadyAndAlive, T, DefaultVersion>
pub fn new_from_arced( config: Arc<AppConfig<T>>, ) -> Application<AlwaysReadyAndAlive, T, DefaultVersion>
Creates new Application with health checks always returning [200 OK]
Source§impl<H, T, V> Application<H, T, V>
impl<H, T, V> Application<H, T, V>
Sourcepub fn health_indicator<Hh: HealthExt>(
self,
health: Hh,
) -> Application<Hh, T, V>
pub fn health_indicator<Hh: HealthExt>( self, health: Hh, ) -> Application<Hh, T, V>
Set up new health indicator
Sourcepub fn version<Vv: VersionExt<T>>(self, version: Vv) -> Application<H, T, Vv>
pub fn version<Vv: VersionExt<T>>(self, version: Vv) -> Application<H, T, Vv>
Set up new version struct
Sourcepub fn metrics_callback(
self,
metrics_callback: impl Fn() + Send + Sync + 'static,
) -> Self
pub fn metrics_callback( self, metrics_callback: impl Fn() + Send + Sync + 'static, ) -> Self
Set up callback which will be called before metrics will render.
Sourcepub fn use_default_tracing_layer(self, use_default: bool) -> Self
pub fn use_default_tracing_layer(self, use_default: bool) -> Self
Example:
In this case trace_request is not attached to Application so no default tracing/metrics/logging for incoming requests
use fregate::{AppConfig, Application};
#[tokio::main]
async fn main() {
Application::new(AppConfig::default())
.use_default_tracing_layer(false)
.serve()
.await
.unwrap();
}Trait Implementations§
Auto Trait Implementations§
impl<H, T, V> Freeze for Application<H, T, V>
impl<H = AlwaysReadyAndAlive, T = Empty, V = DefaultVersion> !RefUnwindSafe for Application<H, T, V>
impl<H, T, V> Send for Application<H, T, V>
impl<H = AlwaysReadyAndAlive, T = Empty, V = DefaultVersion> !Sync for Application<H, T, V>
impl<H, T, V> Unpin for Application<H, T, V>
impl<H = AlwaysReadyAndAlive, T = Empty, V = DefaultVersion> !UnwindSafe for Application<H, T, V>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::RequestSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request