pub use otter::commands::{MgmtCommand, MgmtResponse};
pub use otter::commands::{MgmtGameInstruction, MgmtGameResponse};
pub use otter::commands::{MgmtGameUpdateMode};
+pub use otter::deref_to_field;
pub use otter::gamestate::{self, Generation, PlayerId};
pub use otter::global::InstanceName;
pub use otter::mgmtchannel::MgmtChannel;
// ==================== Facilities for tests ====================
+impl AsRef<Opts> for Opts { fn as_ref(&self) -> &Opts { self } }
+
// -------------------- Substition --------------------
pub trait Substitutor {
}
}
}
+
+#[macro_export]
+macro_rules! deref_to_field {
+ {$outer:ident, $inner:ty, $field:ident} => {
+ impl Deref for $outer {
+ type Target = $inner;
+ fn deref(&self) -> &$inner { &self.$field }
+ }
+ }
+}
name
}
-#[macro_export]
-macro_rules! ctx_with_setup {
- {$ctx:ident} => {
- impl Deref for $ctx {
- type Target = self::Setup;
- fn deref(&self) -> &self::Setup { &self.su }
- }
- }
-}
-
impl Setup {
pub fn want_test(&mut self, tname: &str) -> bool {
self.wanted_tests.wantp(tname)
alice: Window,
bob: Window,
}
-ctx_with_setup!{Ctx}
+deref_to_field!{Ctx, Setup, su}
const HAND: &str = "6.1";
const ALICE: &str = "1#1";
bob: Window,
spec: GameSpec,
}
-ctx_with_setup!{Ctx}
+deref_to_field!{Ctx, Setup, su}
impl Ctx {
#[throws(AE)]