Trait catalyzer::internals::HandlerMetadata
pub trait HandlerMetadata {
const PATH: &'static str;
const METHOD: Method;
}
Expand description
A trait that represents a handler metadata.
They are used to store the metadata of a handler,
and are automatically implemented by the #[get]
, #[post]
, etc. macros.
This trait is used internally by Catalyzer, and should not be implemented manually.
With #[get]
:
#[get("/")]
fn index() {
"Hello, world!"
}
Manual implementation:
async fn index() -> impl ::catalyzer::res::IntoRawResponse {
"Hello, world!"
}
#[doc(hidden)]
#[repr(transparent)]
#[allow(non_camel_case_types)]
struct index_metadata;
impl ::catalyzer::internals::HandlerMetadata for index_metadata {
const PATH: &'static str = "/";
const METHOD: ::catalyzer::internals::Method = ::catalyzer::internals::Method::GET;
}
Required Associated Constants§
Object Safety§
This trait is not object safe.