Skip to main content

LabelledWallet

Struct LabelledWallet 

Source
pub struct LabelledWallet<'a> {
    pub wallet: &'a mut Wallet,
    pub labels: &'a mut LabelChangeset,
}
Expand description

A wrapper around a BDK Wallet and a LabelChangeset that provides BIP-329 functionality.

This struct enables direct manipulation of wallet labels while holding mutable references to both the underlying wallet state and the current label changeset.

Fields§

§wallet: &'a mut Wallet

A mutable reference to the underlying BDK wallet.

§labels: &'a mut LabelChangeset

A mutable reference to the current in-memory label state.

Implementations§

Source§

impl LabelledWallet<'_>

Source

pub fn persist<P: LabelPersister>( &mut self, persister: &mut P, ) -> Result<(), Error>

Flushes only the labels changed since the last successful persist to the provided database persister.

Trait Implementations§

Source§

impl Bip329 for LabelledWallet<'_>

Source§

fn add_label( &mut self, target: impl Into<LabelTarget>, label_text: impl Into<String>, ) -> Result<Label, Error>

Adds a new human-readable label to a specified target (e.g., Address, Txid).
Source§

fn import_labels<R: BufRead>( &mut self, reader: R, strategy: MergeStrategy, ) -> Result<(), Error>

Imports labels from a BIP-329 compliant JSONL stream and merges them with the current state.
Source§

fn export_labels<W: Write>(&self, writer: W) -> Result<(), Error>

Exports the current label state deterministically to a writable stream in BIP-329 JSONL format.

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for LabelledWallet<'a>

§

impl<'a> !UnwindSafe for LabelledWallet<'a>

§

impl<'a> Freeze for LabelledWallet<'a>

§

impl<'a> Send for LabelledWallet<'a>

§

impl<'a> Sync for LabelledWallet<'a>

§

impl<'a> Unpin for LabelledWallet<'a>

§

impl<'a> UnsafeUnpin for LabelledWallet<'a>

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V