Skip to content

Commit b5a5e59

Browse files
committed
Make LengthRead[able] public
A followup commit will require that LengthReadable be accessible from outside the lightning crate, as it will be the default trait referenced for TLV stream decoding.
1 parent 31b32c5 commit b5a5e59

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lightning/src/util/ser.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -344,8 +344,8 @@ where
344344
fn read<R: Read>(reader: &mut R, params: P) -> Result<Self, DecodeError>;
345345
}
346346

347-
/// A [`std::io::Read`] that also provides the total bytes available to be read.
348-
pub(crate) trait LengthRead: Read {
347+
/// A [`io::Read`] that also provides the total bytes available to be read.
348+
pub trait LengthRead: Read {
349349
/// The total number of bytes available to be read.
350350
fn total_bytes(&self) -> u64;
351351
}
@@ -361,9 +361,12 @@ where
361361
fn read<R: LengthRead>(reader: &mut R, params: P) -> Result<Self, DecodeError>;
362362
}
363363

364-
/// A trait that various higher-level LDK types implement allowing them to be read in
365-
/// from a [`Read`], requiring the implementer to provide the total length of the read.
366-
pub(crate) trait LengthReadable
364+
/// A trait that various LDK types implement allowing them to be read in from a [`Read`], requiring
365+
/// the implementer to provide the total length of the read.
366+
///
367+
/// Any type that implements [`Readable`] also automatically has a [`LengthReadable`]
368+
/// implementation, but some types, most notably onion packets, only implement [`LengthReadable`].
369+
pub trait LengthReadable
367370
where
368371
Self: Sized,
369372
{

0 commit comments

Comments
 (0)