pub struct IdFactory<T> { /* private fields */ }
Expand description
A helper for constructing id types like FunctionId
.
For ids that may be re-used, see IdFactoryWithReuse
.
Implementations§
Source§impl<T> IdFactory<T>
impl<T> IdFactory<T>
Sourcepub const fn new_const(start: NonZeroU64, max: NonZeroU64) -> Self
pub const fn new_const(start: NonZeroU64, max: NonZeroU64) -> Self
Create a factory for ids in the range start..=max
.
Provides a less convenient API than IdFactory::new
, but skips a type conversion that
would make the function non-const.
Source§impl<T> IdFactory<T>where
T: TryFrom<NonZeroU64>,
impl<T> IdFactory<T>where
T: TryFrom<NonZeroU64>,
Sourcepub fn wrapping_get(&self) -> T
pub fn wrapping_get(&self) -> T
Returns an id, potentially allowing an overflow. This may cause ids to be silently re-used.
Used for crate::id::ExecutionId
.
If id re-use is desired only for “freed” ids, use IdFactoryWithReuse
instead.
Auto Trait Implementations§
impl<T> !Freeze for IdFactory<T>
impl<T> RefUnwindSafe for IdFactory<T>where
T: RefUnwindSafe,
impl<T> Send for IdFactory<T>where
T: Send,
impl<T> Sync for IdFactory<T>where
T: Sync,
impl<T> Unpin for IdFactory<T>where
T: Unpin,
impl<T> UnwindSafe for IdFactory<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> Any for Twhere
T: Any,
impl<T> Any for Twhere
T: Any,
fn get_type_id(&self) -> TypeId
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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