From e1a5c6528d94369a3ee4968e8c58110b702cd251 Mon Sep 17 00:00:00 2001 From: Chris Mounce Date: Sat, 21 Mar 2026 00:19:08 -0700 Subject: [PATCH] Add doc comment about board size limits --- src/world.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/world.rs b/src/world.rs index a38d3f2..3b994bb 100644 --- a/src/world.rs +++ b/src/world.rs @@ -574,6 +574,11 @@ impl Board { } /// Serialize this board to bytes. + /// + /// Returns [`EncodeError::BoardTooLarge`] if the board is over 64 KiB when serialized. The file + /// format allows up to this size, but be aware that boards larger than 20 kB will cause memory + /// corruption in ZZT 3.2. Tools may want to warn the user if this function returns more than + /// 20,002 bytes (2 byte size header + 20 kB content). pub fn to_bytes(&self) -> Result, EncodeError> { let mut result = vec![]; result.push_padding(2); // reserve space for board size