#[non_exhaustive]pub struct Event {Show 25 fields
pub name: Option<String>,
pub alternate_names: Vec<String>,
pub description: Option<String>,
pub url: Option<String>,
pub event_ids: Vec<EventId>,
pub local_id: Option<String>,
pub category: Option<EventCategory>,
pub keywords: Vec<String>,
pub in_language: Option<String>,
pub typical_age_range: Option<String>,
pub start_date: Option<String>,
pub end_date: Option<String>,
pub door_time: Option<String>,
pub previous_start_date: Option<String>,
pub event_status: Option<EventStatus>,
pub event_attendance_mode: Option<EventAttendanceMode>,
pub location: Option<Location>,
pub country_code_as_iso_3166_1_alpha_2: Option<String>,
pub organizer: Option<String>,
pub performers: Vec<String>,
pub maximum_attendee_capacity: Option<u32>,
pub maximum_physical_attendee_capacity: Option<u32>,
pub maximum_virtual_attendee_capacity: Option<u32>,
pub is_accessible_for_free: Option<bool>,
pub super_event_id: Option<String>,
}Expand description
Core event data structure — corresponds to schema.org Event.
Every field is optional (or defaults to empty). The matcher tolerates
missing data field-by-field — a None value never penalises an event.
See crate::matcher::MatchingEngine::match_events for how missing
fields affect the weighted score.
Construct via Event::builder rather than struct literal syntax so
the call-site stays compact and forward-compatible if fields are added.
§Field mapping to schema.org
| Field | Schema.org property |
|---|---|
name | schema:name |
alternate_names | schema:alternateName |
description | schema:description |
url | schema:url |
event_ids | schema:identifier |
category | (closest match to the subtype of schema:Event) |
keywords | schema:keywords |
in_language | schema:inLanguage |
start_date | schema:startDate |
end_date | schema:endDate |
door_time | schema:doorTime |
previous_start_date | schema:previousStartDate |
event_status | schema:eventStatus |
event_attendance_mode | schema:eventAttendanceMode |
location | schema:location |
organizer | schema:organizer |
performers | schema:performer |
maximum_attendee_capacity | schema:maximumAttendeeCapacity |
maximum_physical_attendee_capacity | schema:maximumPhysicalAttendeeCapacity |
maximum_virtual_attendee_capacity | schema:maximumVirtualAttendeeCapacity |
is_accessible_for_free | schema:isAccessibleForFree |
typical_age_range | schema:typicalAgeRange |
super_event_id | schema:superEvent (id only) |
§Example
use event_matcher::Event;
let e = Event::builder()
.name("RustConf 2024")
.add_alternate_name("RustConf '24")
.start_date("2024-09-10T09:00:00Z")
.end_date("2024-09-13T17:00:00Z")
.organizer("Rust Foundation")
.build();
assert_eq!(e.name.as_deref(), Some("RustConf 2024"));
assert_eq!(e.alternate_names, vec!["RustConf '24".to_string()]);Event round-trips through serde.
let e = Event::builder().name("RustConf").build();
let json = serde_json::to_string(&e).unwrap();
let back: Event = serde_json::from_str(&json).unwrap();
assert_eq!(e, back);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.name: Option<String>Primary canonical name of the event, e.g. "Glastonbury Festival 2024".
alternate_names: Vec<String>Aliases, translations, or alternative titles of the event, e.g.
vec!["Glasto 2024".into()]. Default empty.
description: Option<String>Free-text description of the event (schema:description).
url: Option<String>Canonical URL for the event (schema:url).
event_ids: Vec<EventId>External scheme-scoped identifiers for the event. Sharing any one
(scheme, value) pair across two events is a deterministic match.
local_id: Option<String>Local identifier issued by the originating system. Not normalised — different organisations may issue colliding values.
category: Option<EventCategory>Coarse-grained category of the event (see EventCategory).
keywords: Vec<String>Free-form descriptive tags (schema:keywords).
in_language: Option<String>Content language as an IETF BCP-47 tag, e.g. "en-GB", "fr".
Stored as supplied; compared case-insensitively after trim.
typical_age_range: Option<String>Expected demographic age range, e.g. "7-9" (schema:typicalAgeRange).
start_date: Option<String>Start date or date-time in ISO 8601 form. Examples:
"2024-06-26", "2024-06-26T09:00:00Z", "2024-06-26T09:00:00+01:00".
end_date: Option<String>End date or date-time in ISO 8601 form.
door_time: Option<String>Door-opening time (schema:doorTime) in ISO 8601 form.
previous_start_date: Option<String>Original start date prior to rescheduling (schema:previousStartDate).
event_status: Option<EventStatus>Current status — scheduled, cancelled, postponed, rescheduled, or
moved online (see EventStatus).
event_attendance_mode: Option<EventAttendanceMode>Physical, virtual, or mixed (see EventAttendanceMode).
location: Option<Location>Where the event takes place — venue, address, coordinates, and/or
virtual URL (see Location).
country_code_as_iso_3166_1_alpha_2: Option<String>Country code in ISO 3166-1 alpha-2 form, e.g. "GB", "US",
"FR". Convenient quick lookup when Location::address is
absent. Stored as supplied — no canonicalisation is performed at
construction time. The matcher compares case-insensitively after
trimming whitespace.
organizer: Option<String>Name of the organiser (person or organisation). Single string for
simplicity; callers needing multiple organisers should join them
with ", " or pre-pick a canonical organiser.
performers: Vec<String>Performer names — actors, bands, speakers, athletes
(schema:performer). Compared as a best-of cartesian product.
maximum_attendee_capacity: Option<u32>Total expected capacity (schema:maximumAttendeeCapacity).
maximum_physical_attendee_capacity: Option<u32>Offline-attendance capacity (schema:maximumPhysicalAttendeeCapacity).
maximum_virtual_attendee_capacity: Option<u32>Online-attendance capacity (schema:maximumVirtualAttendeeCapacity).
is_accessible_for_free: Option<bool>True if the event is free to attend (schema:isAccessibleForFree).
super_event_id: Option<String>Identifier of the parent event (schema:superEvent). Stored as a
free-form string so callers can carry whichever scheme they need.
Implementations§
Source§impl Event
impl Event
Sourcepub fn builder() -> EventBuilder
pub fn builder() -> EventBuilder
Begin constructing an Event with the EventBuilder.
All fields default to None / empty until a setter is called.
§Example
use event_matcher::Event;
let e = Event::builder()
.name("RustConf 2024")
.build();
assert_eq!(e.name.as_deref(), Some("RustConf 2024"));Sourcepub fn validate(&self) -> Result<()>
pub fn validate(&self) -> Result<()>
Validate that the event carries a primary name.
Returns Ok(()) if name is set.
This is not invoked automatically by the matcher — call it at the system boundary when you ingest data, not on every comparison.
§Errors
Returns crate::MatchingError::MissingField if name is None.
§Example
use event_matcher::Event;
assert!(Event::builder().name("RustConf").build().validate().is_ok());
assert!(Event::builder().build().validate().is_err());Trait Implementations§
Source§impl<'de> Deserialize<'de> for Event
impl<'de> Deserialize<'de> for Event
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 Event
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl UnwindSafe for Event
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