Trait actix_web_location::providers::Provider
source · [−]pub trait Provider: Send + Sync {
fn name(&self) -> &str;
fn get_location<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 HttpRequest
) -> Pin<Box<dyn Future<Output = Result<Option<Location>, Error>> + 'async_trait>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn expect_country(&self) -> bool { ... }
fn expect_region(&self) -> bool { ... }
fn expect_city(&self) -> bool { ... }
}
Expand description
An object that can be queried to convert HttpRequest
into locations.
Use async_trait
when implementing.
Required Methods
fn get_location<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 HttpRequest
) -> Pin<Box<dyn Future<Output = Result<Option<Location>, Error>> + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_location<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 HttpRequest
) -> Pin<Box<dyn Future<Output = Result<Option<Location>, Error>> + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Derive a location from a request’s metadata.
Provided Methods
fn expect_country(&self) -> bool
fn expect_country(&self) -> bool
Can this provider produce locations with country information?
fn expect_region(&self) -> bool
fn expect_region(&self) -> bool
Can this provider produce locations with region information?
fn expect_city(&self) -> bool
fn expect_city(&self) -> bool
Can this provider produce locations with city information?