chiark / gitweb /
Special client rendering: Do explain why not to provide xdata here
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 15 Apr 2022 11:28:57 +0000 (12:28 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 15 Apr 2022 19:39:28 +0000 (20:39 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/gamestate.rs

index e649864b9c20342daa946de16bbb0a3941aa78b3..c35b0f7bb64a1da3ba434afba2ecf95bf0660fcf 100644 (file)
@@ -180,6 +180,10 @@ pub trait PieceBaseTrait: OutlineTrait + Send + Debug + 'static {
 
   fn itemname(&self) -> &str;
 
+  // Don't add an xdata argument to this.  Implementors must not make
+  // this depend on the piece state, because the piece state might change
+  // between svg() (which sets up information in the DOM) and special()
+  // (which arranges to use that information).
   fn special(&self) -> Result<Option<SpecialClientRendering>,IE> { Ok(None) }
 }