Skip to main content

TlvSection

Struct TlvSection 

Source
pub struct TlvSection {
    pub use_site_path_overrides: Option<Vec<(u8, UseSitePath)>>,
    pub fingerprints: Option<Vec<(u8, [u8; 4])>>,
    pub pubkeys: Option<Vec<(u8, [u8; 65])>>,
    pub origin_path_overrides: Option<Vec<(u8, OriginPath)>>,
    pub unknown: Vec<(u8, Vec<u8>, usize)>,
}
Expand description

Decoded TLV section. Fields are populated from per-tag readers; unknown tags are preserved verbatim per D6 forward-compat.

Fields§

§use_site_path_overrides: Option<Vec<(u8, UseSitePath)>>

Per-@N use-site path overrides, if present.

§fingerprints: Option<Vec<(u8, [u8; 4])>>

Per-@N xpub fingerprints (4 bytes each), if present.

§pubkeys: Option<Vec<(u8, [u8; 65])>>

Per-@N xpub bytes (32-byte chain code || 33-byte compressed pubkey), if present. Wallet-policy mode predicate is pubkeys.is_some() && !pubkeys.unwrap().is_empty().

§origin_path_overrides: Option<Vec<(u8, OriginPath)>>

Per-@N origin-path overrides for wrappers whose canonical path is either undefined or has been overridden, if present.

§unknown: Vec<(u8, Vec<u8>, usize)>

Raw payload of unknown TLVs, keyed by tag, for forward-compat round-trip. Decoders preserve unknown TLVs verbatim through re-encoding.

Implementations§

Source§

impl TlvSection

Source

pub fn new_empty() -> Self

Create an empty TLV section (no entries).

Source

pub fn is_empty(&self) -> bool

Returns true if no TLV entries are present.

Source

pub fn write(&self, w: &mut BitWriter, key_index_width: u8) -> Result<(), Error>

Encode this TLV section onto w. Entries are emitted in ascending tag order. key_index_width is the bit-width of the per-@N placeholder index field.

§Errors
  • Error::EmptyTlvEntry if any of use_site_path_overrides, fingerprints, pubkeys, or origin_path_overrides is Some(vec![]). Empty TLVs violate the §7.5 omission discipline and are rejected at the encoder boundary.
  • Error::OverrideOrderViolation if any entry vector is not strictly ascending in idx.
  • Encoding errors from contained values (OriginPath::write, etc.).
Source

pub fn read( r: &mut BitReader<'_>, key_index_width: u8, n: u8, ) -> Result<Self, Error>

Decode a TLV section from r, consuming all remaining bits. key_index_width is the bit-width of placeholder indices; n is the key count.

Trait Implementations§

Source§

impl Clone for TlvSection

Source§

fn clone(&self) -> TlvSection

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TlvSection

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for TlvSection

Source§

fn eq(&self, other: &TlvSection) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for TlvSection

Source§

impl StructuralPartialEq for TlvSection

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.