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 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
) -> (u64, bool)
pub fn due(
&self,
balance: u64,
data_len: usize,
years_elapsed: f64
) -> (u64, bool)
rent due on account’s data_len with balance
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
sourcepub fn deserialize<__D>(
__deserializer: __D
) -> Result<Rent, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub 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
sourcepub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub 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
pub fn get() -> Result<Rent, ProgramError>
fn size_of() -> usize
fn from_account_info(
account_info: &AccountInfo<'_>
) -> Result<Self, ProgramError>
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 + ?Sized,
impl<T> AbiEnumVisitor for T where
T: Serialize + ?Sized,
pub default fn visit_for_abi(
&self,
_digester: &mut AbiDigester
) -> Result<AbiDigester, DigestError>
sourceimpl<T> AbiEnumVisitor for T where
T: Serialize + AbiExample + ?Sized,
impl<T> AbiEnumVisitor for T where
T: Serialize + AbiExample + ?Sized,
pub 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 · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more