#[non_exhaustive]pub struct Location {
pub venue_name: Option<String>,
pub address: Option<Address>,
pub latitude: Option<f64>,
pub longitude: Option<f64>,
pub virtual_url: Option<String>,
}Expand description
Where an event takes place — corresponds to schema.org Event.location.
Schema.org accepts Place, PostalAddress, Text, or VirtualLocation
as a value for Event.location. This crate models all four flavours
inside one struct so a single Location can describe a purely
physical venue, a purely virtual one, or a hybrid:
venue_namecarries the textual name of the venue (Place.name), e.g."Worthy Farm"or"Madison Square Garden".addresscarries the postal address (PostalAddress).latitude/longitudecarry geographic coordinates (Place.geo).virtual_urlcarries the join URL forVirtualLocation.
Every field is optional. A Location with all fields None is
equivalent to no location at all and is skipped by the matcher.
§Example
use event_matcher::{Address, Location};
let l = Location::new()
.with_venue_name("Worthy Farm")
.with_address(Address::new().with_postcode("BA4 4BY"))
.with_latitude(51.150_3)
.with_longitude(-2.586_2);
assert_eq!(l.venue_name.as_deref(), Some("Worthy Farm"));
assert_eq!(l.latitude, Some(51.150_3));Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.venue_name: Option<String>Textual name of the venue, e.g. "Madison Square Garden".
address: Option<Address>Postal address of the physical venue.
latitude: Option<f64>Latitude in decimal degrees. Conventionally [-90.0, 90.0].
Values outside that range or non-finite values are stored as
supplied for round-trip honesty, but the coordinates scorer treats
them as missing.
longitude: Option<f64>Longitude in decimal degrees. Conventionally [-180.0, 180.0].
virtual_url: Option<String>Join URL for a virtual event (schema.org VirtualLocation.url),
e.g. "https://zoom.us/j/123456". Compared by exact equality
after trimming whitespace.
Implementations§
Source§impl Location
impl Location
Sourcepub fn with_venue_name(self, value: impl Into<String>) -> Self
pub fn with_venue_name(self, value: impl Into<String>) -> Self
Fluent setter for venue_name.
Sourcepub fn with_address(self, value: Address) -> Self
pub fn with_address(self, value: Address) -> Self
Fluent setter for address.
Sourcepub fn with_latitude(self, value: f64) -> Self
pub fn with_latitude(self, value: f64) -> Self
Fluent setter for latitude.
Sourcepub fn with_longitude(self, value: f64) -> Self
pub fn with_longitude(self, value: f64) -> Self
Fluent setter for longitude.
Sourcepub fn with_virtual_url(self, value: impl Into<String>) -> Self
pub fn with_virtual_url(self, value: impl Into<String>) -> Self
Fluent setter for virtual_url.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Location
impl<'de> Deserialize<'de> for Location
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Location
Auto Trait Implementations§
impl Freeze for Location
impl RefUnwindSafe for Location
impl Send for Location
impl Sync for Location
impl Unpin for Location
impl UnsafeUnpin for Location
impl UnwindSafe for Location
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
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>
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