pub struct Route;Expand description
Static entry points matching Laravel’s Route::get(...) call sites.
Each returns a Router so further routes/names can be chained the
same way Laravel chains ->name(...) off a single registration.
Implementations§
Source§impl Route
impl Route
pub fn get<H, T>(path: &str, handler: H) -> Router
pub fn post<H, T>(path: &str, handler: H) -> Router
pub fn put<H, T>(path: &str, handler: H) -> Router
pub fn patch<H, T>(path: &str, handler: H) -> Router
pub fn delete<H, T>(path: &str, handler: H) -> Router
Sourcepub fn group<F>(prefix: &str, build: F) -> Router
pub fn group<F>(prefix: &str, build: F) -> Router
Registers a group of routes under a shared path prefix.
Sourcepub fn resource<HIndex, TIndex, HCreate, TCreate, HStore, TStore, HShow, TShow, HEdit, TEdit, HUpdate, TUpdate, HDestroy, TDestroy>(
prefix: &str,
param: &str,
index: HIndex,
create: HCreate,
store: HStore,
show: HShow,
edit: HEdit,
update: HUpdate,
destroy: HDestroy,
) -> Routerwhere
HIndex: Handler<TIndex, ()>,
TIndex: 'static,
HCreate: Handler<TCreate, ()>,
TCreate: 'static,
HStore: Handler<TStore, ()>,
TStore: 'static,
HShow: Handler<TShow, ()>,
TShow: 'static,
HEdit: Handler<TEdit, ()>,
TEdit: 'static,
HUpdate: Handler<TUpdate, ()>,
TUpdate: 'static,
HDestroy: Handler<TDestroy, ()>,
TDestroy: 'static,
pub fn resource<HIndex, TIndex, HCreate, TCreate, HStore, TStore, HShow, TShow, HEdit, TEdit, HUpdate, TUpdate, HDestroy, TDestroy>(
prefix: &str,
param: &str,
index: HIndex,
create: HCreate,
store: HStore,
show: HShow,
edit: HEdit,
update: HUpdate,
destroy: HDestroy,
) -> Routerwhere
HIndex: Handler<TIndex, ()>,
TIndex: 'static,
HCreate: Handler<TCreate, ()>,
TCreate: 'static,
HStore: Handler<TStore, ()>,
TStore: 'static,
HShow: Handler<TShow, ()>,
TShow: 'static,
HEdit: Handler<TEdit, ()>,
TEdit: 'static,
HUpdate: Handler<TUpdate, ()>,
TUpdate: 'static,
HDestroy: Handler<TDestroy, ()>,
TDestroy: 'static,
Registers all 7 RESTful routes for a resource in one call - Laravel’s
Route::resource('posts', PostController::class). See
Router::resource for the full argument/naming breakdown.
Auto Trait Implementations§
impl Freeze for Route
impl RefUnwindSafe for Route
impl Send for Route
impl Sync for Route
impl Unpin for Route
impl UnsafeUnpin for Route
impl UnwindSafe for Route
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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