pub struct ContainerBase<S>where
S: RawContainer,{ /* private fields */ }
Expand description
the ContainerBase
type materializes the RawContainer
trait, providing a physical
implementation of a generic container type
Implementations§
Source§impl<A, S> ContainerBase<S>where
S: RawContainer<Item = A>,
impl<A, S> ContainerBase<S>where
S: RawContainer<Item = A>,
Sourcepub const fn from_store(store: S) -> Self
pub const fn from_store(store: S) -> Self
returns a new instance using the given store
Sourcepub const fn store_mut(&mut self) -> &mut S
pub const fn store_mut(&mut self) -> &mut S
returns a mutable reference to the underlying store
Sourcepub const fn replace_store(&mut self, store: S) -> S
pub const fn replace_store(&mut self, store: S) -> S
replace
the store with another and return the previous value
Sourcepub fn set_store(&mut self, store: S) -> &mut Self
pub fn set_store(&mut self, store: S) -> &mut Self
set the current store and return a mutable reference to the container
Sourcepub const fn swap_store(&mut self, store: &mut S) -> &mut Self
pub const fn swap_store(&mut self, store: &mut S) -> &mut Self
swap
the store another and return a mutable reference to the
container
Sourcepub fn take_store(&mut self) -> Swhere
S: Default,
pub fn take_store(&mut self) -> Swhere
S: Default,
take
the store and return it, leaving the logical default in its
place
Sourcepub fn with_store<T: RawContainer<Item = A>>(self, repr: T) -> ContainerBase<T>
pub fn with_store<T: RawContainer<Item = A>>(self, repr: T) -> ContainerBase<T>
consumes the current instance to create another with the given store
Trait Implementations§
Source§impl<S> AsMut<S> for ContainerBase<S>where
S: RawContainer,
impl<S> AsMut<S> for ContainerBase<S>where
S: RawContainer,
Source§impl<S> AsRef<S> for ContainerBase<S>where
S: RawContainer,
impl<S> AsRef<S> for ContainerBase<S>where
S: RawContainer,
Source§impl<S> Borrow<S> for ContainerBase<S>where
S: RawContainer,
impl<S> Borrow<S> for ContainerBase<S>where
S: RawContainer,
Source§impl<S> BorrowMut<S> for ContainerBase<S>where
S: RawContainer,
impl<S> BorrowMut<S> for ContainerBase<S>where
S: RawContainer,
Source§fn borrow_mut(&mut self) -> &mut S
fn borrow_mut(&mut self) -> &mut S
Mutably borrows from an owned value. Read more
Source§impl<S> Clone for ContainerBase<S>
impl<S> Clone for ContainerBase<S>
Source§fn clone(&self) -> ContainerBase<S>
fn clone(&self) -> ContainerBase<S>
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<S> Debug for ContainerBase<S>
impl<S> Debug for ContainerBase<S>
Source§impl<S> Default for ContainerBase<S>
impl<S> Default for ContainerBase<S>
Source§fn default() -> ContainerBase<S>
fn default() -> ContainerBase<S>
Returns the “default value” for a type. Read more
Source§impl<S> Deref for ContainerBase<S>where
S: RawContainer,
impl<S> Deref for ContainerBase<S>where
S: RawContainer,
Source§impl<S> DerefMut for ContainerBase<S>where
S: RawContainer,
impl<S> DerefMut for ContainerBase<S>where
S: RawContainer,
Source§impl<'de, S> Deserialize<'de> for ContainerBase<S>where
S: RawContainer + Deserialize<'de>,
impl<'de, S> Deserialize<'de> for ContainerBase<S>where
S: RawContainer + Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<S> Hash for ContainerBase<S>
impl<S> Hash for ContainerBase<S>
Source§impl<A, I, S> Index<I> for ContainerBase<S>where
S: RawContainer<Item = A> + Index<I, Output = A>,
impl<A, I, S> Index<I> for ContainerBase<S>where
S: RawContainer<Item = A> + Index<I, Output = A>,
Source§impl<A, I, S> IndexMut<I> for ContainerBase<S>where
S: RawContainer<Item = A> + IndexMut<I, Output = A>,
impl<A, I, S> IndexMut<I> for ContainerBase<S>where
S: RawContainer<Item = A> + IndexMut<I, Output = A>,
Source§impl<'a, A, S> IntoIterator for &'a ContainerBase<S>
impl<'a, A, S> IntoIterator for &'a ContainerBase<S>
Source§impl<'a, A, S> IntoIterator for &'a mut ContainerBase<S>
impl<'a, A, S> IntoIterator for &'a mut ContainerBase<S>
Source§impl<A, S> IntoIterator for ContainerBase<S>where
S: RawContainer<Item = A> + IntoIterator<Item = A>,
impl<A, S> IntoIterator for ContainerBase<S>where
S: RawContainer<Item = A> + IntoIterator<Item = A>,
Source§impl<S> Ord for ContainerBase<S>
impl<S> Ord for ContainerBase<S>
Source§fn cmp(&self, other: &ContainerBase<S>) -> Ordering
fn cmp(&self, other: &ContainerBase<S>) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<S> PartialEq for ContainerBase<S>
impl<S> PartialEq for ContainerBase<S>
Source§impl<S> PartialOrd for ContainerBase<S>
impl<S> PartialOrd for ContainerBase<S>
Source§impl<S> Serialize for ContainerBase<S>where
S: RawContainer + Serialize,
impl<S> Serialize for ContainerBase<S>where
S: RawContainer + Serialize,
impl<S> Copy for ContainerBase<S>
impl<S> Eq for ContainerBase<S>
impl<S> StructuralPartialEq for ContainerBase<S>where
S: RawContainer,
Auto Trait Implementations§
impl<S> Freeze for ContainerBase<S>where
S: Freeze,
impl<S> RefUnwindSafe for ContainerBase<S>
impl<S> Send for ContainerBase<S>
impl<S> Sync for ContainerBase<S>
impl<S> Unpin for ContainerBase<S>
impl<S> UnwindSafe for ContainerBase<S>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
impl<K, S> Identity<K> for Swhere
S: Borrow<K>,
K: Identifier,
Source§impl<R> Rng for R
impl<R> Rng for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
Return a random value via the
StandardUniform
distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Generate a random value in the given range. Read more
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
Return a bool with a probability
p
of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
Return a bool with a probability of
numerator/denominator
of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
fn sample<T, D>(&mut self, distr: D) -> Twhere
D: Distribution<T>,
Sample a new value, using the given distribution. Read more
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
D: Distribution<T>,
Self: Sized,
Create an iterator that generates values using the given distribution. Read more
Source§fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn gen<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
👎Deprecated since 0.9.0: Renamed to
random
to avoid conflict with the new gen
keyword in Rust 2024.Alias for
Rng::random
.Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn gen_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
👎Deprecated since 0.9.0: Renamed to
random_range
Alias for
Rng::random_range
.Source§impl<R> TryRngCore for R
impl<R> TryRngCore for R
Source§type Error = Infallible
type Error = Infallible
The type returned in the event of a RNG error.
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
Return the next random
u32
.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
Return the next random
u64
.Source§fn try_fill_bytes(
&mut self,
dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
Fill
dest
entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
Wrap RNG with the
UnwrapMut
wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
Self: Sized,
Convert an
RngCore
to a RngReadAdapter
.