ckb_types/conversion/
blockchain.rs1use crate::{core, packed, prelude::*};
2
3impl Pack<packed::Uint64> for core::EpochNumberWithFraction {
4 fn pack(&self) -> packed::Uint64 {
5 self.full_value().pack()
6 }
7}
8
9impl From<core::EpochNumberWithFraction> for packed::Uint64 {
10 fn from(value: core::EpochNumberWithFraction) -> Self {
11 (&value).into()
12 }
13}
14
15impl From<&core::EpochNumberWithFraction> for packed::Uint64 {
16 fn from(value: &core::EpochNumberWithFraction) -> Self {
17 value.full_value().into()
18 }
19}
20
21impl<'r> Unpack<core::EpochNumberWithFraction> for packed::Uint64Reader<'r> {
22 fn unpack(&self) -> core::EpochNumberWithFraction {
23 core::EpochNumberWithFraction::from_full_value_unchecked(self.unpack())
24 }
25}
26impl_conversion_for_entity_unpack!(core::EpochNumberWithFraction, Uint64);
27
28impl<'r> From<packed::Uint64Reader<'r>> for core::EpochNumberWithFraction {
29 fn from(value: packed::Uint64Reader<'r>) -> core::EpochNumberWithFraction {
30 core::EpochNumberWithFraction::from_full_value_unchecked(value.into())
31 }
32}
33impl_conversion_for_entity_from!(core::EpochNumberWithFraction, Uint64);