Struct actix_web_location::Location
source · [−]pub struct Location {
pub country: Option<String>,
pub region: Option<String>,
pub city: Option<String>,
pub dma: Option<u16>,
pub provider: String,
}
Expand description
The location information that providers must produce.
Fields
country: Option<String>
Country in ISO 3166-1 alpha-2 format, such as “MX” for Mexico or “IT” for Italy.
region: Option<String>
Region/region (e.g. a US state) in ISO 3166-2 format, such as “QC” for Quebec (with country = “CA”) or “TX” for Texas (with country = “US”).
city: Option<String>
City, listed by name such as “Portland” or “Berlin”.
dma: Option<u16>
The Designated Market Area code, as defined by Nielsen. Only defined in the US.
provider: String
The name of the provider that produced this recommendation.
Implementations
sourceimpl Location
impl Location
sourcepub fn build() -> LocationBuilder
pub fn build() -> LocationBuilder
Create a builder for a Location
that can be assembled incrementally.
sourcepub fn country(&self) -> String
pub fn country(&self) -> String
Get an owned copy of the country, or the default if the field is None
sourcepub fn region(&self) -> String
pub fn region(&self) -> String
Get an owned copy of the region, or the default if the field is None
Trait Implementations
sourceimpl FromRequest for Location
impl FromRequest for Location
type Future = Pin<Box<dyn Future<Output = Result<Location, <Location as FromRequest>::Error>> + 'static, Global>>
type Future = Pin<Box<dyn Future<Output = Result<Location, <Location as FromRequest>::Error>> + 'static, Global>>
Future that resolves to a Self.
sourcefn from_request(req: &HttpRequest, _payload: &mut Payload) -> Self::Future
fn from_request(req: &HttpRequest, _payload: &mut Payload) -> Self::Future
Create a Self from request parts asynchronously.
sourcefn extract(req: &HttpRequest) -> Self::Future
fn extract(req: &HttpRequest) -> Self::Future
Create a Self from request head asynchronously. Read more
impl Eq for Location
impl StructuralEq for Location
impl StructuralPartialEq for Location
Auto Trait Implementations
impl RefUnwindSafe for Location
impl Send for Location
impl Sync for Location
impl Unpin for Location
impl UnwindSafe for Location
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more