pub struct NsPayload(pub(crate) [u8]);
Expand description
Tuple Fields§
§0: [u8]
Implementations§
Source§impl NsPayload
impl NsPayload
pub fn from_bytes_slice(bytes: &[u8]) -> &NsPayload
pub fn as_bytes_slice(&self) -> &[u8] ⓘ
pub fn byte_len(&self) -> NsPayloadByteLen
Sourcepub fn read<'a, R>(&'a self, range: &R) -> R::Outputwhere
R: NsPayloadBytesRange<'a>,
pub fn read<'a, R>(&'a self, range: &R) -> R::Outputwhere
R: NsPayloadBytesRange<'a>,
Read and parse bytes from the ns payload.
Arg range: &R
is convertible into a Range<usize>
via
NsPayloadBytesRange
. The payload bytes are parsed into a R::Output
via FromNsPayloadBytes
.
Sourcepub fn export_all_txs(&self, ns_id: &NamespaceId) -> Vec<Transaction>
pub fn export_all_txs(&self, ns_id: &NamespaceId) -> Vec<Transaction>
Return all transactions in this namespace. The namespace ID for each
returned Transaction
is set to ns_id
.
Sourcepub fn export_tx(
&self,
ns_id: &NamespaceId,
index: &TxIndex,
) -> Option<Transaction>
pub fn export_tx( &self, ns_id: &NamespaceId, index: &TxIndex, ) -> Option<Transaction>
Return a transaction from this namespace. Set its namespace ID to
ns_id
.
Return None
if index
is out of bounds.
Sourcefn read_num_txs(&self) -> NumTxsUnchecked
fn read_num_txs(&self) -> NumTxsUnchecked
Private helper. (Could be pub if desired.)
Sourcefn iter_from_num_txs(&self, num_txs: &NumTxsUnchecked) -> TxIter ⓘ
fn iter_from_num_txs(&self, num_txs: &NumTxsUnchecked) -> TxIter ⓘ
Private helper
Sourcefn tx_from_num_txs(
&self,
ns_id: &NamespaceId,
index: &TxIndex,
num_txs_unchecked: &NumTxsUnchecked,
) -> Transaction
fn tx_from_num_txs( &self, ns_id: &NamespaceId, index: &TxIndex, num_txs_unchecked: &NumTxsUnchecked, ) -> Transaction
Private helper
Trait Implementations§
Source§impl Borrow<NsPayload> for NsPayloadOwned
impl Borrow<NsPayload> for NsPayloadOwned
Source§impl ToOwned for NsPayload
impl ToOwned for NsPayload
Source§type Owned = NsPayloadOwned
type Owned = NsPayloadOwned
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> NsPayloadOwned
fn to_owned(&self) -> NsPayloadOwned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more
Auto Trait Implementations§
impl Freeze for NsPayload
impl RefUnwindSafe for NsPayload
impl Send for NsPayload
impl !Sized for NsPayload
impl Sync for NsPayload
impl Unpin for NsPayload
impl UnwindSafe for NsPayload
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
§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
§fn deserialize(
&self,
deserializer: &mut D,
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>
Deserializes using the given deserializer
§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Pipes by value. This is generally the method you want to use. Read more
§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
Borrows
self
and passes that borrow into the pipe function. Read more§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
Mutably borrows
self
and passes that borrow into the pipe function. Read more§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
Borrows
self
, then passes self.as_ref()
into the pipe function.§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
Mutably borrows
self
, then passes self.as_mut()
into the pipe
function.§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
Borrows
self
, then passes self.deref()
into the pipe function.