pub struct ActivityStore { /* private fields */ }Expand description
Storage for activity GPS data.
Provides efficient storage and retrieval of activity coordinates with support for bulk operations via flat buffers.
Implementations§
Source§impl ActivityStore
impl ActivityStore
Sourcepub fn add(
&mut self,
id: String,
coords: Vec<GpsPoint>,
sport_type: String,
) -> Option<Bounds>
pub fn add( &mut self, id: String, coords: Vec<GpsPoint>, sport_type: String, ) -> Option<Bounds>
Add an activity with its GPS coordinates.
Returns the computed bounds for the activity.
Sourcepub fn add_flat(
&mut self,
id: String,
flat_coords: &[f64],
sport_type: String,
) -> Option<Bounds>
pub fn add_flat( &mut self, id: String, flat_coords: &[f64], sport_type: String, ) -> Option<Bounds>
Add an activity from flat coordinate buffer.
Coordinates are [lat1, lng1, lat2, lng2, …].
Sourcepub fn add_many_flat(
&mut self,
activity_ids: &[String],
all_coords: &[f64],
offsets: &[u32],
sport_types: &[String],
) -> Vec<String>
pub fn add_many_flat( &mut self, activity_ids: &[String], all_coords: &[f64], offsets: &[u32], sport_types: &[String], ) -> Vec<String>
Add multiple activities from flat coordinate buffers.
This is the most efficient way to bulk-add activities from FFI.
Sourcepub fn remove(&mut self, id: &str) -> Option<ActivityData>
pub fn remove(&mut self, id: &str) -> Option<ActivityData>
Remove an activity by ID.
Returns the removed activity data if it existed.
Sourcepub fn remove_many(&mut self, ids: &[String]) -> Vec<String>
pub fn remove_many(&mut self, ids: &[String]) -> Vec<String>
Remove multiple activities.
Returns the IDs of activities that were actually removed.
Sourcepub fn get(&self, id: &str) -> Option<&ActivityData>
pub fn get(&self, id: &str) -> Option<&ActivityData>
Get an activity by ID.
Sourcepub fn get_coords(&self, id: &str) -> Option<&[GpsPoint]>
pub fn get_coords(&self, id: &str) -> Option<&[GpsPoint]>
Get the coordinates for an activity.
Sourcepub fn get_sport_type(&self, id: &str) -> Option<&str>
pub fn get_sport_type(&self, id: &str) -> Option<&str>
Get the sport type for an activity.
Sourcepub fn iter(&self) -> impl Iterator<Item = (&String, &ActivityData)>
pub fn iter(&self) -> impl Iterator<Item = (&String, &ActivityData)>
Get all activities.
Sourcepub fn values(&self) -> impl Iterator<Item = &ActivityData>
pub fn values(&self) -> impl Iterator<Item = &ActivityData>
Get all activities as values.
Sourcepub fn sport_type_map(&self) -> HashMap<String, String>
pub fn sport_type_map(&self) -> HashMap<String, String>
Build a map of activity ID to sport type.
Sourcepub fn as_tracks(&self) -> Vec<(String, Vec<GpsPoint>)>
pub fn as_tracks(&self) -> Vec<(String, Vec<GpsPoint>)>
Build a vector of (id, coords) pairs for all activities.
Sourcepub fn compute_track_distance(coords: &[GpsPoint]) -> f64
pub fn compute_track_distance(coords: &[GpsPoint]) -> f64
Compute the total distance of a GPS track in meters.
Trait Implementations§
Source§impl Debug for ActivityStore
impl Debug for ActivityStore
Source§impl Default for ActivityStore
impl Default for ActivityStore
Source§fn default() -> ActivityStore
fn default() -> ActivityStore
Auto Trait Implementations§
impl Freeze for ActivityStore
impl RefUnwindSafe for ActivityStore
impl Send for ActivityStore
impl Sync for ActivityStore
impl Unpin for ActivityStore
impl UnwindSafe for ActivityStore
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, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> 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>
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