pub struct NonceManager;Expand description
Thread-safe process-wide nonce allocator keyed by (wallet, subaccount_id).
Implementations§
Source§impl NonceManager
impl NonceManager
Sourcepub fn next_nonce(
&self,
wallet: &str,
subaccount_id: u64,
) -> Result<u64, NonceError>
pub fn next_nonce( &self, wallet: &str, subaccount_id: u64, ) -> Result<u64, NonceError>
Allocates the next nonce for (wallet, subaccount_id) using the
system clock as the nanosecond reference.
§Errors
Returns an error if the system clock is invalid, the timestamp cannot be encoded, or rollback places the nonce outside the order window.
Sourcepub fn next_nonce_at(
&self,
wallet: &str,
subaccount_id: u64,
now_ns: u64,
) -> Result<u64, NonceError>
pub fn next_nonce_at( &self, wallet: &str, subaccount_id: u64, now_ns: u64, ) -> Result<u64, NonceError>
Allocates the next nonce for (wallet, subaccount_id) with
caller-supplied UNIX time in nanoseconds.
§Errors
Returns an error if overflow occurs or rollback places the next nonce outside the inclusive order window.
Trait Implementations§
Source§impl Debug for NonceManager
impl Debug for NonceManager
Auto Trait Implementations§
impl Freeze for NonceManager
impl RefUnwindSafe for NonceManager
impl Send for NonceManager
impl Sync for NonceManager
impl Unpin for NonceManager
impl UnsafeUnpin for NonceManager
impl UnwindSafe for NonceManager
Blanket Implementations§
impl<T> Allocation for T
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more