pub struct Application { /* private fields */ }Implementations§
Source§impl Application
impl Application
pub fn new() -> Application
pub fn with_web(self, router: Router<AppState>) -> Application
pub fn with_api(self, router: Router<AppState>) -> Application
Sourcepub fn with_global_middleware<L>(self, layer: L) -> Applicationwhere
L: Layer<Route> + Clone + Send + Sync + 'static,
<L as Layer<Route>>::Service: Service<Request<Body>> + Clone + Send + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Response: IntoResponse + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Error: Into<!> + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Future: Send + 'static,
pub fn with_global_middleware<L>(self, layer: L) -> Applicationwhere
L: Layer<Route> + Clone + Send + Sync + 'static,
<L as Layer<Route>>::Service: Service<Request<Body>> + Clone + Send + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Response: IntoResponse + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Error: Into<!> + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Future: Send + 'static,
Tambahkan global middleware ke seluruh request aplikasi (web, api, sub-routes).
Sourcepub fn with_middleware<L>(self, layer: L) -> Applicationwhere
L: Layer<Route> + Clone + Send + Sync + 'static,
<L as Layer<Route>>::Service: Service<Request<Body>> + Clone + Send + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Response: IntoResponse + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Error: Into<!> + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Future: Send + 'static,
pub fn with_middleware<L>(self, layer: L) -> Applicationwhere
L: Layer<Route> + Clone + Send + Sync + 'static,
<L as Layer<Route>>::Service: Service<Request<Body>> + Clone + Send + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Response: IntoResponse + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Error: Into<!> + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Future: Send + 'static,
Alias untuk with_global_middleware agar praktis.
Sourcepub fn with_raw_router(self, router: Router<AppState>) -> Application
pub fn with_raw_router(self, router: Router<AppState>) -> Application
Pasang router Axum tambahan dari ekstensi modular (misal: pakem-live).
Sourcepub fn with_web_middleware<L>(self, layer: L) -> Applicationwhere
L: Layer<Route> + Clone + Send + Sync + 'static,
<L as Layer<Route>>::Service: Service<Request<Body>> + Clone + Send + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Response: IntoResponse + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Error: Into<!> + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Future: Send + 'static,
pub fn with_web_middleware<L>(self, layer: L) -> Applicationwhere
L: Layer<Route> + Clone + Send + Sync + 'static,
<L as Layer<Route>>::Service: Service<Request<Body>> + Clone + Send + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Response: IntoResponse + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Error: Into<!> + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Future: Send + 'static,
Tambahkan middleware khusus untuk pipeline Web (semua route di with_web).
Sourcepub fn with_api_middleware<L>(self, layer: L) -> Applicationwhere
L: Layer<Route> + Clone + Send + Sync + 'static,
<L as Layer<Route>>::Service: Service<Request<Body>> + Clone + Send + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Response: IntoResponse + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Error: Into<!> + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Future: Send + 'static,
pub fn with_api_middleware<L>(self, layer: L) -> Applicationwhere
L: Layer<Route> + Clone + Send + Sync + 'static,
<L as Layer<Route>>::Service: Service<Request<Body>> + Clone + Send + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Response: IntoResponse + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Error: Into<!> + 'static,
<<L as Layer<Route>>::Service as Service<Request<Body>>>::Future: Send + 'static,
Tambahkan middleware khusus untuk pipeline API (semua route di bawah /api).
pub fn build_router( &self, state: AppState, session_store: LuminaSessionStore, ) -> Router
pub async fn serve(self, addr: &str)
Auto Trait Implementations§
impl !RefUnwindSafe for Application
impl !Send for Application
impl !Sync for Application
impl !UnwindSafe for Application
impl Forget for Application
impl Freeze for Application
impl Move for Application
impl Unpin for Application
impl UnsafeUnpin for Application
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> 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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more