#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]
#![cfg_attr(docsrs, feature(doc_cfg))]
#[cfg(feature = "frozen-abi")]
use solana_frozen_abi_macro::{frozen_abi, AbiExample, StableAbi, StableAbiSample};
use {solana_clock::Epoch, solana_pubkey::Pubkey, std::sync::Arc};
mod account;
pub use account::*;
#[cfg(feature = "serde")]
mod serde;
#[cfg(any(feature = "bincode", feature = "wincode"))]
pub mod state_traits;
#[cfg(feature = "wincode")]
const WINCODE_PREALLOC_LIMIT: usize = 10 * 1024 * 1024;
#[cfg(all(test, feature = "wincode"))]
const _: () =
assert!(WINCODE_PREALLOC_LIMIT as u64 == solana_system_interface::MAX_PERMITTED_DATA_LENGTH);
#[cfg(feature = "wincode")]
pub(crate) type WincodeConfig = wincode::config::Configuration<true, WINCODE_PREALLOC_LIMIT>;
#[cfg(feature = "wincode")]
pub(crate) const WINCODE_CONFIG: WincodeConfig = wincode::config::Configuration::default()
.with_preallocation_size_limit::<WINCODE_PREALLOC_LIMIT>(
);
#[repr(C)]
#[cfg_attr(
feature = "frozen-abi",
derive(AbiExample, StableAbi, StableAbiSample),
frozen_abi(
api_digest = "62EqVoynUFvuui7DVfqWCvZP7bxKGJGioeSBnWrdjRME",
abi_digest = "G4phLpfhujMpk4wS1WswCe4HqnQjCBPWjrXjvDZ6iUw8"
)
)]
#[cfg_attr(
feature = "serde",
derive(serde_derive::Deserialize),
serde(rename_all = "camelCase")
)]
#[cfg_attr(feature = "wincode", derive(wincode::SchemaRead, wincode::SchemaWrite))]
#[derive(PartialEq, Eq, Clone, Default)]
pub struct Account {
pub lamports: u64,
#[cfg_attr(feature = "serde", serde(with = "serde_bytes"))]
#[cfg_attr(
feature = "frozen-abi",
stable_abi_sample(
with = "(0..rng.random_range(0..=1000)).map(|_| rng.random()).collect()"
)
)]
pub data: Vec<u8>,
pub owner: Pubkey,
pub executable: bool,
pub rent_epoch: Epoch,
}
#[cfg_attr(feature = "frozen-abi", derive(AbiExample, StableAbi, StableAbiSample))]
#[cfg_attr(
feature = "serde",
derive(serde_derive::Deserialize),
serde(from = "Account")
)]
#[cfg_attr(feature = "wincode", derive(wincode::SchemaRead, wincode::SchemaWrite))]
#[derive(PartialEq, Eq, Clone, Default)]
pub struct AccountSharedData {
lamports: u64,
data: Arc<Vec<u8>>,
owner: Pubkey,
executable: bool,
rent_epoch: Epoch,
}