Skip to main content

DocumentationRegistrant

Struct DocumentationRegistrant 

Source
pub struct DocumentationRegistrant { /* private fields */ }
Expand description

Process-wide registry of routes and documentation settings.

Holds the base path, global rate limit, auth settings, group descriptions, registered routes, global headers, test HTTP clients, and the DocumentationMode. Starts with base path "/", no rate limit, Conventional mode, and the three built-in HTTP clients.

Access the shared instance via global, get_instance, or get_instance_mut.

Implementations§

Source§

impl DocumentationRegistrant

Source

pub fn global() -> &'static RwLock<Self>

Returns the shared registry, creating it on first use.

Source

pub fn get_instance() -> RwLockReadGuard<'static, Self>

Returns a read guard for the shared registry.

Panics if the lock is poisoned.

Source

pub fn get_instance_mut() -> RwLockWriteGuard<'static, Self>

Returns a write guard for the shared registry.

Panics if the lock is poisoned.

Source

pub fn bind_base(&mut self, base: impl Into<String>)

Sets the base path used for the generated servers entries.

An empty value resets the base path to "/".

Source

pub fn bind_base_list(&mut self, roots: &[String])

Sets the base path from a list of roots, using the first entry.

Falls back to "/" when the list is empty.

Source

pub fn base_path(&self) -> &str

Returns the currently configured base path.

Source

pub fn server_paths(&self) -> &[String]

Returns all configured mount/bind paths used as OpenAPI server paths.

Source

pub fn set_global_rate_limit(&mut self, limit: Option<u32>)

Sets the global rate limit in requests per minute (None means unlimited).

Source

pub fn get_global_rate_limit(&self) -> Option<u32>

Returns the global rate limit in requests per minute, if set.

Source

pub fn set_auth_settings(&mut self, m: HashMap<String, String>)

Replaces the authentication settings map used in the spec description and security schemes.

Source

pub fn get_auth_settings(&self) -> &HashMap<String, String>

Returns the authentication settings map.

Source

pub fn set_global_headers(&mut self, headers: HashMap<String, String>)

Sets the legacy shared global headers bucket.

Source

pub fn set_global_headers_scoped( &mut self, headers: HashMap<String, String>, authenticated_only: bool, )

Sets scoped global headers: the authenticated bucket when authenticated_only is true, otherwise the unauthenticated bucket.

Source

pub fn get_global_headers(&self) -> HashMap<String, String>

Returns legacy, unauthenticated, and authenticated headers merged together.

Later buckets overwrite earlier ones on key conflicts.

Source

pub fn get_authenticated_global_headers(&self) -> HashMap<String, String>

Returns legacy plus authenticated headers merged together.

Source

pub fn get_authenticated_only_headers(&self) -> &HashMap<String, String>

Returns only headers configured for authenticated requests.

Source

pub fn get_unauthenticated_global_headers(&self) -> HashMap<String, String>

Returns legacy plus unauthenticated headers merged together.

Source

pub fn set_documentation_mode(&mut self, mode: DocumentationMode)

Sets the DocumentationMode controlling docs visibility in production.

Source

pub fn get_documentation_mode(&self) -> DocumentationMode

Returns the current DocumentationMode.

Source

pub fn register_http_client(&mut self, client: Arc<dyn DocHttpClient>)

Adds an extra DocHttpClient to the test-execution client list.

Source

pub fn get_http_clients(&self) -> Vec<Arc<dyn DocHttpClient>>

Returns all registered test-execution HTTP clients.

Source

pub fn set_group_description( &mut self, group: impl Into<String>, desc: impl Into<String>, )

Sets the description for one documentation group (tag).

Source

pub fn set_group_descriptions(&mut self, descriptions: HashMap<String, String>)

Replaces all group descriptions, keeping only entries with a non-empty trimmed name and storing trimmed names and values.

Source

pub fn get_group_description(&self, group: &str) -> String

Returns the description for a group, or "N/A" when missing or blank.

Source

pub fn get_group_descriptions(&self) -> &HashMap<String, String>

Returns all group descriptions keyed by group name.

Source

pub fn register_route( &mut self, path: &str, method: &str, controller_class: &str, description: RouteDescription, )

Records one route with its path, method, controller name, and metadata.

Source

pub fn get_registered_routes(&self) -> &[RegisteredRoute]

Returns all registered routes in registration order.

Source

pub fn clear(&mut self)

Removes all registered routes; other settings are left unchanged.

Trait Implementations§

Source§

impl Default for DocumentationRegistrant

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> 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> 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, 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