pub struct Assets(/* private fields */);Expand description
A Vec of Assets.
There are a number of invariants which the construction and mutation functions must ensure are maintained:
- It may contain no items of duplicate asset class;
- All items must be ordered;
- The number of items should grow no larger than
MAX_ITEMS_IN_ASSETS.
Implementations§
Source§impl Assets
impl Assets
Sourcepub fn from_sorted_and_deduplicated(r: Vec<Asset>) -> Result<Assets, ()>
pub fn from_sorted_and_deduplicated(r: Vec<Asset>) -> Result<Assets, ()>
Create a new instance of Assets from a Vec<Asset> whose contents are sorted
and which contain no duplicates.
Returns Ok if the operation succeeds and Err if r is out of order or had duplicates.
If you can’t guarantee that r is sorted and deduplicated, then use
From::<Vec<Asset>>::from which is infallible.
Sourcepub fn from_sorted_and_deduplicated_skip_checks(r: Vec<Asset>) -> Assets
pub fn from_sorted_and_deduplicated_skip_checks(r: Vec<Asset>) -> Assets
Create a new instance of Assets from a Vec<Asset> whose contents are sorted
and which contain no duplicates.
In release mode, this skips any checks to ensure that r is correct, making it a
negligible-cost operation. Generally though you should avoid using it unless you have a
strict proof that r is valid.
In test mode, this checks anyway and panics on fail.
Sourcepub fn push(&mut self, a: Asset)
pub fn push(&mut self, a: Asset)
Add some asset onto the list, saturating. This is quite a laborious operation since it maintains the ordering.
Sourcepub fn contains(&self, inner: &Asset) -> bool
pub fn contains(&self, inner: &Asset) -> bool
Returns true if self is a super-set of the given inner asset.
Sourcepub fn drain(self) -> Vec<Asset>
👎Deprecated: Use into_inner() instead
pub fn drain(self) -> Vec<Asset>
into_inner() insteadConsume self and return the inner vec.
Sourcepub fn into_inner(self) -> Vec<Asset>
pub fn into_inner(self) -> Vec<Asset>
Consume self and return the inner vec.
Trait Implementations§
Source§impl Decode for Assets
impl Decode for Assets
Source§fn decode<I>(input: &mut I) -> Result<Assets, Error>where
I: Input,
fn decode<I>(input: &mut I) -> Result<Assets, Error>where
I: Input,
Source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>,
) -> Result<DecodeFinished, Error>where
I: Input,
Source§impl<'de> Deserialize<'de> for Assets
impl<'de> Deserialize<'de> for Assets
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Assets, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Assets, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Encode for Assets
impl Encode for Assets
Source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
Source§fn encode_to<__CodecOutputEdqy>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy,
)
fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy, )
Source§fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback>(
&self,
f: __CodecUsingEncodedCallback,
) -> __CodecOutputReturn
fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback>( &self, f: __CodecUsingEncodedCallback, ) -> __CodecOutputReturn
Source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Source§impl MaxEncodedLen for Assets
impl MaxEncodedLen for Assets
Source§fn max_encoded_len() -> usize
fn max_encoded_len() -> usize
Source§impl Ord for Assets
impl Ord for Assets
Source§impl PartialOrd for Assets
impl PartialOrd for Assets
Source§impl Reanchorable for Assets
impl Reanchorable for Assets
Source§impl Serialize for Assets
impl Serialize for Assets
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Source§impl TryFrom<MultiAssets> for Assets
impl TryFrom<MultiAssets> for Assets
Source§impl TryFrom<VersionedAssets> for Assets
impl TryFrom<VersionedAssets> for Assets
impl EncodeLike for Assets
impl Eq for Assets
impl StructuralPartialEq for Assets
Auto Trait Implementations§
impl Freeze for Assets
impl RefUnwindSafe for Assets
impl Send for Assets
impl Sync for Assets
impl Unpin for Assets
impl UnwindSafe for Assets
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
Source§impl<T> CheckedConversion for T
impl<T> CheckedConversion for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere
T: Decode,
Source§impl<T> DefensiveMax<T> for Twhere
T: PartialOrd,
impl<T> DefensiveMax<T> for Twhere
T: PartialOrd,
Source§fn defensive_max(self, other: T) -> T
fn defensive_max(self, other: T) -> T
Source§fn defensive_strict_max(self, other: T) -> T
fn defensive_strict_max(self, other: T) -> T
Source§impl<T> DefensiveMin<T> for Twhere
T: PartialOrd,
impl<T> DefensiveMin<T> for Twhere
T: PartialOrd,
Source§fn defensive_min(self, other: T) -> T
fn defensive_min(self, other: T) -> T
Source§fn defensive_strict_min(self, other: T) -> T
fn defensive_strict_min(self, other: T) -> T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 moreSource§impl<T, Outer> IsWrappedBy<Outer> for T
impl<T, Outer> IsWrappedBy<Outer> for T
Source§impl<T> SaturatedConversion for T
impl<T> SaturatedConversion for T
Source§fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
fn saturated_from<T>(t: T) -> Selfwhere
Self: UniqueSaturatedFrom<T>,
Source§fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
fn saturated_into<T>(self) -> Twhere
Self: UniqueSaturatedInto<T>,
T. Read moreSource§impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
impl<T, U> TryIntoKey<U> for Twhere
U: TryFromKey<T>,
type Error = <U as TryFromKey<T>>::Error
fn try_into_key(self) -> Result<U, <U as TryFromKey<T>>::Error>
Source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
Source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from.Source§impl<T, S> UniqueSaturatedInto<T> for S
impl<T, S> UniqueSaturatedInto<T> for S
Source§fn unique_saturated_into(self) -> T
fn unique_saturated_into(self) -> T
T.