//---------- AccessRecord ----------
-impl Deref for AccessRecord {
- type Target = Arc<dyn PlayerAccessSpec>;
- fn deref(&self) -> &Self::Target { return &self.0 }
-}
+// No DerefMut, to make sure we save properly etc.
+deref_to_field!{AccessRecord, Arc<dyn PlayerAccessSpec>, 0}
impl AccessRecord {
pub fn new_unset() -> Self{ Self( Arc::new(PlayerAccessUnset) ) }
#[derive(Debug,Clone,Serialize,Deserialize,Default)]
#[serde(transparent)]
pub struct LinksTable(pub EnumMap<LinkKind, Option<String>>);
+deref_to_field_mut!{LinksTable, EnumMap<LinkKind, Option<String>>, 0}
pub struct Instance {
pub name: Arc<InstanceName>,
}
}
-impl Deref for LinksTable {
- type Target = EnumMap<LinkKind, Option<String>>;
- fn deref(&self) -> &Self::Target { &self.0 }
-}
-impl DerefMut for LinksTable {
- fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 }
-}
-
impl From<&LinksTable> for Html {
fn from(links: &LinksTable) -> Html {
let mut s = links.iter()
// ---------- gamestate pieces table ----------
-impl Deref for Pieces {
- type Target = ActualPieces;
- fn deref(&self) -> &ActualPieces { &self.0 }
-}
+// No DerefMut to make sure we send updates, save, etc.
+deref_to_field!{Pieces, ActualPieces, 0}
impl Pieces {
pub fn get_mut(&mut self, piece: PieceId) -> Option<&mut PieceState> {
ending_send: Option<io::Cursor<Box<[u8]>>>,
init_confirmation_send: iter::Once<()>,
}
-
-impl Deref for UpdateReader {
- type Target = UpdateReaderWN;
- fn deref(&self) -> &UpdateReaderWN { &self.wn }
-}
+deref_to_field!{UpdateReader, UpdateReaderWN, wn} // no DerefMut
#[derive(Error,Debug)]
#[error("WouldBlock error misreported!")]
#[structopt(long="--geckodriver-args", default_value="")]
geckodriver_args: String,
}
-
-impl Deref for Opts {
- type Target = apitest::Opts;
- fn deref(&self) -> &Self::Target { &self.at }
-}
+deref_to_field!{Opts, apitest::Opts, at}
impl AsRef<apitest::Opts> for Opts {
fn as_ref(&self) -> &apitest::Opts { &self.at }
}