#[repr(transparent)]pub struct StaticCollect<T>(pub T);
Expand description
A wrapper type that implements Collect whenever the contained T is ’static, which is useful in generic contexts
Tuple Fields§
§0: T
Trait Implementations§
Source§impl<T> AsMut<T> for StaticCollect<T>
impl<T> AsMut<T> for StaticCollect<T>
Source§impl<T> AsRef<T> for StaticCollect<T>
impl<T> AsRef<T> for StaticCollect<T>
Source§impl<T> Borrow<T> for StaticCollect<T>
impl<T> Borrow<T> for StaticCollect<T>
Source§impl<T> BorrowMut<T> for StaticCollect<T>
impl<T> BorrowMut<T> for StaticCollect<T>
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> Clone for StaticCollect<T>where
T: Clone,
impl<T> Clone for StaticCollect<T>where
T: Clone,
Source§fn clone(&self) -> StaticCollect<T>
fn clone(&self) -> StaticCollect<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T> Collect for StaticCollect<T>where
T: 'static,
impl<T> Collect for StaticCollect<T>where
T: 'static,
Source§fn needs_trace() -> bool
fn needs_trace() -> bool
As an optimization, if this type can never hold a
Gc
pointer and trace
is unnecessary
to call, you may implement this method and return false. The default implementation returns
true, signaling that Collect::trace
must be called.Source§fn trace(&self, _cc: &Collection)
fn trace(&self, _cc: &Collection)
Must call
Collect::trace
on all held Gc
pointers. If this type holds inner types that
implement Collect
, a valid implementation would simply call Collect::trace
on all the
held values to ensure this.Source§impl<T> Debug for StaticCollect<T>where
T: Debug,
impl<T> Debug for StaticCollect<T>where
T: Debug,
Source§impl<T> Default for StaticCollect<T>where
T: Default,
impl<T> Default for StaticCollect<T>where
T: Default,
Source§fn default() -> StaticCollect<T>
fn default() -> StaticCollect<T>
Returns the “default value” for a type. Read more
Source§impl<T> Deref for StaticCollect<T>
impl<T> Deref for StaticCollect<T>
Source§impl<T> DerefMut for StaticCollect<T>
impl<T> DerefMut for StaticCollect<T>
Source§impl<T> From<T> for StaticCollect<T>
impl<T> From<T> for StaticCollect<T>
Source§fn from(value: T) -> StaticCollect<T>
fn from(value: T) -> StaticCollect<T>
Converts to this type from the input type.
Source§impl<T> Hash for StaticCollect<T>where
T: Hash,
impl<T> Hash for StaticCollect<T>where
T: Hash,
Source§impl<T> Ord for StaticCollect<T>where
T: Ord,
impl<T> Ord for StaticCollect<T>where
T: Ord,
Source§fn cmp(&self, other: &StaticCollect<T>) -> Ordering
fn cmp(&self, other: &StaticCollect<T>) -> 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<T> PartialEq for StaticCollect<T>where
T: PartialEq,
impl<T> PartialEq for StaticCollect<T>where
T: PartialEq,
Source§impl<T> PartialOrd for StaticCollect<T>where
T: PartialOrd,
impl<T> PartialOrd for StaticCollect<T>where
T: PartialOrd,
impl<T> Copy for StaticCollect<T>where
T: Copy,
impl<T> Eq for StaticCollect<T>where
T: Eq,
impl<T> StructuralPartialEq for StaticCollect<T>
Auto Trait Implementations§
impl<T> Freeze for StaticCollect<T>where
T: Freeze,
impl<T> RefUnwindSafe for StaticCollect<T>where
T: RefUnwindSafe,
impl<T> Send for StaticCollect<T>where
T: Send,
impl<T> Sync for StaticCollect<T>where
T: Sync,
impl<T> Unpin for StaticCollect<T>where
T: Unpin,
impl<T> UnwindSafe for StaticCollect<T>where
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
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
.