Struct solana_sdk::rent::Rent
source · [−]#[repr(C)]pub struct Rent {
pub lamports_per_byte_year: u64,
pub exemption_threshold: f64,
pub burn_percent: u8,
}
Fields
lamports_per_byte_year: u64
Rental rate
exemption_threshold: f64
exemption threshold, in years
burn_percent: u8
Implementations
sourceimpl Rent
impl Rent
sourcepub fn calculate_burn(&self, rent_collected: u64) -> (u64, u64)
pub fn calculate_burn(&self, rent_collected: u64) -> (u64, u64)
calculate how much rent to burn from the collected rent
sourcepub fn minimum_balance(&self, data_len: usize) -> u64
pub fn minimum_balance(&self, data_len: usize) -> u64
minimum balance due for rent-exemption of a given size Account::data.len()
Note: a stripped-down version of this calculation is used in calculate_split_rent_exempt_reserve in the stake program. When this function is updated, – eg. when making rent variable – the stake program will need to be refactored
sourcepub fn is_exempt(&self, balance: u64, data_len: usize) -> bool
pub fn is_exempt(&self, balance: u64, data_len: usize) -> bool
whether a given balance and data_len would be exempt
sourcepub fn due(&self, balance: u64, data_len: usize, years_elapsed: f64) -> RentDue
pub fn due(&self, balance: u64, data_len: usize, years_elapsed: f64) -> RentDue
rent due on account’s data_len with balance
sourcepub fn due_amount(&self, data_len: usize, years_elapsed: f64) -> u64
pub fn due_amount(&self, data_len: usize, years_elapsed: f64) -> u64
rent due for account that is known to be not exempt
pub fn free() -> Rent
pub fn with_slots_per_epoch(slots_per_epoch: u64) -> Rent
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Rent
impl<'de> Deserialize<'de> for Rent
sourcefn deserialize<__D>(
__deserializer: __D
) -> Result<Rent, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Rent, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Serialize for Rent
impl Serialize for Rent
sourcefn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
sourceimpl Sysvar for Rent
impl Sysvar for Rent
fn get() -> Result<Rent, ProgramError>
fn size_of() -> usize
sourcefn from_account_info(
account_info: &AccountInfo<'_>
) -> Result<Self, ProgramError>
fn from_account_info(
account_info: &AccountInfo<'_>
) -> Result<Self, ProgramError>
Deserializes a sysvar from its AccountInfo
. Read more
fn to_account_info(&self, account_info: &mut AccountInfo<'_>) -> Option<()>
impl Copy for Rent
impl StructuralPartialEq for Rent
Auto Trait Implementations
impl RefUnwindSafe for Rent
impl Send for Rent
impl Sync for Rent
impl Unpin for Rent
impl UnwindSafe for Rent
Blanket Implementations
sourceimpl<T> AbiEnumVisitor for T where
T: Serialize + AbiExample + ?Sized,
impl<T> AbiEnumVisitor for T where
T: Serialize + AbiExample + ?Sized,
default fn visit_for_abi(
&self,
digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
sourceimpl<T> AbiEnumVisitor for T where
T: Serialize + ?Sized,
impl<T> AbiEnumVisitor for T where
T: Serialize + ?Sized,
default fn visit_for_abi(
&self,
_digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
sourceimpl<T> AbiExample for T
impl<T> AbiExample for T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more