[−][src]Struct eosio_cdt::SingletonIndex
TODO docs
Methods
impl<T: Table> SingletonIndex<T>
[src]
pub fn new<C, S>(code: C, scope: S) -> Self where
C: Into<AccountName>,
S: Into<ScopeName>,
[src]
C: Into<AccountName>,
S: Into<ScopeName>,
TODO docs
#[must_use]
pub fn exists(&self) -> bool
[src]
Checks if the singleton entry exists
#[must_use]
pub fn get(&self) -> Option<Result<T::Row, ReadError>>
[src]
Gets the value stored inside the singleton. Returns None
if no value
is found, or ReadError
if there was an issue reading the data.
pub fn get_or_default(&self) -> Result<T::Row, ReadError> where
T::Row: Default,
[src]
T::Row: Default,
Gets the value stored inside the singleton or returns the default value.
Errors
Will return Err
if there was an issue deserializing the stored value.
pub fn set(&self, value: &T::Row, payer: AccountName) -> Result<(), WriteError>
[src]
pub fn remove(&self) -> Result<Option<T::Row>, ReadError>
[src]
Removes the singleton value if it exists. Returns ReadError
if there
was an issue reading the data, and None if there was no entry found
Errors
Will return Err
if there was an issue reading the stored value.
Auto Trait Implementations
impl<T> Send for SingletonIndex<T> where
T: Send,
T: Send,
impl<T> Sync for SingletonIndex<T> where
T: Sync,
T: Sync,
impl<T> Unpin for SingletonIndex<T> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,