pub struct EventId {
pub scheme: EventIdScheme,
pub value: String,
}Expand description
External identifier for an event, scoped by its issuing scheme.
Two EventId values are equal iff both their EventIdScheme and
their value are equal. Equality is structural — no per-scheme
canonicalisation is performed.
§Example
use event_matcher::{EventId, EventIdScheme};
let a = EventId::new(EventIdScheme::Eventbrite, "123456789").unwrap();
let b = EventId::new(EventIdScheme::Eventbrite, " 123456789 ").unwrap();
assert_eq!(a, b, "values are trimmed at construction");
assert!(EventId::new(EventIdScheme::Eventbrite, "").is_none());Fields§
§scheme: EventIdSchemeThe issuing scheme.
value: StringThe identifier value, trimmed of surrounding whitespace.
Implementations§
Source§impl EventId
impl EventId
Sourcepub fn new(scheme: EventIdScheme, value: impl Into<String>) -> Option<Self>
pub fn new(scheme: EventIdScheme, value: impl Into<String>) -> Option<Self>
Construct an EventId, trimming the value of surrounding
whitespace. Returns None if the trimmed value is empty.
No further normalisation is applied — different schemes have different rules and the crate makes no assumptions.
§Example
use event_matcher::{EventId, EventIdScheme};
let id = EventId::new(EventIdScheme::Wikidata, " Q15290 ").unwrap();
assert_eq!(id.value, "Q15290");
assert!(EventId::new(EventIdScheme::Wikidata, " ").is_none());Trait Implementations§
Source§impl<'de> Deserialize<'de> for EventId
impl<'de> Deserialize<'de> for EventId
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>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for EventId
impl StructuralPartialEq for EventId
Auto Trait Implementations§
impl Freeze for EventId
impl RefUnwindSafe for EventId
impl Send for EventId
impl Sync for EventId
impl Unpin for EventId
impl UnsafeUnpin for EventId
impl UnwindSafe for EventId
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
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>
Converts
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>
Converts
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