pub enum Bp<T>{
Bitcoin(T),
Liquid(T),
}
Expand description
Enumeration over types related to bitcoin protocol-compatible chains.
Variants§
Bitcoin(T)
Bitcoin blockchain-based.
NB: The type does not distinguish mainnet from testnets.
Liquid(T)
Liquid blockchain-based
NB: The type does not distinguish mainnet from testnets.
Implementations§
Source§impl<T: StrictDumb + StrictEncode + StrictDecode> Bp<T>
impl<T: StrictDumb + StrictEncode + StrictDecode> Bp<T>
Sourcepub fn is_bitcoin(&self) -> bool
pub fn is_bitcoin(&self) -> bool
Detects if the variant matches bitcoin blockchain.
Sourcepub fn as_bitcoin(&self) -> Option<&T>
pub fn as_bitcoin(&self) -> Option<&T>
Returns bitcoin blockchain variant as an optional.
Sourcepub fn into_bitcoin(self) -> Option<T>
pub fn into_bitcoin(self) -> Option<T>
Converts into bitcoin blockchain optional.
Sourcepub fn into_liquid(self) -> Option<T>
pub fn into_liquid(self) -> Option<T>
Converts into liquid blockchain optional.
Sourcepub fn map<U: StrictDumb + StrictEncode + StrictDecode>(
self,
f: impl FnOnce(T) -> U,
) -> Bp<U>
pub fn map<U: StrictDumb + StrictEncode + StrictDecode>( self, f: impl FnOnce(T) -> U, ) -> Bp<U>
Maps the value from one internal type into another.
Sourcepub fn try_map<U: StrictDumb + StrictEncode + StrictDecode, E>(
self,
f: impl FnOnce(T) -> Result<U, E>,
) -> Result<Bp<U>, E>
pub fn try_map<U: StrictDumb + StrictEncode + StrictDecode, E>( self, f: impl FnOnce(T) -> Result<U, E>, ) -> Result<Bp<U>, E>
Maps the value from one internal type into another, covering cases which may error.
Sourcepub fn maybe_map<U: StrictDumb + StrictEncode + StrictDecode>(
self,
f: impl FnOnce(T) -> Option<U>,
) -> Option<Bp<U>>
pub fn maybe_map<U: StrictDumb + StrictEncode + StrictDecode>( self, f: impl FnOnce(T) -> Option<U>, ) -> Option<Bp<U>>
Maps the value from one internal type into another, covering cases which may result in an optional value.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Bp<T>
impl<'de, T> Deserialize<'de> for Bp<T>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> Ord for Bp<T>
impl<T> Ord for Bp<T>
Source§impl<T> PartialOrd for Bp<T>
impl<T> PartialOrd for Bp<T>
Source§impl<T> StrictDecode for Bp<T>
impl<T> StrictDecode for Bp<T>
fn strict_decode(reader: &mut impl TypedRead) -> Result<Self, DecodeError>
fn strict_read(reader: impl ReadRaw) -> Result<Self, DecodeError>
Source§impl<T> StrictDumb for Bp<T>
impl<T> StrictDumb for Bp<T>
fn strict_dumb() -> Self
Source§impl<T> StrictEncode for Bp<T>
impl<T> StrictEncode for Bp<T>
fn strict_encode<W: TypedWrite>(&self, writer: W) -> Result<W>
fn strict_write(&self, writer: impl WriteRaw) -> Result<(), Error>
Source§impl<T> StrictSum for Bp<T>
impl<T> StrictSum for Bp<T>
const ALL_VARIANTS: &'static [(u8, &'static str)]
fn variant_name(&self) -> &'static str
fn strict_check_variants()
fn variant_name_by_tag(tag: u8) -> Option<VariantName>
fn variant_ord(&self) -> u8
Source§impl<T> StrictType for Bp<T>
impl<T> StrictType for Bp<T>
const STRICT_LIB_NAME: &'static str = dbc::LIB_NAME_BPCORE
fn strict_name() -> Option<TypeName>
Source§impl<T> StrictUnion for Bp<T>
impl<T> StrictUnion for Bp<T>
fn strict_type_info() -> TypeInfo<Self>
impl<T> Copy for Bp<T>
impl<T> Eq for Bp<T>
impl<T> StructuralPartialEq for Bp<T>
Auto Trait Implementations§
impl<T> Freeze for Bp<T>where
T: Freeze,
impl<T> RefUnwindSafe for Bp<T>where
T: RefUnwindSafe,
impl<T> Send for Bp<T>where
T: Send,
impl<T> Sync for Bp<T>where
T: Sync,
impl<T> Unpin for Bp<T>where
T: Unpin,
impl<T> UnwindSafe for Bp<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.