Struct nimble_rust::pending_steps::PendingSteps
source · pub struct PendingSteps<T>where
T: Clone,{ /* private fields */ }
Expand description
Manages a sequence of pending steps that are queued to be executed at specific ticks in a game loop.
This struct contains a buffer (DiscoidBuffer
) of PendingStepInfo
elements, designed to handle
multiple steps that are pending execution across different ticks.
§Type Parameters
T
- Represents the type of steps stored within the buffer. As a generic parameter, it allows thePendingSteps
struct to be flexible and applicable to various types of games or simulations where different actions are defined as steps.
§Fields
-
steps
- A circular buffer (implemented viaDiscoidBuffer
) optimized for storing and retrieving pending steps efficiently. -
front_tick_id
- The tick ID of the first step in the buffer. -
capacity
- The maximum number of steps that can be stored in the buffer. This parameter helps control memory usage and maintain performance.
§Examples
use discoid::discoid::DiscoidBuffer;
use tick_id::TickId;
use nimble_steps::pending_steps::PendingSteps;
let pending_steps = PendingSteps::<i32>::new(10, TickId::new(1));
Implementations§
source§impl<T> PendingSteps<T>where
T: Clone,
impl<T> PendingSteps<T>where
T: Clone,
pub fn new(window_size: usize, tick_id: TickId) -> PendingSteps<T>
pub fn set(&mut self, tick_id: TickId, step: T) -> Result<(), String>
pub fn discard_up_to(&mut self, tick_id: TickId)
pub fn is_empty(&self) -> bool
pub fn pop(&mut self) -> PendingStepInfo<T>
pub fn front_tick_id(&self) -> Option<TickId>
Auto Trait Implementations§
impl<T> Freeze for PendingSteps<T>
impl<T> RefUnwindSafe for PendingSteps<T>where
T: RefUnwindSafe,
impl<T> Send for PendingSteps<T>where
T: Send,
impl<T> Sync for PendingSteps<T>where
T: Sync,
impl<T> Unpin for PendingSteps<T>where
T: Unpin,
impl<T> UnwindSafe for PendingSteps<T>where
T: 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