pub struct Selector<'c> { /* private fields */ }Expand description
A coin selector
Implementations§
Source§impl<'c> Selector<'c>
impl<'c> Selector<'c>
Sourcepub fn new(
candidates: &'c InputCandidates,
params: SelectorParams,
) -> Result<Self, SelectorError>
pub fn new( candidates: &'c InputCandidates, params: SelectorParams, ) -> Result<Self, SelectorError>
Create new input selector.
§Errors
- If we are unable to create a change policy from the
params. - If the target is unreachable given the total input value.
Sourcepub fn inner(&self) -> &CoinSelector<'c>
pub fn inner(&self) -> &CoinSelector<'c>
Get the inner coin selector.
Sourcepub fn inner_mut(&mut self) -> &mut CoinSelector<'c>
pub fn inner_mut(&mut self) -> &mut CoinSelector<'c>
Get a mutable reference to the inner coin selector.
Sourcepub fn change_policy(&self) -> ChangePolicy
pub fn change_policy(&self) -> ChangePolicy
Coin selection change policy.
Sourcepub fn select_with_algorithm<F, E>(&mut self, algorithm: F) -> Result<(), E>
pub fn select_with_algorithm<F, E>(&mut self, algorithm: F) -> Result<(), E>
Select with the provided algorithm.
Sourcepub fn select_all(&mut self)
pub fn select_all(&mut self)
Select all.
Sourcepub fn select_until_target_met(&mut self) -> Result<(), InsufficientFunds>
pub fn select_until_target_met(&mut self) -> Result<(), InsufficientFunds>
Select in order until target is met.
Sourcepub fn has_change(&self) -> Option<bool>
pub fn has_change(&self) -> Option<bool>
Whether we added the change output to the selection.
Return None if target is not met yet.
Sourcepub fn try_finalize(&self) -> Option<Selection>
pub fn try_finalize(&self) -> Option<Selection>
Try get final selection.
Return None if target is not met yet.
Trait Implementations§
Auto Trait Implementations§
impl<'c> !Freeze for Selector<'c>
impl<'c> RefUnwindSafe for Selector<'c>
impl<'c> Send for Selector<'c>
impl<'c> Sync for Selector<'c>
impl<'c> Unpin for Selector<'c>
impl<'c> UnwindSafe for Selector<'c>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more