pub struct TravelAlert {
pub user_id: String,
pub severity: Severity,
pub from_location: GeoLocation,
pub from_time: u64,
pub to_location: GeoLocation,
pub to_time: u64,
pub distance_km: f64,
pub time_diff_hours: f64,
pub required_speed_kmh: f64,
pub confidence: f64,
}Expand description
Alert generated when impossible travel is detected.
Contains full context about the suspicious travel pattern including source/destination locations, timing, and confidence metrics.
Fields§
§user_id: StringUser ID that triggered the alert.
severity: SeveritySeverity based on how impossible the travel is.
from_location: GeoLocationLocation of the previous login.
from_time: u64Timestamp of the previous login (Unix ms).
to_location: GeoLocationLocation of the current login.
to_time: u64Timestamp of the current login (Unix ms).
distance_km: f64Great-circle distance between locations in kilometers.
time_diff_hours: f64Time difference in hours.
required_speed_kmh: f64Speed required to make the trip (km/h), -1.0 for instant.
confidence: f64Confidence score (0.0 to 1.0) based on accuracy and context.
Implementations§
Source§impl TravelAlert
impl TravelAlert
Sourcepub fn new(
user_id: impl Into<String>,
severity: Severity,
from_location: GeoLocation,
from_time: u64,
to_location: GeoLocation,
to_time: u64,
distance_km: f64,
time_diff_hours: f64,
required_speed_kmh: f64,
confidence: f64,
) -> Self
pub fn new( user_id: impl Into<String>, severity: Severity, from_location: GeoLocation, from_time: u64, to_location: GeoLocation, to_time: u64, distance_km: f64, time_diff_hours: f64, required_speed_kmh: f64, confidence: f64, ) -> Self
Create a new travel alert with all context.
Sourcepub fn is_high_severity(&self) -> bool
pub fn is_high_severity(&self) -> bool
Check if this is a high-severity alert (High or Critical).
Trait Implementations§
Source§impl Clone for TravelAlert
impl Clone for TravelAlert
Source§fn clone(&self) -> TravelAlert
fn clone(&self) -> TravelAlert
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TravelAlert
impl Debug for TravelAlert
Source§impl<'de> Deserialize<'de> for TravelAlert
impl<'de> Deserialize<'de> for TravelAlert
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
Auto Trait Implementations§
impl Freeze for TravelAlert
impl RefUnwindSafe for TravelAlert
impl Send for TravelAlert
impl Sync for TravelAlert
impl Unpin for TravelAlert
impl UnsafeUnpin for TravelAlert
impl UnwindSafe for TravelAlert
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,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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