Struct breez_sdk_core::bitcoin::PackedLockTime
pub struct PackedLockTime(pub u32);
Expand description
Packed lock time wraps a LockTime
consensus value i.e., the raw u32
used by the network.
This struct may be preferred in performance-critical applications because it’s slightly smaller
than LockTime
and has a bit more performant (de)serialization. In particular, this may be
relevant when the value is not processed, just passed around. Note however that the difference
is super-small, so unless you do something extreme you shouldn’t worry about it.
This type implements a naive ordering based on the u32
, this is not a semantically correct
ordering for a lock time, hence LockTime
does not implement Ord
. This type is useful if
you want to use a lock time as part of a struct and wish to derive Ord
. For all other uses,
consider using LockTime
directly.
§Examples
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)]
struct S {
lock_time: PackedLockTime,
amount: Amount,
}
let _ = S {
lock_time: LockTime::from_consensus(741521).into(),
amount: Amount::from_sat(10_000_000),
};
Tuple Fields§
§0: u32
Implementations§
§impl PackedLockTime
impl PackedLockTime
pub const ZERO: PackedLockTime = _
pub const ZERO: PackedLockTime = _
If crate::Transaction::lock_time
is set to zero it is ignored, in other words a
transaction with nLocktime==0 is able to be included immediately in any block.
Trait Implementations§
§impl Clone for PackedLockTime
impl Clone for PackedLockTime
§fn clone(&self) -> PackedLockTime
fn clone(&self) -> PackedLockTime
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for PackedLockTime
impl Debug for PackedLockTime
§impl Decodable for PackedLockTime
impl Decodable for PackedLockTime
§impl<'de> Deserialize<'de> for PackedLockTime
impl<'de> Deserialize<'de> for PackedLockTime
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<PackedLockTime, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<PackedLockTime, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Display for PackedLockTime
impl Display for PackedLockTime
§impl Encodable for PackedLockTime
impl Encodable for PackedLockTime
§impl From<&LockTime> for PackedLockTime
impl From<&LockTime> for PackedLockTime
§fn from(n: &LockTime) -> PackedLockTime
fn from(n: &LockTime) -> PackedLockTime
§impl From<&PackedLockTime> for LockTime
impl From<&PackedLockTime> for LockTime
§fn from(n: &PackedLockTime) -> LockTime
fn from(n: &PackedLockTime) -> LockTime
§impl From<LockTime> for PackedLockTime
impl From<LockTime> for PackedLockTime
§fn from(n: LockTime) -> PackedLockTime
fn from(n: LockTime) -> PackedLockTime
§impl From<PackedLockTime> for LockTime
impl From<PackedLockTime> for LockTime
§fn from(n: PackedLockTime) -> LockTime
fn from(n: PackedLockTime) -> LockTime
§impl From<PackedLockTime> for u32
impl From<PackedLockTime> for u32
§fn from(p: PackedLockTime) -> u32
fn from(p: PackedLockTime) -> u32
§impl FromStr for PackedLockTime
impl FromStr for PackedLockTime
§type Err = ParseIntError
type Err = ParseIntError
§fn from_str(s: &str) -> Result<PackedLockTime, <PackedLockTime as FromStr>::Err>
fn from_str(s: &str) -> Result<PackedLockTime, <PackedLockTime as FromStr>::Err>
s
to return a value of this type. Read more§impl Hash for PackedLockTime
impl Hash for PackedLockTime
§impl LowerHex for PackedLockTime
impl LowerHex for PackedLockTime
§impl Ord for PackedLockTime
impl Ord for PackedLockTime
§impl PartialEq for PackedLockTime
impl PartialEq for PackedLockTime
§impl PartialOrd for PackedLockTime
impl PartialOrd for PackedLockTime
§impl Serialize for PackedLockTime
impl Serialize for PackedLockTime
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
§impl TryFrom<&str> for PackedLockTime
impl TryFrom<&str> for PackedLockTime
§type Error = ParseIntError
type Error = ParseIntError
§fn try_from(
s: &str,
) -> Result<PackedLockTime, <PackedLockTime as TryFrom<&str>>::Error>
fn try_from( s: &str, ) -> Result<PackedLockTime, <PackedLockTime as TryFrom<&str>>::Error>
§impl TryFrom<Box<str>> for PackedLockTime
impl TryFrom<Box<str>> for PackedLockTime
§type Error = ParseIntError
type Error = ParseIntError
§impl TryFrom<String> for PackedLockTime
impl TryFrom<String> for PackedLockTime
§type Error = ParseIntError
type Error = ParseIntError
§fn try_from(
s: String,
) -> Result<PackedLockTime, <PackedLockTime as TryFrom<String>>::Error>
fn try_from( s: String, ) -> Result<PackedLockTime, <PackedLockTime as TryFrom<String>>::Error>
§impl UpperHex for PackedLockTime
impl UpperHex for PackedLockTime
impl Copy for PackedLockTime
impl Eq for PackedLockTime
impl StructuralPartialEq for PackedLockTime
Auto Trait Implementations§
impl Freeze for PackedLockTime
impl RefUnwindSafe for PackedLockTime
impl Send for PackedLockTime
impl Sync for PackedLockTime
impl Unpin for PackedLockTime
impl UnwindSafe for PackedLockTime
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any
.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any
.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
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request