Struct gstd::Reservation
source · pub struct Reservation { /* private fields */ }
Expand description
Stores additional data along with ReservationId
to track its state.
Implementations§
source§impl Reservation
impl Reservation
sourcepub fn reserve(amount: u64, duration: u32) -> Result<Self>
pub fn reserve(amount: u64, duration: u32) -> Result<Self>
Reserve the amount
of gas for further usage.
duration
is the block count within which the reserve must be used.
Refer to ReservationId
for the more detailed description.
sourcepub fn unreserve(self) -> Result<u64>
pub fn unreserve(self) -> Result<u64>
Unreserve unused gas from the reservation.
If successful, it returns the reserved amount of gas.
sourcepub fn id(&self) -> ReservationId
pub fn id(&self) -> ReservationId
ReservationId
associated with current Reservation
.
sourcepub fn valid_until(&self) -> u32
pub fn valid_until(&self) -> u32
Returns block number when this Reservation
expires.
Trait Implementations§
source§impl Clone for Reservation
impl Clone for Reservation
source§fn clone(&self) -> Reservation
fn clone(&self) -> Reservation
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for Reservation
impl Debug for Reservation
source§impl Decode for Reservation
impl Decode for Reservation
source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy,
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy, ) -> Result<Self, Error>
Attempt to deserialise the value from input.
§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
Attempt to skip the encoded value from input. Read more
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
source§impl Encode for Reservation
impl Encode for Reservation
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Convert self to a slice and append it to the destination.
§fn using_encoded<R, F>(&self, f: F) -> R
fn using_encoded<R, F>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
source§impl From<Reservation> for ReservationId
impl From<Reservation> for ReservationId
source§fn from(res: Reservation) -> Self
fn from(res: Reservation) -> Self
Converts to this type from the input type.
source§impl Hash for Reservation
impl Hash for Reservation
source§impl TypeInfo for Reservation
impl TypeInfo for Reservation
impl Copy for Reservation
impl EncodeLike for Reservation
Auto Trait Implementations§
impl Freeze for Reservation
impl RefUnwindSafe for Reservation
impl Send for Reservation
impl Sync for Reservation
impl Unpin for Reservation
impl UnwindSafe for Reservation
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
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
)§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
§impl<T> KeyedVec for Twhere
T: Codec,
impl<T> KeyedVec for Twhere
T: Codec,
§fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>
fn to_keyed_vec(&self, prepend_key: &[u8]) -> Vec<u8>
Return an encoding of
Self
prepended by given slice.