pub struct Cursor<G = Game> { /* private fields */ }Expand description
A movable position within a game tree.
Implementations§
Source§impl<G: BorrowMut<Game>> Cursor<G>
Access API.
impl<G: BorrowMut<Game>> Cursor<G>
Access API.
pub fn game_mut(&mut self) -> &mut Game
pub fn set_orientation(&mut self, orientation: Player)
pub fn set_outcome(&mut self, outcome: Outcome)
pub fn update_roster(&mut self, update: impl FnOnce(&mut Roster))
pub fn cursor_mut(&mut self) -> CursorMut<'_>
pub fn position_mut(&mut self) -> PositionMut<'_>
pub fn play_mut(&mut self) -> Result<MoveMut<'_>>
pub fn at_mut(&mut self, slot: PositionSlot) -> Result<CursorMut<'_>>
Source§impl<'g> Cursor<&'g Game>
Access API.
impl<'g> Cursor<&'g Game>
Access API.
pub fn into_game(self) -> &'g Game
pub fn into_position(self) -> PositionRef<'g>
pub fn into_play(self) -> Result<MoveRef<'g>>
Source§impl<'g> Cursor<&'g mut Game>
Access API.
impl<'g> Cursor<&'g mut Game>
Access API.
pub fn into_position_mut(self) -> PositionMut<'g>
pub fn into_play_mut(self) -> Result<MoveMut<'g>>
Source§impl<G: Borrow<Game>> Cursor<G>
Traversal API.
impl<G: Borrow<Game>> Cursor<G>
Traversal API.
pub fn set(&mut self, slot: PositionSlot) -> Result<bool>
pub fn prev(&mut self) -> Result<PositionSlot>
pub fn mainline_end(&mut self) -> PositionSlot
pub fn main(&mut self) -> Result<PositionSlot>
pub fn option(&mut self, option: impl Choose) -> Result<PositionSlot>
Source§impl<G: BorrowMut<Game>> Cursor<G>
Options Mutation API
impl<G: BorrowMut<Game>> Cursor<G>
Options Mutation API
pub fn option_mut_or_push(&mut self, play: Move) -> Result<PositionSlot>
pub fn option_mut_or_insert_before( &mut self, option: impl Choose, play: Move, ) -> Result<PositionSlot>
pub fn option_mut_or_insert_after( &mut self, option: impl Choose, play: Move, ) -> Result<PositionSlot>
Sourcepub fn remove_play(&mut self) -> Result<()>
pub fn remove_play(&mut self) -> Result<()>
Unlike self.position_mut().into_remove_play(), this first retreats the cursor so its
former position is no longer protected by the cursor itself.
Methods from Deref<Target = Game>§
pub fn play(&self, slot: MoveSlot) -> Result<MoveRef<'_>>
pub fn position(&self, slot: PositionSlot) -> Result<PositionRef<'_>>
pub fn start(&self) -> PositionRef<'_>
pub fn cursor(&self) -> CursorRef<'_>
pub fn order(&self, slot: PositionSlot) -> Order<'_>
pub fn mode(&self) -> Mode
pub fn tracks_changes(&self) -> bool
pub fn changes(&self) -> Option<&[Change]>
pub fn revisions(&self) -> Option<usize>
pub fn public(&self) -> &GamePublic
pub fn title(&self) -> Option<&Text>
pub fn orientation(&self) -> Player
pub fn outcome(&self) -> Outcome
pub fn roster(&self) -> &Roster
pub fn key(&self) -> Key
Trait Implementations§
impl<G: PartialEq> StructuralPartialEq for Cursor<G>
Auto Trait Implementations§
impl<G> Freeze for Cursor<G>where
G: Freeze,
impl<G> RefUnwindSafe for Cursor<G>where
G: RefUnwindSafe,
impl<G> Send for Cursor<G>where
G: Send,
impl<G> Sync for Cursor<G>where
G: Sync,
impl<G> Unpin for Cursor<G>where
G: Unpin,
impl<G> UnsafeUnpin for Cursor<G>where
G: UnsafeUnpin,
impl<G> UnwindSafe for Cursor<G>where
G: 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