Skip to main content

RouteDescription

Struct RouteDescription 

Source
pub struct RouteDescription {
Show 17 fields pub group: String, pub name: String, pub description: String, pub request_body: Option<DtoEntity>, pub response_examples: HashMap<u16, DtoEntity>, pub headers: HashMap<String, String>, pub path_parameters: HashMap<String, String>, pub path_parameter_defaults: HashMap<String, String>, pub query_parameters: HashMap<String, String>, pub query_parameter_defaults: HashMap<String, String>, pub file_parameters: HashMap<String, FileParameter>, pub rate_limit: Option<u32>, pub authentication_required: bool, pub authentication_comment: Option<String>, pub summary: String, pub tags: Vec<String>, pub is_deprecated: bool,
}
Expand description

Declarative metadata for one route: documentation, validation, and policy. A description is registered for docs generation, declares the expected request body (required when has_body is set on mount), response examples, params, file parts, rate limit, and auth notes. Build with the new constructor and the group / with_body / response / header / query_param builders.

Fields§

§group: String

Documentation group this route belongs to; also seeds the default tag.

§name: String

Route name; kept in sync with summary by RouteDescription::name.

§description: String

Long-form description shown in documentation.

§request_body: Option<DtoEntity>

Declared request-body DTO schema and example, if the route takes a body.

§response_examples: HashMap<u16, DtoEntity>

Response examples keyed by HTTP status code.

§headers: HashMap<String, String>

Documented request headers as name-to-description pairs.

§path_parameters: HashMap<String, String>

Documented path parameters as name-to-description pairs.

§path_parameter_defaults: HashMap<String, String>

Default values for documented path parameters.

§query_parameters: HashMap<String, String>

Documented query parameters as name-to-description pairs.

§query_parameter_defaults: HashMap<String, String>

Default values for documented query parameters.

§file_parameters: HashMap<String, FileParameter>

Declared multipart file parameters keyed by part name.

§rate_limit: Option<u32>

Per-route request cap; None means no route-level limit is installed.

§authentication_required: bool

Whether callers must authenticate; enforced by middleware, not by this struct.

§authentication_comment: Option<String>

Optional note explaining the authentication requirement.

§summary: String

Short summary shown in documentation; defaults to the name.

§tags: Vec<String>

Documentation tags used for grouping; defaults to the group name.

§is_deprecated: bool

Marks the route as deprecated in documentation.

Implementations§

Source§

impl RouteDescription

Source

pub fn new(summary: impl Into<String>) -> Self

Creates a description with the given summary; group and tags default to "Default".

Source

pub fn group(self, group: impl Into<String>) -> Self

Sets the documentation group and resets the tag list to that group.

Source

pub fn name(self, name: impl Into<String>) -> Self

Sets the route name and copies it into the summary.

Source

pub fn description(self, desc: impl Into<String>) -> Self

Sets the long-form description shown in documentation.

Source

pub fn with_rate_limit(self, limit: u32) -> Self

Sets the per-route request cap enforced by the router’s rate-limit middleware.

Source

pub fn rate_limit(self, limit: u32) -> Self

Sets the per-route request cap (alias for RouteDescription::with_rate_limit).

Source

pub fn with_body<T>(self) -> Self

Declares the request-body DTO type T: records its JSON Schema and example. Required when the route is mounted with has_body; T must also be validatable.

Source

pub fn authentication(self, required: bool) -> Self

Records whether callers must authenticate (informational; enforced by middleware).

Source

pub fn response<T>(self, code: u16) -> Self
where T: DocumentableDTO,

Records a response example for code using DTO type T’s schema and example.

Source

pub fn authentication_required(self, required: bool) -> Self

Records whether callers must authenticate (alias for RouteDescription::authentication).

Source

pub fn authentication_comment(self, comment: impl Into<String>) -> Self

Attaches an explanatory note about the authentication requirement.

Source

pub fn header(self, k: impl Into<String>, v: impl Into<String>) -> Self

Documents one expected request header as a name-to-description entry.

Source

pub fn path_param(self, k: impl Into<String>, v: impl Into<String>) -> Self

Documents one path parameter as a name-to-description entry.

Source

pub fn path_param_with_default( self, k: impl Into<String>, v: impl Into<String>, default: impl Into<String>, ) -> Self

Documents one path parameter together with its default value.

Source

pub fn query_param(self, k: impl Into<String>, v: impl Into<String>) -> Self

Documents one query parameter as a name-to-description entry.

Source

pub fn query_param_with_default( self, k: impl Into<String>, v: impl Into<String>, default: impl Into<String>, ) -> Self

Documents one query parameter together with its default value.

Source

pub fn file_param( self, name: impl Into<String>, description: impl Into<String>, file_type: FileParameterType, ) -> Self

Declares an accepted multipart file part without total send caps.

Source

pub fn file_param_with_limit( self, name: impl Into<String>, description: impl Into<String>, file_type: FileParameterType, limit: u32, count: u32, ) -> Self

Declares an accepted multipart file part with sending limits. Panics if limit or count is zero; a count overrun rejects the request with a 400.

Source

pub fn deprecated(self, deprecated: bool) -> Self

Marks the route as deprecated (true) or not (false) in documentation.

Source

pub fn tag(self, tag: impl Into<String>) -> Self

Adds a documentation tag unless it is already present.

Source

pub fn effective_rate_limit(&self, global: Option<u32>) -> Option<u32>

Returns the per-route limit when set, otherwise the given global limit.

Trait Implementations§

Source§

impl Clone for RouteDescription

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RouteDescription

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RouteDescription

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> CompatExt for T

Source§

fn compat(self) -> Compat<T>
where T: Sized,

Applies the Compat adapter by value. Read more
Source§

fn compat_ref(&self) -> Compat<&T>

Applies the Compat adapter by shared reference. Read more
Source§

fn compat_mut(&mut self) -> Compat<&mut T>

Applies the Compat adapter by mutable reference. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more