Skip to content

Commit

Permalink
docs: note about type changes (paradigmxyz#11925)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse authored Oct 21, 2024
1 parent bdad91b commit aba4991
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions crates/storage/codecs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ pub mod test_utils;
/// Regarding the `specialized_to/from_compact` methods: Mainly used as a workaround for not being
/// able to specialize an impl over certain types like `Vec<T>`/`Option<T>` where `T` is a fixed
/// size array like `Vec<B256>`.
///
/// ## Caution
///
/// Due to the bitfields, every type change on the rust type (e.g. `U256` to `u64`) is a breaking
/// change and will lead to a new, incompatible [`Compact`] implementation. Implementers must take
/// special care when changing or rearranging fields.
pub trait Compact: Sized {
/// Takes a buffer which can be written to. *Ideally*, it returns the length written to.
fn to_compact<B>(&self, buf: &mut B) -> usize
Expand Down

0 comments on commit aba4991

Please sign in to comment.