pub struct IterationCount(/* private fields */);Expand description
A strictly positive iteration count.
Wraps a NonZeroU32 to guarantee that iteration-count parameters (like
max_iter) are always at least 1. This prevents no-ops that finish without an
error from passing zero iterations to algorithm functions.
§Construction
use cugraph::params::IterationCount;
// From a runtime value (fallible):
let count = IterationCount::new(500).unwrap();
assert_eq!(count.get(), 500);
// TryFrom conversions:
let count: IterationCount = 100u32.try_into().unwrap();
let count: IterationCount = 100i32.try_into().unwrap();
let count: IterationCount = 100usize.try_into().unwrap();Implementations§
Source§impl IterationCount
impl IterationCount
Sourcepub const fn from_non_zero(value: NonZeroU32) -> Self
pub const fn from_non_zero(value: NonZeroU32) -> Self
Create a new IterationCount from a NonZeroU32 (infallible).
Sourcepub const fn into_inner(self) -> NonZeroU32
pub const fn into_inner(self) -> NonZeroU32
Get the underlying NonZeroU32.
Trait Implementations§
Source§impl Clone for IterationCount
impl Clone for IterationCount
impl Copy for IterationCount
Source§impl Debug for IterationCount
impl Debug for IterationCount
Source§impl Display for IterationCount
impl Display for IterationCount
impl Eq for IterationCount
Source§impl From<IterationCount> for u32
impl From<IterationCount> for u32
Source§fn from(count: IterationCount) -> u32
fn from(count: IterationCount) -> u32
Converts to this type from the input type.
Source§impl From<IterationCount> for usize
impl From<IterationCount> for usize
Source§fn from(count: IterationCount) -> usize
fn from(count: IterationCount) -> usize
Converts to this type from the input type.
Source§impl Hash for IterationCount
impl Hash for IterationCount
Source§impl Ord for IterationCount
impl Ord for IterationCount
1.21.0 (const: unstable) · 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for IterationCount
impl PartialEq for IterationCount
Source§impl PartialOrd for IterationCount
impl PartialOrd for IterationCount
impl StructuralPartialEq for IterationCount
Source§impl TryFrom<IterationCount> for i32
impl TryFrom<IterationCount> for i32
Source§impl TryFrom<i32> for IterationCount
impl TryFrom<i32> for IterationCount
Source§impl TryFrom<u32> for IterationCount
impl TryFrom<u32> for IterationCount
Auto Trait Implementations§
impl Freeze for IterationCount
impl RefUnwindSafe for IterationCount
impl Send for IterationCount
impl Sync for IterationCount
impl Unpin for IterationCount
impl UnsafeUnpin for IterationCount
impl UnwindSafe for IterationCount
Blanket Implementations§
impl<T> Allocation for T
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.