Skip to main content

IndexedMapRef

Struct IndexedMapRef 

Source
pub struct IndexedMapRef<'a, K, T, I> { /* private fields */ }

Implementations§

Source§

impl<'a, K, T, I> IndexedMapRef<'a, K, T, I>

Source

pub const fn new(pk_namespace: &'a str, indexes: &'a I) -> Self

Source§

impl<'a, K, T, I> IndexedMapRef<'a, K, T, I>
where K: PrimaryKey<'a>, T: Serialize + DeserializeOwned + Clone, I: IndexList<T>,

Source

pub fn key(&self, k: K) -> Path<T>

Source

pub fn save(&self, store: &mut dyn Storage, key: K, data: &T) -> StdResult<()>

Source

pub fn remove(&self, store: &mut dyn Storage, key: K) -> StdResult<()>

Source

pub fn replace( &self, store: &mut dyn Storage, key: K, data: Option<&T>, old_data: Option<&T>, ) -> StdResult<()>

Source

pub fn update<A, E>( &self, store: &mut dyn Storage, key: K, action: A, ) -> Result<T, E>
where A: FnOnce(Option<T>) -> Result<T, E>, E: From<StdError>,

Source

pub fn load(&self, store: &dyn Storage, key: K) -> StdResult<T>

Source

pub fn may_load(&self, store: &dyn Storage, key: K) -> StdResult<Option<T>>

Source

pub fn prefix(&self, p: K::Prefix) -> Prefix<T>

Source

pub fn sub_prefix(&self, p: K::SubPrefix) -> Prefix<T>

Auto Trait Implementations§

§

impl<'a, K, T, I> Freeze for IndexedMapRef<'a, K, T, I>

§

impl<'a, K, T, I> RefUnwindSafe for IndexedMapRef<'a, K, T, I>

§

impl<'a, K, T, I> Send for IndexedMapRef<'a, K, T, I>
where I: Sync, K: Send, T: Send,

§

impl<'a, K, T, I> Sync for IndexedMapRef<'a, K, T, I>
where I: Sync, K: Sync, T: Sync,

§

impl<'a, K, T, I> Unpin for IndexedMapRef<'a, K, T, I>
where K: Unpin, T: Unpin,

§

impl<'a, K, T, I> UnsafeUnpin for IndexedMapRef<'a, K, T, I>

§

impl<'a, K, T, I> UnwindSafe for IndexedMapRef<'a, K, T, I>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

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.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.