pub struct VersionExtractor { /* private fields */ }Expand description
Version extractor that can extract versions from request data
Implementations§
Source§impl VersionExtractor
impl VersionExtractor
Sourcepub fn with_strategy(strategy: VersionStrategy) -> Self
pub fn with_strategy(strategy: VersionStrategy) -> Self
Create an extractor with a single strategy
Sourcepub fn with_strategies(strategies: Vec<VersionStrategy>) -> Self
pub fn with_strategies(strategies: Vec<VersionStrategy>) -> Self
Create an extractor with multiple strategies (tried in order)
Sourcepub fn default_version(self, version: ApiVersion) -> Self
pub fn default_version(self, version: ApiVersion) -> Self
Set the default version
Sourcepub fn add_strategy(self, strategy: VersionStrategy) -> Self
pub fn add_strategy(self, strategy: VersionStrategy) -> Self
Add a strategy to try
Sourcepub fn extract_from_path(&self, path: &str) -> Option<ApiVersion>
pub fn extract_from_path(&self, path: &str) -> Option<ApiVersion>
Extract version from path
Sourcepub fn extract_from_headers(
&self,
headers: &HashMap<String, String>,
) -> Option<ApiVersion>
pub fn extract_from_headers( &self, headers: &HashMap<String, String>, ) -> Option<ApiVersion>
Extract version from headers
Sourcepub fn extract_from_query(&self, query: &str) -> Option<ApiVersion>
pub fn extract_from_query(&self, query: &str) -> Option<ApiVersion>
Extract version from query string
Sourcepub fn get_default(&self) -> ApiVersion
pub fn get_default(&self) -> ApiVersion
Get the default version
Sourcepub fn strip_version_from_path(&self, path: &str) -> String
pub fn strip_version_from_path(&self, path: &str) -> String
Remove version from path, returning the path without version prefix/suffix
Trait Implementations§
Source§impl Clone for VersionExtractor
impl Clone for VersionExtractor
Source§fn clone(&self) -> VersionExtractor
fn clone(&self) -> VersionExtractor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VersionExtractor
impl Debug for VersionExtractor
Auto Trait Implementations§
impl Freeze for VersionExtractor
impl RefUnwindSafe for VersionExtractor
impl Send for VersionExtractor
impl Sync for VersionExtractor
impl Unpin for VersionExtractor
impl UnwindSafe for VersionExtractor
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