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
const NAME: &'static str = "OutPoint"
type Builder = OutPointBuilder
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 PartialOrd for OutPoint
impl PartialOrd for OutPoint
impl Eq for OutPoint
Auto Trait Implementations§
impl !Freeze for OutPoint
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> 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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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.