File tree 2 files changed +16
-2
lines changed 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ fn tagged_branch_hash_from_engine(
144
144
/// [`Iterator`] over a sequence of bytes yielding [`TlvRecord`]s. The input is assumed to be a
145
145
/// well-formed TLV stream.
146
146
#[ derive( Clone ) ]
147
- pub ( super ) struct TlvStream < ' a > {
147
+ pub ( crate ) struct TlvStream < ' a > {
148
148
data : io:: Cursor < & ' a [ u8 ] > ,
149
149
}
150
150
@@ -170,13 +170,26 @@ impl<'a> TlvStream<'a> {
170
170
}
171
171
172
172
/// A slice into a [`TlvStream`] for a record.
173
- pub ( super ) struct TlvRecord < ' a > {
173
+ #[ derive( PartialEq ) ]
174
+ pub ( crate ) struct TlvRecord < ' a > {
174
175
pub ( super ) r#type : u64 ,
175
176
type_bytes : & ' a [ u8 ] ,
176
177
// The entire TLV record.
177
178
pub ( super ) record_bytes : & ' a [ u8 ] ,
178
179
}
179
180
181
+ impl TlvRecord < ' _ > {
182
+ pub ( crate ) fn get_type ( & self ) -> u64 {
183
+ self . r#type
184
+ }
185
+ }
186
+
187
+ impl Writeable for TlvRecord < ' _ > {
188
+ fn write < W : Writer > ( & self , writer : & mut W ) -> Result < ( ) , io:: Error > {
189
+ writer. write_all ( self . record_bytes )
190
+ }
191
+ }
192
+
180
193
impl < ' a > Iterator for TlvStream < ' a > {
181
194
type Item = TlvRecord < ' a > ;
182
195
Original file line number Diff line number Diff line change 15
15
pub mod invoice;
16
16
pub mod invoice_request;
17
17
mod merkle;
18
+ pub ( crate ) use merkle:: { TlvRecord , TlvStream } ;
18
19
pub mod offer;
19
20
pub mod parse;
20
21
mod payer;
You can’t perform that action at this time.
0 commit comments