pub struct UnorderedSetMapper<SA, T, A = CurrentStorage>where
SA: StorageMapperApi,
A: StorageAddress<SA>,
T: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static,{ /* private fields */ }
Implementations§
Source§impl<SA, T, A> UnorderedSetMapper<SA, T, A>where
SA: StorageMapperApi,
A: StorageAddress<SA>,
T: TopEncode + TopDecode + NestedEncode + NestedDecode,
impl<SA, T, A> UnorderedSetMapper<SA, T, A>where
SA: StorageMapperApi,
A: StorageAddress<SA>,
T: TopEncode + TopDecode + NestedEncode + NestedDecode,
Source§impl<SA, T> UnorderedSetMapper<SA, T>
impl<SA, T> UnorderedSetMapper<SA, T>
Sourcepub fn insert(&mut self, value: T) -> bool
pub fn insert(&mut self, value: T) -> bool
Adds a value to the set.
If the set did not have this value present, true
is returned.
If the set did have this value present, false
is returned.
Sourcepub fn swap_remove(&mut self, value: &T) -> bool
pub fn swap_remove(&mut self, value: &T) -> bool
Removes a value from the set. Returns whether the value was present in the set.
Sourcepub fn swap_indexes(&mut self, index1: usize, index2: usize) -> bool
pub fn swap_indexes(&mut self, index1: usize, index2: usize) -> bool
Exchanges the indexes of two values. Returns whether the operation was successful.
Trait Implementations§
Source§impl<SA, T> Extend<T> for UnorderedSetMapper<SA, T>
impl<SA, T> Extend<T> for UnorderedSetMapper<SA, T>
Source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<'a, SA, T, A> IntoIterator for &'a UnorderedSetMapper<SA, T, A>where
SA: StorageMapperApi,
A: StorageAddress<SA>,
T: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static,
impl<'a, SA, T, A> IntoIterator for &'a UnorderedSetMapper<SA, T, A>where
SA: StorageMapperApi,
A: StorageAddress<SA>,
T: TopEncode + TopDecode + NestedEncode + NestedDecode + 'static,
Source§impl<SA, T> StorageClearable for UnorderedSetMapper<SA, T>
impl<SA, T> StorageClearable for UnorderedSetMapper<SA, T>
Source§impl<SA, T> StorageMapper<SA> for UnorderedSetMapper<SA, T>
impl<SA, T> StorageMapper<SA> for UnorderedSetMapper<SA, T>
Source§fn new(base_key: StorageKey<SA>) -> UnorderedSetMapper<SA, T>
fn new(base_key: StorageKey<SA>) -> UnorderedSetMapper<SA, T>
Will be called automatically by the
#[storage_mapper]
annotation generated code.Source§impl<SA, T> StorageMapperFromAddress<SA> for UnorderedSetMapper<SA, T, ManagedAddress<SA>>
impl<SA, T> StorageMapperFromAddress<SA> for UnorderedSetMapper<SA, T, ManagedAddress<SA>>
Source§fn new_from_address(
address: ManagedAddress<SA>,
base_key: StorageKey<SA>,
) -> UnorderedSetMapper<SA, T, ManagedAddress<SA>>
fn new_from_address( address: ManagedAddress<SA>, base_key: StorageKey<SA>, ) -> UnorderedSetMapper<SA, T, ManagedAddress<SA>>
Will be called automatically by the
#[storage_mapper_from_address]
annotation generated code.Source§impl<SA, T> TopEncodeMulti for UnorderedSetMapper<SA, T>
Behaves like a MultiResultVec when an endpoint result.
impl<SA, T> TopEncodeMulti for UnorderedSetMapper<SA, T>
Behaves like a MultiResultVec when an endpoint result.
Source§fn multi_encode_or_handle_err<O, H>(
&self,
output: &mut O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeMultiOutput,
H: EncodeErrorHandler,
fn multi_encode_or_handle_err<O, H>(
&self,
output: &mut O,
h: H,
) -> Result<(), <H as EncodeErrorHandler>::HandledErr>where
O: TopEncodeMultiOutput,
H: EncodeErrorHandler,
Version of
top_encode
that can handle errors as soon as they occur.
For instance in can exit immediately and make sure that if it returns, it is a success.
By not deferring error handling, this can lead to somewhat smaller bytecode.Source§fn multi_encode<O>(&self, output: &mut O) -> Result<(), EncodeError>where
O: TopEncodeMultiOutput,
fn multi_encode<O>(&self, output: &mut O) -> Result<(), EncodeError>where
O: TopEncodeMultiOutput,
Attempt to serialize the value to ouput.
Source§impl<SA, T> TypeAbi for UnorderedSetMapper<SA, T>
Behaves like a MultiResultVec when an endpoint result.
impl<SA, T> TypeAbi for UnorderedSetMapper<SA, T>
Behaves like a MultiResultVec when an endpoint result.
type Unmanaged = UnorderedSetMapper<SA, T>
fn type_name() -> String
fn type_name_rust() -> String
Source§fn provide_type_descriptions<TDC>(accumulator: &mut TDC)where
TDC: TypeDescriptionContainer,
fn provide_type_descriptions<TDC>(accumulator: &mut TDC)where
TDC: TypeDescriptionContainer,
A type can provide more than its own name.
For instance, a struct can also provide the descriptions of the type of its fields.
TypeAbi doesn’t care for the exact accumulator type,
which is abstracted by the TypeDescriptionContainer trait.
fn type_names() -> TypeNames
impl<SA, T> TypeAbiFrom<UnorderedSetMapper<SA, T>> for MultiValueEncoded<SA, T>
impl<SA, T> TypeAbiFrom<UnorderedSetMapper<SA, T>> for UnorderedSetMapper<SA, T>
Auto Trait Implementations§
impl<SA, T, A> Freeze for UnorderedSetMapper<SA, T, A>
impl<SA, T, A> RefUnwindSafe for UnorderedSetMapper<SA, T, A>where
A: RefUnwindSafe,
SA: RefUnwindSafe,
<SA as HandleTypeInfo>::ManagedBufferHandle: RefUnwindSafe,
T: RefUnwindSafe,
impl<SA, T, A> Send for UnorderedSetMapper<SA, T, A>
impl<SA, T, A> Sync for UnorderedSetMapper<SA, T, A>
impl<SA, T, A> Unpin for UnorderedSetMapper<SA, T, A>
impl<SA, T, A> UnwindSafe for UnorderedSetMapper<SA, T, A>where
A: UnwindSafe,
SA: UnwindSafe,
<SA as HandleTypeInfo>::ManagedBufferHandle: UnwindSafe,
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> InterpretableFrom<T> for T
impl<T> InterpretableFrom<T> for T
fn interpret_from(from: T, _context: &InterpreterContext) -> T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more