pub struct Command { /* private fields */ }Expand description
Representation of a GTP controller to engine command.
Implementations§
Source§impl Command
impl Command
Sourcepub fn new(name: &str) -> Command
pub fn new(name: &str) -> Command
Constructs a new GTP controller command to be sent to the GTP engine.
use gtp;
let mut c = gtp::Command::new("list_commands");
c.args(|eb| eb.i(10).f(10.20).s("OK").list());
// send with:
let gtp_bytes = c.to_bytes();
// or if you need the string:
let gtp_str = c.to_string();Sourcepub fn new_with_args<T>(name: &str, args: T) -> Command
pub fn new_with_args<T>(name: &str, args: T) -> Command
Builds a new GTP engine command ready with the arguments:
use gtp;
assert_eq!(
gtp::Command::new_with_args("boardsize", |eb| eb.i(9)).to_string(),
"boardsize 9\n");Sourcepub fn set_id(&mut self, id: u32)
pub fn set_id(&mut self, id: u32)
Sets the ID of the command.
use gtp;
let mut c = gtp::Command::new("list_commands");
c.set_id(12);
assert_eq!(c.to_string(), "12 list_commands\n");Sourcepub fn args<T>(&mut self, f: T)
pub fn args<T>(&mut self, f: T)
Helper function to construct Entity arguments for this Command.
use gtp;
let mut c = gtp::Command::new("list_commands");
c.args(|eb| eb.i(10).f(10.20).s("OK").list());
assert_eq!(c.to_string(), "list_commands 10 10.2 OK\n");Trait Implementations§
impl StructuralPartialEq for Command
Auto Trait Implementations§
impl Freeze for Command
impl RefUnwindSafe for Command
impl Send for Command
impl Sync for Command
impl Unpin for Command
impl UnwindSafe for Command
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