refactor: simplify Buffer.write_state

This commit is contained in:
CJ van den Berg 2025-11-03 22:14:15 +01:00
parent 30b1329d10
commit 8d0f333ad8
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -1583,17 +1583,18 @@ pub fn write_state(self: *const Self, writer: *std.Io.Writer) error{ Stop, OutOf
try self.root.store(&content.writer, self.file_eol_mode); try self.root.store(&content.writer, self.file_eol_mode);
const dirty = self.is_dirty(); const dirty = self.is_dirty();
try cbor.writeArrayHeader(writer, 9); try cbor.writeValue(writer, .{
try cbor.writeValue(writer, self.get_file_path()); self.get_file_path(),
try cbor.writeValue(writer, self.file_exists); self.file_exists,
try cbor.writeValue(writer, self.file_eol_mode); self.file_eol_mode,
try cbor.writeValue(writer, self.hidden); self.hidden,
try cbor.writeValue(writer, self.ephemeral); self.ephemeral,
try cbor.writeValue(writer, self.auto_save); self.auto_save,
try cbor.writeValue(writer, dirty); dirty,
try cbor.writeValue(writer, self.meta); self.meta,
try cbor.writeValue(writer, self.file_type_name); self.file_type_name,
try cbor.writeValue(writer, content.written()); content.written(),
});
} }
pub const ExtractStateOperation = enum { none, open_file }; pub const ExtractStateOperation = enum { none, open_file };