pub struct OpenApiRegistry { /* private fields */ }Expand description
OpenAPI runtime registry.
Implementations§
Source§impl OpenApiRegistry
impl OpenApiRegistry
Sourcepub fn new(config: OpenApiConfig) -> Self
pub fn new(config: OpenApiConfig) -> Self
Creates a new OpenApiRegistry
Sourcepub fn register_route(
&self,
method: &Method,
path: &str,
cfg: &OpenApiRouteConfig,
)
pub fn register_route( &self, method: &Method, path: &str, cfg: &OpenApiRouteConfig, )
Registers a route in the OpenAPI registry.
Sourcepub fn describe_route_in(
&self,
method: &Method,
path: &str,
cfg: &OpenApiRouteConfig,
docs: &[&str],
)
pub fn describe_route_in( &self, method: &Method, path: &str, cfg: &OpenApiRouteConfig, docs: &[&str], )
Registers a route in docs alone and applies its configuration there.
docs is meant to be some of the documents cfg names - see Self::docs_for - for a
route that has to be left out of the rest. A name no document carries is skipped.
Sourcepub fn docs_for<'a>(&'a self, cfg: &'a OpenApiRouteConfig) -> Vec<&'a str>
pub fn docs_for<'a>(&'a self, cfg: &'a OpenApiRouteConfig) -> Vec<&'a str>
Returns the names of the documents a route configured with cfg is described in: the
ones it is bound to, or the first spec when it is bound to none.
Sourcepub fn rebind_route(
&self,
method: &Method,
path: &str,
cfg: &OpenApiRouteConfig,
)
pub fn rebind_route( &self, method: &Method, path: &str, cfg: &OpenApiRouteConfig, )
Rebinds route to another spec.
Sourcepub fn remove_route(&self, method: &Method, path: &str)
pub fn remove_route(&self, method: &Method, path: &str)
Removes a route’s operation from every spec.
A route that is not in a spec is left out of it, so removing one that was never registered does nothing.
Sourcepub fn apply_route_config(
&self,
method: &Method,
path: &str,
cfg: &OpenApiRouteConfig,
)
pub fn apply_route_config( &self, method: &Method, path: &str, cfg: &OpenApiRouteConfig, )
Applies route configuration
Sourcepub fn document_by_name(&self, name: &str) -> Option<OpenApiDocument>
pub fn document_by_name(&self, name: &str) -> Option<OpenApiDocument>
Returns OpenAPI document by spec name.
Sourcepub fn specs(&self) -> &[OpenApiSpec]
pub fn specs(&self) -> &[OpenApiSpec]
Returns a list of defined specs
Trait Implementations§
Source§impl Clone for OpenApiRegistry
impl Clone for OpenApiRegistry
Source§fn clone(&self) -> OpenApiRegistry
fn clone(&self) -> OpenApiRegistry
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for OpenApiRegistry
impl RefUnwindSafe for OpenApiRegistry
impl Send for OpenApiRegistry
impl Sync for OpenApiRegistry
impl Unpin for OpenApiRegistry
impl UnsafeUnpin for OpenApiRegistry
impl UnwindSafe for OpenApiRegistry
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