From 769e2c38bf5e4fefe66accd19bff6298afa14ead Mon Sep 17 00:00:00 2001 From: Gary Krause Date: Tue, 9 Jul 2024 13:51:00 -0400 Subject: [PATCH] doc: Document Seq064K Takes specific of bytes, types and sizes from the specification. Lists some use cases for this struct. Work toward: #1011 --- .../codec/src/datatypes/non_copy_data_types/seq_inner.rs | 7 +++++++ .../serde-sv2/src/primitives/sequences/seq064k.rs | 1 + 2 files changed, 8 insertions(+) diff --git a/protocols/v2/binary-sv2/no-serde-sv2/codec/src/datatypes/non_copy_data_types/seq_inner.rs b/protocols/v2/binary-sv2/no-serde-sv2/codec/src/datatypes/non_copy_data_types/seq_inner.rs index acc50f15f4..007ace5549 100644 --- a/protocols/v2/binary-sv2/no-serde-sv2/codec/src/datatypes/non_copy_data_types/seq_inner.rs +++ b/protocols/v2/binary-sv2/no-serde-sv2/codec/src/datatypes/non_copy_data_types/seq_inner.rs @@ -95,6 +95,13 @@ impl<'a, T: GetSize> GetSize for Seq0255<'a, T> { } } +/// Fixed size data sequence up to a length of 65535 +/// +/// Byte Lenght: Fixed size T: `2 + LENGTH * size(T)Variable length T: 2 + seq.map(\|x\| x.length).sum()` +/// Decsription: 2-byte length L, unsigned little-endian integer 16-bits, followed by a sequence of L elements of type T. Allowed range of length is 0 to 65535. +/// +/// Used for listing channel ids, tx short hashes, tx hashes, list indexes, and full transaction data. +/// /// The liftime is here only for type compatibility with serde-sv2 #[derive(Debug, Clone, Eq, PartialEq)] pub struct Seq064K<'a, T>(pub(crate) Vec, PhantomData<&'a T>); diff --git a/protocols/v2/binary-sv2/serde-sv2/src/primitives/sequences/seq064k.rs b/protocols/v2/binary-sv2/serde-sv2/src/primitives/sequences/seq064k.rs index 8c2428d913..c830e213db 100644 --- a/protocols/v2/binary-sv2/serde-sv2/src/primitives/sequences/seq064k.rs +++ b/protocols/v2/binary-sv2/serde-sv2/src/primitives/sequences/seq064k.rs @@ -9,6 +9,7 @@ use crate::{ use alloc::vec::Vec; use serde::{ser, ser::SerializeTuple, Deserialize, Deserializer, Serialize}; +/// See `binary_sv2::Seq064k` #[derive(Debug, Clone)] pub struct Seq064K<'s, T: Clone + Serialize + TryFromBSlice<'s>> { seq: Option>,