5.3.0
FlatSharp version 5.3 is a relatively minor upgrade from version 5.2. It includes an interface change to ISpanWriter
.
So, what's new?
Write Through
In limited scenarios, FlatSharp can now make in-place changes to buffers by writing directly back to them. This can help you avoid an expensive parse-update-serialize flow. The restrictions are:
- Only struct fields are eligible for write through (including nested structs)
- Write through is only compatible with
VectorCacheMutable
serialization
bit_flags
FlatSharp now supports the standard flatbuffer bit_flags
attribute. This generates enums with the [Flags]
attribute.
Memory Savings
PropertyCache
and VectorCache
now use bit masks for capturing presence/absence of fields. Previously, each field used a dedicated bool (stored as a byte). This decreases memory usage, especially for struct vectors.
ISpanWriter Changes
The signature for ISpanWriter
has changed slightly. Most methods now no longer accept a SerializationContext
parameter. This change was made to support the write through feature where primitives may be updated without access to a valid SerializationContext
. This is nominally a breaking change, but most customers will not experience it as it is not believed that there are external implementations of ISpanWriter
.