pub struct PlayerSpanTracker<S> { /* private fields */ }Expand description
Builds coalesced PlayerStateSpan streams for one facet: consecutive
same-state contributions per player extend the open span, a state change
closes it, and an explicit close (the facet stopped applying to the
player) ends the span so a later resumption starts fresh.
Implementations§
Source§impl<S: Clone + PartialEq> PlayerSpanTracker<S>
impl<S: Clone + PartialEq> PlayerSpanTracker<S>
pub fn begin_update(&mut self)
Sourcepub fn record(
&mut self,
frame_number: usize,
start_time: f32,
end_time: f32,
duration: f32,
player: &PlayerId,
player_position: Option<[f32; 3]>,
is_team_0: bool,
state: S,
)
pub fn record( &mut self, frame_number: usize, start_time: f32, end_time: f32, duration: f32, player: &PlayerId, player_position: Option<[f32; 3]>, is_team_0: bool, state: S, )
Record that player held state over (start_time, end_time] within
frame_number, contributing duration seconds.
pub fn close(&mut self, player: &PlayerId)
pub fn close_all(&mut self)
Sourcepub fn events(&self) -> &[PlayerStateSpan<S>]
pub fn events(&self) -> &[PlayerStateSpan<S>]
Spans already closed by a state change or facet gap.
Sourcepub fn new_events(&self) -> &[PlayerStateSpan<S>]
pub fn new_events(&self) -> &[PlayerStateSpan<S>]
Spans closed during the current update (since the last begin_update).
Sourcepub fn projected_events(&self) -> Vec<PlayerStateSpan<S>>
pub fn projected_events(&self) -> Vec<PlayerStateSpan<S>>
All spans including still-open ones with their duration so far.
Trait Implementations§
Source§impl<S: Clone> Clone for PlayerSpanTracker<S>
impl<S: Clone> Clone for PlayerSpanTracker<S>
Source§impl<S: Debug> Debug for PlayerSpanTracker<S>
impl<S: Debug> Debug for PlayerSpanTracker<S>
Auto Trait Implementations§
impl<S> Freeze for PlayerSpanTracker<S>
impl<S> RefUnwindSafe for PlayerSpanTracker<S>where
HashMap<RemoteId, PlayerStateSpan<S>>: RefUnwindSafe,
EventStream<PlayerStateSpan<S>>: RefUnwindSafe,
impl<S> Send for PlayerSpanTracker<S>
impl<S> Sync for PlayerSpanTracker<S>
impl<S> Unpin for PlayerSpanTracker<S>
impl<S> UnsafeUnpin for PlayerSpanTracker<S>where
HashMap<RemoteId, PlayerStateSpan<S>>: UnsafeUnpin,
EventStream<PlayerStateSpan<S>>: UnsafeUnpin,
impl<S> UnwindSafe for PlayerSpanTracker<S>where
HashMap<RemoteId, PlayerStateSpan<S>>: UnwindSafe,
EventStream<PlayerStateSpan<S>>: UnwindSafe,
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