pub struct OutPoint(/* private fields */);
Implementations§
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) -> OutPoint
fn as_bytes(&self) -> Bytes
fn as_slice(&self) -> &[u8] ⓘ
fn from_slice(slice: &[u8]) -> Result<OutPoint, VerificationError>
fn from_compatible_slice(slice: &[u8]) -> Result<OutPoint, VerificationError>
fn new_builder() -> <OutPoint as Entity>::Builder
fn as_builder(self) -> <OutPoint as Entity>::Builder
source§impl Ord for OutPoint
impl Ord for OutPoint
source§impl PartialEq for OutPoint
impl PartialEq for OutPoint
source§impl PartialOrd for OutPoint
impl PartialOrd for OutPoint
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl 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.