pub trait SyncedTimeline: NetworkTimeline {
// Required methods
fn sync_objective<Remote: SyncTargetTimeline>(
&self,
other: &Remote,
config: &Self::Config,
ping_manager: &PingManager,
tick_duration: Duration,
) -> TickInstant;
fn resync(&mut self, sync_objective: TickInstant) -> i16;
fn sync<Remote: SyncTargetTimeline>(
&mut self,
main: &Remote,
config: &Self::Config,
ping_manager: &PingManager,
tick_duration: Duration,
) -> Option<i16>;
fn is_synced(&self) -> bool;
fn relative_speed(&self) -> f32;
fn set_relative_speed(&mut self, ratio: f32);
fn reset(&mut self);
}Expand description
Timeline that is synced to another timeline
Required Methods§
Sourcefn sync_objective<Remote: SyncTargetTimeline>(
&self,
other: &Remote,
config: &Self::Config,
ping_manager: &PingManager,
tick_duration: Duration,
) -> TickInstant
fn sync_objective<Remote: SyncTargetTimeline>( &self, other: &Remote, config: &Self::Config, ping_manager: &PingManager, tick_duration: Duration, ) -> TickInstant
Get the ideal TickInstant that this timeline should be at
Sourcefn resync(&mut self, sync_objective: TickInstant) -> i16
fn resync(&mut self, sync_objective: TickInstant) -> i16
Resync the timeline if they are too out of sync. Returns the number of tick deltas that should be applied
Sourcefn sync<Remote: SyncTargetTimeline>(
&mut self,
main: &Remote,
config: &Self::Config,
ping_manager: &PingManager,
tick_duration: Duration,
) -> Option<i16>
fn sync<Remote: SyncTargetTimeline>( &mut self, main: &Remote, config: &Self::Config, ping_manager: &PingManager, tick_duration: Duration, ) -> Option<i16>
Sync the current timeline to the other timeline T.
Usually this is achieved by slightly speeding up or slowing down the current timeline.
If there is a big discrepancy we can do a resync instead.
Returns the number of delta ticks that should be applied
fn is_synced(&self) -> bool
Sourcefn relative_speed(&self) -> f32
fn relative_speed(&self) -> f32
Returns the speed of your timeline relative to your system clock as an f32.
A value of 1.0 means the timeline is running at normal speed.
A value of 0.5 means the timeline is running at half speed,
fn set_relative_speed(&mut self, ratio: f32)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.