Struct dropshot::ApiEndpoint
source · pub struct ApiEndpoint<Context: ServerContext> {Show 13 fields
pub operation_id: String,
pub handler: Arc<dyn RouteHandler<Context>>,
pub method: Method,
pub path: String,
pub parameters: Vec<ApiEndpointParameter>,
pub body_content_type: ApiEndpointBodyContentType,
pub response: ApiEndpointResponse,
pub summary: Option<String>,
pub description: Option<String>,
pub tags: Vec<String>,
pub extension_mode: ExtensionMode,
pub visible: bool,
pub deprecated: bool,
}
Expand description
ApiEndpoint represents a single API endpoint associated with an ApiDescription. It has a handler, HTTP method (e.g. GET, POST), and a path– provided explicitly–as well as parameters and a description which can be inferred from function parameter types and doc comments (respectively).
Fields§
§operation_id: String
§handler: Arc<dyn RouteHandler<Context>>
§method: Method
§path: String
§parameters: Vec<ApiEndpointParameter>
§body_content_type: ApiEndpointBodyContentType
§response: ApiEndpointResponse
§summary: Option<String>
§description: Option<String>
§extension_mode: ExtensionMode
§visible: bool
§deprecated: bool
Implementations§
source§impl<'a, Context: ServerContext> ApiEndpoint<Context>
impl<'a, Context: ServerContext> ApiEndpoint<Context>
pub fn new<HandlerType, FuncParams, ResponseType>(
operation_id: String,
handler: HandlerType,
method: Method,
content_type: &'a str,
path: &'a str
) -> Selfwhere
HandlerType: HttpHandlerFunc<Context, FuncParams, ResponseType>,
FuncParams: RequestExtractor + 'static,
ResponseType: HttpResponse + Send + Sync + 'static,
pub fn summary<T: ToString>(self, description: T) -> Self
pub fn description<T: ToString>(self, description: T) -> Self
pub fn tag<T: ToString>(self, tag: T) -> Self
pub fn visible(self, visible: bool) -> Self
pub fn deprecated(self, deprecated: bool) -> Self
Trait Implementations§
Auto Trait Implementations§
impl<Context> Freeze for ApiEndpoint<Context>
impl<Context> !RefUnwindSafe for ApiEndpoint<Context>
impl<Context> Send for ApiEndpoint<Context>
impl<Context> Sync for ApiEndpoint<Context>
impl<Context> Unpin for ApiEndpoint<Context>
impl<Context> !UnwindSafe for ApiEndpoint<Context>
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