pub struct MountableInterface { /* private fields */ }Expand description
A mountable web interface that can be integrated into any host application
This allows libraries to define their web routes and middleware without knowing what web framework the host application uses or where their routes will be mounted in the overall routing scheme.
Implementations§
Source§impl MountableInterface
impl MountableInterface
Sourcepub fn builder(name: impl Into<String>) -> InterfaceBuilder
pub fn builder(name: impl Into<String>) -> InterfaceBuilder
Create a new interface builder
Sourcepub fn description(&self) -> &str
pub fn description(&self) -> &str
Get the description of this interface
Sourcepub fn routes(&self) -> &[RouteDefinition]
pub fn routes(&self) -> &[RouteDefinition]
Get all routes in this interface
Sourcepub fn middleware(&self) -> &[String]
pub fn middleware(&self) -> &[String]
Get middleware for this interface
Sourcepub fn mount_options(&self) -> &MountOptions
pub fn mount_options(&self) -> &MountOptions
Get mount options
Sourcepub fn mount_at(&self, prefix: impl AsRef<str>) -> Result<Vec<Route>>
pub fn mount_at(&self, prefix: impl AsRef<str>) -> Result<Vec<Route>>
Mount this interface at the given prefix path Returns a list of routes with the prefix applied
Sourcepub fn mount_with_auth_at(
&self,
prefix: impl AsRef<str>,
auth_context: Arc<AuthContext>,
) -> Result<Vec<AuthenticatedRoute>>
pub fn mount_with_auth_at( &self, prefix: impl AsRef<str>, auth_context: Arc<AuthContext>, ) -> Result<Vec<AuthenticatedRoute>>
Mount this interface at the given prefix path with authentication support
Sourcepub fn openapi_spec(&self) -> OpenApiSpec
pub fn openapi_spec(&self) -> OpenApiSpec
Generate OpenAPI documentation for this interface
Auto Trait Implementations§
impl Freeze for MountableInterface
impl !RefUnwindSafe for MountableInterface
impl Send for MountableInterface
impl Sync for MountableInterface
impl Unpin for MountableInterface
impl !UnwindSafe for MountableInterface
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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