Tag types used for the TLV macros with (C-not exported)

Obviously bindings users can't use the Rust TLV-implementation
macros, so there's no reason to export typsed used exclusively by
them.
This commit is contained in:
Matt Corallo 2023-02-28 19:59:34 +00:00
parent 08cb01e6ef
commit 40fcfafef2

View file

@ -89,6 +89,8 @@ impl Writer for VecWriter {
/// Writer that only tracks the amount of data written - useful if you need to calculate the length /// Writer that only tracks the amount of data written - useful if you need to calculate the length
/// of some data when serialized but don't yet need the full data. /// of some data when serialized but don't yet need the full data.
///
/// (C-not exported) as manual TLV building is not currently supported in bindings
pub struct LengthCalculatingWriter(pub usize); pub struct LengthCalculatingWriter(pub usize);
impl Writer for LengthCalculatingWriter { impl Writer for LengthCalculatingWriter {
#[inline] #[inline]
@ -100,6 +102,8 @@ impl Writer for LengthCalculatingWriter {
/// Essentially [`std::io::Take`] but a bit simpler and with a method to walk the underlying stream /// Essentially [`std::io::Take`] but a bit simpler and with a method to walk the underlying stream
/// forward to ensure we always consume exactly the fixed length specified. /// forward to ensure we always consume exactly the fixed length specified.
///
/// (C-not exported) as manual TLV building is not currently supported in bindings
pub struct FixedLengthReader<R: Read> { pub struct FixedLengthReader<R: Read> {
read: R, read: R,
bytes_read: u64, bytes_read: u64,
@ -155,6 +159,8 @@ impl<R: Read> LengthRead for FixedLengthReader<R> {
/// A [`Read`] implementation which tracks whether any bytes have been read at all. This allows us to distinguish /// A [`Read`] implementation which tracks whether any bytes have been read at all. This allows us to distinguish
/// between "EOF reached before we started" and "EOF reached mid-read". /// between "EOF reached before we started" and "EOF reached mid-read".
///
/// (C-not exported) as manual TLV building is not currently supported in bindings
pub struct ReadTrackingReader<R: Read> { pub struct ReadTrackingReader<R: Read> {
read: R, read: R,
/// Returns whether we have read from this reader or not yet. /// Returns whether we have read from this reader or not yet.
@ -289,6 +295,8 @@ impl<T: Readable> MaybeReadable for T {
} }
/// Wrapper to read a required (non-optional) TLV record. /// Wrapper to read a required (non-optional) TLV record.
///
/// (C-not exported) as manual TLV building is not currently supported in bindings
pub struct RequiredWrapper<T>(pub Option<T>); pub struct RequiredWrapper<T>(pub Option<T>);
impl<T: Readable> Readable for RequiredWrapper<T> { impl<T: Readable> Readable for RequiredWrapper<T> {
#[inline] #[inline]
@ -311,6 +319,8 @@ impl<T> From<T> for RequiredWrapper<T> {
/// Wrapper to read a required (non-optional) TLV record that may have been upgraded without /// Wrapper to read a required (non-optional) TLV record that may have been upgraded without
/// backwards compat. /// backwards compat.
///
/// (C-not exported) as manual TLV building is not currently supported in bindings
pub struct UpgradableRequired<T: MaybeReadable>(pub Option<T>); pub struct UpgradableRequired<T: MaybeReadable>(pub Option<T>);
impl<T: MaybeReadable> MaybeReadable for UpgradableRequired<T> { impl<T: MaybeReadable> MaybeReadable for UpgradableRequired<T> {
#[inline] #[inline]
@ -591,6 +601,8 @@ impl Readable for [u16; 8] {
/// A type for variable-length values within TLV record where the length is encoded as part of the record. /// A type for variable-length values within TLV record where the length is encoded as part of the record.
/// Used to prevent encoding the length twice. /// Used to prevent encoding the length twice.
///
/// (C-not exported) as manual TLV building is not currently supported in bindings
pub struct WithoutLength<T>(pub T); pub struct WithoutLength<T>(pub T);
impl Writeable for WithoutLength<&String> { impl Writeable for WithoutLength<&String> {