RentConfig

Struct RentConfig 

Source
#[repr(C)]
pub struct RentConfig { pub base_rent: u16, pub compression_cost: u16, pub lamports_per_byte_per_epoch: u8, pub max_funded_epochs: u8, pub max_top_up: u16, }
Expand description

Rent function parameters, used to calculate whether the account is compressible.

Fields§

§base_rent: u16

Base rent constant: rent = base_rent + num_bytes * lamports_per_byte_per_epoch

§compression_cost: u16§lamports_per_byte_per_epoch: u8§max_funded_epochs: u8§max_top_up: u16

Maximum lamports that can be charged per top-up operation. Protects against griefing by accounts with high lamports_per_write.

Implementations§

Source§

impl RentConfig

Source

pub const LEN: usize

Source§

impl RentConfig

Source

pub fn rent_curve_per_epoch(&self, num_bytes: u64) -> u64

Source

pub fn get_rent(&self, num_bytes: u64, epochs: u64) -> u64

Source

pub fn get_rent_with_compression_cost(&self, num_bytes: u64, epochs: u64) -> u64

Trait Implementations§

Source§

impl BorshDeserialize for RentConfig

Source§

fn deserialize_reader<R>(reader: &mut R) -> Result<RentConfig, Error>
where R: Read,

Source§

fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>

Deserializes this instance from a given slice of bytes. Updates the buffer to point at the remaining bytes.
Source§

fn try_from_slice(v: &[u8]) -> Result<Self, Error>

Deserialize this instance from a slice of bytes.
Source§

fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>
where R: Read,

Source§

impl BorshSerialize for RentConfig

Source§

fn serialize<W>(&self, writer: &mut W) -> Result<(), Error>
where W: Write,

Source§

fn try_to_vec(&self) -> Result<Vec<u8>, Error>

Serialize this instance into a vector of bytes.
Source§

impl Clone for RentConfig

Source§

fn clone(&self) -> RentConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RentConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for RentConfig

Source§

fn default() -> RentConfig

Returns the “default value” for a type. Read more
Source§

impl Hash for RentConfig

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for RentConfig

Source§

fn eq(&self, other: &RentConfig) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl RentConfigTrait for RentConfig

Source§

fn base_rent(&self) -> u64

Get the base rent value
Source§

fn compression_cost(&self) -> u64

Get the compression cost
Source§

fn lamports_per_byte_per_epoch(&self) -> u64

Get lamports per byte per epoch
Source§

fn max_funded_epochs(&self) -> u64

Get maximum funded epochs
Source§

fn max_top_up(&self) -> u64

Get maximum top-up amount per write operation
Source§

fn rent_curve_per_epoch(&self, num_bytes: u64) -> u64

Calculate rent per epoch for a given number of bytes
Source§

fn get_rent(&self, num_bytes: u64, epochs: u64) -> u64

Calculate total rent for given bytes and epochs
Source§

fn get_rent_with_compression_cost(&self, num_bytes: u64, epochs: u64) -> u64

Calculate total rent including compression cost
Source§

impl<'a> ZeroCopyAt<'a> for RentConfig

Source§

type ZeroCopyAt = ZRentConfig<'a>

Source§

fn zero_copy_at( __remaining_bytes: &'a [u8], ) -> Result<(<RentConfig as ZeroCopyAt<'a>>::ZeroCopyAt, &'a [u8]), ZeroCopyError>

Source§

impl<'a> ZeroCopyAtMut<'a> for RentConfig

Source§

type ZeroCopyAtMut = ZRentConfigMut<'a>

Source§

fn zero_copy_at_mut( __remaining_bytes: &'a mut [u8], ) -> Result<(<RentConfig as ZeroCopyAtMut<'a>>::ZeroCopyAtMut, &'a mut [u8]), ZeroCopyError>

Source§

impl<'a> ZeroCopyNew<'a> for RentConfig

Source§

type ZeroCopyConfig = ()

Configuration type needed to initialize this type
Source§

type Output = <RentConfig as ZeroCopyAtMut<'a>>::ZeroCopyAtMut

Output type - the mutable zero-copy view of this type
Source§

fn byte_len( config: &<RentConfig as ZeroCopyNew<'a>>::ZeroCopyConfig, ) -> Result<usize, ZeroCopyError>

Calculate the byte length needed for this type with the given configuration Read more
Source§

fn new_zero_copy( __remaining_bytes: &'a mut [u8], config: <RentConfig as ZeroCopyNew<'a>>::ZeroCopyConfig, ) -> Result<(<RentConfig as ZeroCopyNew<'a>>::Output, &'a mut [u8]), ZeroCopyError>

Initialize this type in a mutable byte slice with the given configuration Read more
Source§

impl ZeroCopyStructInner for RentConfig

Source§

impl ZeroCopyStructInnerMut for RentConfig

Source§

impl Zeroable for RentConfig

Source§

fn zeroed() -> Self

Source§

impl Copy for RentConfig

Source§

impl Eq for RentConfig

Source§

impl Pod for RentConfig

Source§

impl StructuralPartialEq for RentConfig

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CheckedBitPattern for T
where T: AnyBitPattern,

Source§

type Bits = T

Self must have the same layout as the specified Bits except for the possible invalid bit patterns being checked during is_valid_bit_pattern.
Source§

fn is_valid_bit_pattern(_bits: &T) -> bool

If this function returns true, then it must be valid to reinterpret bits as &Self.
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> HashToFieldSize for T
where T: BorshSerialize,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> AnyBitPattern for T
where T: Pod,

Source§

impl<T> NoUninit for T
where T: Pod,