pub struct ActionHistory { /* private fields */ }Expand description
行動履歴
VecDeque を使用したリングバッファ実装。 push() が O(1) で効率的に動作する。
Implementations§
Source§impl ActionHistory
impl ActionHistory
pub fn new(max_entries: usize) -> Self
Sourcepub fn push(&mut self, entry: HistoryEntry)
pub fn push(&mut self, entry: HistoryEntry)
エントリを追加(O(1))
Sourcepub fn latest(&self) -> Option<&HistoryEntry>
pub fn latest(&self) -> Option<&HistoryEntry>
最新のエントリを取得
Sourcepub fn iter(&self) -> impl Iterator<Item = &HistoryEntry>
pub fn iter(&self) -> impl Iterator<Item = &HistoryEntry>
イテレータを取得
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ActionHistory
impl RefUnwindSafe for ActionHistory
impl Send for ActionHistory
impl Sync for ActionHistory
impl Unpin for ActionHistory
impl UnwindSafe for ActionHistory
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 more