pub struct ClientSpecifiesVersionInHeader { /* private fields */ }
Expand description
Implementation of DynamicVersionPolicy
where the client must specify a
specific semver in a specific header and we always use whatever they
requested
An incoming request will be rejected with a 400-level error if:
- the header value cannot be parsed as a semver, or
- the requested version is newer than
max_version
(seeClientSpecifiesVersionInHeader::new()
, which implies that the client is trying to use a newer version of the API than this server supports.
If you need anything more flexible (e.g., validating the provided version
against a fixed set of supported versions), you’ll want to impl
DynamicVersionPolicy
yourself.
Implementations§
Source§impl ClientSpecifiesVersionInHeader
impl ClientSpecifiesVersionInHeader
Sourcepub fn new(
name: HeaderName,
max_version: Version,
) -> ClientSpecifiesVersionInHeader
pub fn new( name: HeaderName, max_version: Version, ) -> ClientSpecifiesVersionInHeader
Make a new ClientSpecifiesVersionInHeader
policy
Arguments:
name
: name of the header that the client will use to specify the versionmax_version
: the maximum version of the API that this server supports. Requests for a version newer than this will be rejected with a 400-level error.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ClientSpecifiesVersionInHeader
impl RefUnwindSafe for ClientSpecifiesVersionInHeader
impl Send for ClientSpecifiesVersionInHeader
impl Sync for ClientSpecifiesVersionInHeader
impl Unpin for ClientSpecifiesVersionInHeader
impl UnwindSafe for ClientSpecifiesVersionInHeader
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