1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//! Engine-agnostic CSA server protocol surface.
//!
//! This crate turns one line of the CSA server protocol into a typed
//! [`CsaCommand`] and back. It has no dependencies, no I/O, and no board
//! representation: sockets, clocks, and legality belong to the layer above.
//!
//! ```
//! use rsshogi_csa::{format_command, parse_line, CsaCommand, EndMarker};
//!
//! let command = parse_line("+7776FU,T12")?;
//! assert_eq!(format_command(&command), "+7776FU,T12");
//!
//! let CsaCommand::Move(line) = command else { unreachable!() };
//! assert_eq!(line.csa.as_str(), "+7776FU");
//! assert_eq!(line.elapsed, Some(12));
//!
//! assert_eq!(parse_line("#RESIGN")?, CsaCommand::End(EndMarker::Resign));
//! # Ok::<(), rsshogi_csa::ParseError>(())
//! ```
//!
//! The `BEGIN Game_Summary` proposal spans many lines and is assembled by
//! [`GameSummaryReader`] instead, which keeps the `BEGIN Position` body verbatim.
//!
//! # Scope
//!
//! CSA has two things that share a name. The *record format* — `.csa` files with
//! a `V2.2` header and `$EVENT` metadata — is handled by the `records` feature of
//! the [`rsshogi`](https://crates.io/crates/rsshogi) crate. The *server protocol*
//! — `LOGIN`, `BEGIN Game_Summary`, `+7776FU,T12`, `#WIN` — is what this crate
//! handles.
pub use ;
pub use format_command;
pub use ;
pub use ;
pub use GameSummaryReader;