Struct sugar_cli::sign::process::Account

pub struct Account {
    pub lamports: u64,
    pub data: Vec<u8, Global>,
    pub owner: Pubkey,
    pub executable: bool,
    pub rent_epoch: u64,
}
Expand description

An Account with data that is stored on chain

Fields§

§lamports: u64

lamports in the account

§data: Vec<u8, Global>

data held in this account

§owner: Pubkey

the program that owns this account. If executable, the program that loads this account.

§executable: bool

this account’s data contains a loaded program (and is now read-only)

§rent_epoch: u64

the epoch at which this account will next owe rent

Implementations§

§

impl Account

pub fn new(lamports: u64, space: usize, owner: &Pubkey) -> Account

pub fn new_ref( lamports: u64, space: usize, owner: &Pubkey ) -> Rc<RefCell<Account>>

pub fn new_data<T>( lamports: u64, state: &T, owner: &Pubkey ) -> Result<Account, Box<ErrorKind, Global>>where T: Serialize,

pub fn new_ref_data<T>( lamports: u64, state: &T, owner: &Pubkey ) -> Result<RefCell<Account>, Box<ErrorKind, Global>>where T: Serialize,

pub fn new_data_with_space<T>( lamports: u64, state: &T, space: usize, owner: &Pubkey ) -> Result<Account, Box<ErrorKind, Global>>where T: Serialize,

pub fn new_ref_data_with_space<T>( lamports: u64, state: &T, space: usize, owner: &Pubkey ) -> Result<RefCell<Account>, Box<ErrorKind, Global>>where T: Serialize,

pub fn new_rent_epoch( lamports: u64, space: usize, owner: &Pubkey, rent_epoch: u64 ) -> Account

pub fn deserialize_data<T>(&self) -> Result<T, Box<ErrorKind, Global>>where T: DeserializeOwned,

pub fn serialize_data<T>( &mut self, state: &T ) -> Result<(), Box<ErrorKind, Global>>where T: Serialize,

Trait Implementations§

§

impl AbiExample for Account

§

impl Account for Account

Return the information required to construct an AccountInfo. Used by the AccountInfo conversion implementations.

§

fn get(&mut self) -> (&mut u64, &mut [u8], &Pubkey, bool, u64)

§

impl Clone for Account

§

fn clone(&self) -> Account

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
§

impl Debug for Account

§

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

Formats the value using the given formatter. Read more
§

impl Default for Account

§

fn default() -> Account

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

impl<'de> Deserialize<'de> for Account

§

fn deserialize<__D>( __deserializer: __D ) -> Result<Account, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
§

impl From<AccountSharedData> for Account

§

fn from(other: AccountSharedData) -> Account

Converts to this type from the input type.
§

impl PartialEq<Account> for Account

§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

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

impl ReadableAccount for Account

§

fn lamports(&self) -> u64

§

fn data(&self) -> &[u8]

§

fn owner(&self) -> &Pubkey

§

fn executable(&self) -> bool

§

fn rent_epoch(&self) -> u64

§

fn to_account_shared_data(&self) -> AccountSharedData

§

impl Serialize for Account

§

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
§

impl<T> StateMut<T> for Accountwhere T: Serialize + DeserializeOwned,

§

fn state(&self) -> Result<T, InstructionError>

§

fn set_state(&mut self, state: &T) -> Result<(), InstructionError>

§

impl WritableAccount for Account

§

fn set_lamports(&mut self, lamports: u64)

§

fn data_mut(&mut self) -> &mut Vec<u8, Global>

§

fn data_as_mut_slice(&mut self) -> &mut [u8]

§

fn set_owner(&mut self, owner: Pubkey)

§

fn copy_into_owner_from_slice(&mut self, source: &[u8])

§

fn set_executable(&mut self, executable: bool)

§

fn set_rent_epoch(&mut self, epoch: u64)

§

fn create( lamports: u64, data: Vec<u8, Global>, owner: Pubkey, executable: bool, rent_epoch: u64 ) -> Account

§

fn checked_add_lamports(&mut self, lamports: u64) -> Result<(), LamportsError>

§

fn checked_sub_lamports(&mut self, lamports: u64) -> Result<(), LamportsError>

§

fn saturating_add_lamports(&mut self, lamports: u64)

§

fn saturating_sub_lamports(&mut self, lamports: u64)

§

impl Eq for Account

§

impl StructuralEq for Account

§

impl StructuralPartialEq for Account

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> AbiEnumVisitor for Twhere T: Serialize + ?Sized,

§

default fn visit_for_abi( &self, _digester: &mut AbiDigester ) -> Result<AbiDigester, DigestError>

§

impl<T> AbiEnumVisitor for Twhere T: Serialize + AbiExample + ?Sized,

§

default fn visit_for_abi( &self, digester: &mut AbiDigester ) -> Result<AbiDigester, DigestError>

§

impl<T> AbiExample for T

§

default fn example() -> T

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32 ) -> TaggedParser<'a, Implicit, Self, E>

source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

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

const: unstable · 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,