Struct pgn4::PGN4 [−][src]
Expand description
Representation of pgn4 file
TODO: general description
Notably, Chess.com does not support variations within variations whereas this tool does. If you try to import a pgn4 with recursive variations into Chess.com, you will get errors.
Fields
bracketed: Vec<(String, String)>
Expand description
PGN4 files have a list of key value pairs in the beginning that specify variants, time control, and other metadata
turns: Vec<Turn>
Expand description
The game is stored as a list of Turns which hold up to 4 QuarterTurns each. Unfortunately, this cannot be simplified to a single list without compromising round-trip serilization or including enough logic to deduce which player’s turn it is.
If you need to follow sub-variations, please use a Visitor
Implementations
impl PGN4
[src]
impl PGN4
[src]pub fn tag<'a>(&'a self, tag_name: &str) -> Option<&'a str>
[src]
pub fn tag<'a>(&'a self, tag_name: &str) -> Option<&'a str>
[src]Searches for a tag and optionally returns a reference to it if found
pub fn ratings(&self) -> Option<[u16; 4]>
[src]
pub fn ratings(&self) -> Option<[u16; 4]>
[src]If all four players are rated, parse all of the ratings.
pub fn players(&self) -> Option<[&str; 4]>
[src]
pub fn players(&self) -> Option<[&str; 4]>
[src]If all players have names, return a reference to them
pub fn result(&self) -> GameResult
[src]
pub fn result(&self) -> GameResult
[src]If tag “Result” is present, parse it.
pub fn append_move(
&mut self,
path: &[usize],
q: QuarterTurn
) -> Result<usize, ()>
[src]
pub fn append_move(
&mut self,
path: &[usize],
q: QuarterTurn
) -> Result<usize, ()>
[src]Inserts q after path in self and returns the index of the alternative where the move was placed (0 for continuing the line).
Format for path is [ply forward] : [alternative index, plyforward]*
In order to follow it, move to the next move path[0]
times, then if
there is more to path, go into alternative path[1]-1
and continue with path[2..]
This is the format Chess.com uses to notate with
Trait Implementations
impl StructuralPartialEq for PGN4
[src]
Auto Trait Implementations
impl RefUnwindSafe for PGN4
impl Send for PGN4
impl Sync for PGN4
impl Unpin for PGN4
impl UnwindSafe for PGN4
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more