pub struct TickScheduler { /* private fields */ }Expand description
Manages the fixed-timestep execution of the game loop.
Implementations§
Source§impl TickScheduler
impl TickScheduler
Sourcepub fn new(tick_rate: u64, auth_service: AuthServiceImpl) -> Self
pub fn new(tick_rate: u64, auth_service: AuthServiceImpl) -> Self
Creates a new scheduler with the specified tick rate.
Sourcepub async fn run(
&mut self,
transport: Box<dyn GameTransport>,
world: Box<dyn WorldState>,
encoder: Box<dyn Encoder>,
shutdown: Receiver<()>,
)
pub async fn run( &mut self, transport: Box<dyn GameTransport>, world: Box<dyn WorldState>, encoder: Box<dyn Encoder>, shutdown: Receiver<()>, )
Runs the infinite game loop until the shutdown token is cancelled.
Sourcepub async fn tick_step(
transport: &mut dyn GameTransport,
world: &mut dyn WorldState,
encoder: &dyn Encoder,
auth_service: &AuthServiceImpl,
authenticated_clients: &mut HashMap<ClientId, (String, NetworkId)>,
reassembler: &mut Reassembler,
next_message_id: &mut u32,
encode_buffer: &mut [u8],
tick: u64,
)
pub async fn tick_step( transport: &mut dyn GameTransport, world: &mut dyn WorldState, encoder: &dyn Encoder, auth_service: &AuthServiceImpl, authenticated_clients: &mut HashMap<ClientId, (String, NetworkId)>, reassembler: &mut Reassembler, next_message_id: &mut u32, encode_buffer: &mut [u8], tick: u64, )
Executes a single 5-stage tick pipeline.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TickScheduler
impl !RefUnwindSafe for TickScheduler
impl Send for TickScheduler
impl Sync for TickScheduler
impl Unpin for TickScheduler
impl UnsafeUnpin for TickScheduler
impl !UnwindSafe for TickScheduler
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> 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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request