#[non_exhaustive]pub enum CsaCommand {
Show 18 variants
Login {
name: String,
password: String,
x1: bool,
},
Logout,
Agree {
game_id: Option<String>,
},
Reject {
game_id: Option<String>,
},
Challenge,
Meta(MetaCommand),
LoginOk {
name: String,
},
LoginIncorrect,
LogoutCompleted,
ChallengeAccepted,
BeginGameSummary,
Start {
game_id: String,
},
RejectNotice {
game_id: String,
by: String,
},
End(EndMarker),
Info(InfoLine),
Move(MoveLine),
Special {
kind: SpecialMove,
elapsed: Option<u64>,
},
KeepAlive,
}Expand description
One line of the CSA server protocol.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Login
LOGIN <name> <password> with an optional x1 suffix.
Fields
Logout
LOGOUT
Agree
AGREE or AGREE <game_id>.
Reject
REJECT or REJECT <game_id>, sent by the client.
Challenge
CHALLENGE, a legacy no-op the server answers with CHALLENGE ACCEPTED.
Meta(MetaCommand)
A %% administrative command.
LoginOk
LOGIN:<name> OK
LoginIncorrect
LOGIN:incorrect
LogoutCompleted
LOGOUT:completed
ChallengeAccepted
CHALLENGE ACCEPTED
BeginGameSummary
BEGIN Game_Summary, the first line of a game proposal.
Feed this line and everything after it to crate::GameSummaryReader.
Start
START:<game_id>
RejectNotice
REJECT:<game_id> by <name>, sent by the server to both players.
End(EndMarker)
A #-prefixed terminal marker.
Info(InfoLine)
A ##[TAG] ... informational line.
Move(MoveLine)
A move, optionally annotated with elapsed time and a comment.
Special
A %-prefixed special move, optionally annotated with elapsed time.
Fields
kind: SpecialMoveWhich special move.
elapsed: Option<u64>Raw integer time annotation, with the same unit contract as MoveLine::elapsed.
KeepAlive
An empty line, used as an application-level keepalive.
The CSA rule is that a client must not send these more often than once every 30 seconds.
Implementations§
Source§impl CsaCommand
impl CsaCommand
Sourcepub const fn direction(&self) -> Option<CsaCommandDirection>
pub const fn direction(&self) -> Option<CsaCommandDirection>
Which way this command travels, or None when the direction is unknown.
Sourcepub const fn is_client_to_server(&self) -> bool
pub const fn is_client_to_server(&self) -> bool
Whether a client may send this command.
Sourcepub const fn is_server_to_client(&self) -> bool
pub const fn is_server_to_client(&self) -> bool
Whether a server may send this command.