pub struct OutPoint(_);
Implementations§
source§impl OutPoint
impl OutPoint
pub const TOTAL_SIZE: usize = 36usize
pub const FIELD_SIZES: [usize; 2] = _
pub const FIELD_COUNT: usize = 2usize
pub fn tx_hash(&self) -> Byte32
pub fn index(&self) -> Uint32
pub fn as_reader<'r>(&'r self) -> OutPointReader<'r>
source§impl OutPoint
impl OutPoint
sourcepub fn to_cell_key(&self) -> Vec<u8>
pub fn to_cell_key(&self) -> Vec<u8>
Generates a binary data to be used as a key for indexing cells in storage.
Notice
The difference between Self::as_slice()
and Self::to_cell_key()
is the byteorder of the field index
.
-
Uses little endian for the field
index
in serialization.Because in the real world, the little endian machines make up the majority, we can cast it as a number without re-order the bytes.
-
Uses big endian for the field
index
to index cells in storage.So we can use
tx_hash
as key prefix to seek the cells from storage in the forward order, so as to traverse cells in the forward order too.
Trait Implementations§
source§impl Entity for OutPoint
impl Entity for OutPoint
type Builder = OutPointBuilder
const NAME: &'static str = "OutPoint"
fn new_unchecked(data: Bytes) -> Self
fn as_bytes(&self) -> Bytes
fn as_slice(&self) -> &[u8] ⓘ
fn from_slice(slice: &[u8]) -> VerificationResult<Self>
fn from_compatible_slice(slice: &[u8]) -> VerificationResult<Self>
fn new_builder() -> Self::Builder
fn as_builder(self) -> Self::Builder
source§impl PartialEq<OutPoint> for OutPoint
impl PartialEq<OutPoint> for OutPoint
impl Eq for OutPoint
Auto Trait Implementations§
impl RefUnwindSafe for OutPoint
impl Send for OutPoint
impl Sync for OutPoint
impl Unpin for OutPoint
impl UnwindSafe for OutPoint
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> PackVec<OutPointVec, OutPoint> for Twhere
T: IntoIterator<Item = OutPoint>,
impl<T> PackVec<OutPointVec, OutPoint> for Twhere T: IntoIterator<Item = OutPoint>,
source§fn pack(self) -> OutPointVec
fn pack(self) -> OutPointVec
Packs a vector of binary data into one binary data.