pub struct Divisor<T> { /* private fields */ }
Expand description
Faster divisor for division and modulo operations.
§Features
It’s implemented for the integer primitives enabled by the corresponding
[capability features][crate:_info::features#capability-features]:
_int_i8
,
_int_i16
,
_int_i32
,
_int_i64
,
_int_i128
,
_int_isize
,
_int_u8
,
_int_u16
,
_int_u32
,
_int_u64
,
_int_u128
,
_int_usize
.
§Derived Work
This is derived work from the
quickdiv
crate,
including the following modifications:
- unify all types in a single one with const-generic implementations.
- constructors return
Option
instead of panicking. - specific implementations are feature-gated.
- misc. refactoring and code compression.
Implementations§
Source§impl Divisor<i8>
Available on crate feature _int_i8
only.
impl Divisor<i8>
_int_i8
only.Sourcepub const fn new_i8(d: i8) -> Option<Divisor<i8>> ⓘ
pub const fn new_i8(d: i8) -> Option<Divisor<i8>> ⓘ
Alias of new
with a unique name that helps type inference.
Sourcepub const fn new(d: i8) -> Option<Divisor<i8>> ⓘ
pub const fn new(d: i8) -> Option<Divisor<i8>> ⓘ
Creates a divisor which can be used for faster computation
of division and modulo by d
.
Returns None
if d
equals zero.
§Examples
let d = Divisor::<i8>::new(-21).unwrap();
Sourcepub const fn get(&self) -> i8 ⓘ
pub const fn get(&self) -> i8 ⓘ
Returns the value that was used to construct this divisor as a primitive type.
§Examples
let d = Divisor::<i8>::new(-15).unwrap();
assert_eq!(d.get(), -15);
Sourcepub const fn divides(&self, n: i8) -> bool
pub const fn divides(&self, n: i8) -> bool
Returns true
if n
is divisible by self
.
We take 0
to be divisible by all non-zero numbers.
§Examples
let d = Divisor::<i8>::new(-9).unwrap();
assert!(d.divides(27));
Sourcepub const fn rem_of(&self, n: i8) -> i8 ⓘ
pub const fn rem_of(&self, n: i8) -> i8 ⓘ
Returns the remainder of dividing n
by self
.
§Examples
let d = Divisor::<i8>::new(21).unwrap();
let rem = d.rem_of(-30);
assert_eq!(rem, -9);
Sourcepub const fn div_of(&self, n: i8) -> i8 ⓘ
pub const fn div_of(&self, n: i8) -> i8 ⓘ
Returns the result of dividing n
by self
.
This will perform a wrapping division, i.e.
Divisor::<i8>::new(-1).unwrap().div_of(i8::MIN)
will always silently return
i8::MIN
whether the program was compiled with overflow-checks
turned off or not.
§Examples
let d = Divisor::<i8>::new(13).unwrap();
let div = d.div_of(-30);
assert_eq!(div, -2);
Source§impl Divisor<i16>
Available on crate feature _int_i16
only.
impl Divisor<i16>
_int_i16
only.Sourcepub const fn new_i16(d: i16) -> Option<Divisor<i16>> ⓘ
pub const fn new_i16(d: i16) -> Option<Divisor<i16>> ⓘ
Alias of new
with a unique name that helps type inference.
Sourcepub const fn new(d: i16) -> Option<Divisor<i16>> ⓘ
pub const fn new(d: i16) -> Option<Divisor<i16>> ⓘ
Creates a divisor which can be used for faster computation
of division and modulo by d
.
Returns None
if d
equals zero.
§Examples
let d = Divisor::<i16>::new(-21).unwrap();
Sourcepub const fn get(&self) -> i16 ⓘ
pub const fn get(&self) -> i16 ⓘ
Returns the value that was used to construct this divisor as a primitive type.
§Examples
let d = Divisor::<i16>::new(-15).unwrap();
assert_eq!(d.get(), -15);
Sourcepub const fn divides(&self, n: i16) -> bool
pub const fn divides(&self, n: i16) -> bool
Returns true
if n
is divisible by self
.
We take 0
to be divisible by all non-zero numbers.
§Examples
let d = Divisor::<i16>::new(-9).unwrap();
assert!(d.divides(27));
Sourcepub const fn rem_of(&self, n: i16) -> i16 ⓘ
pub const fn rem_of(&self, n: i16) -> i16 ⓘ
Returns the remainder of dividing n
by self
.
§Examples
let d = Divisor::<i16>::new(21).unwrap();
let rem = d.rem_of(-30);
assert_eq!(rem, -9);
Sourcepub const fn div_of(&self, n: i16) -> i16 ⓘ
pub const fn div_of(&self, n: i16) -> i16 ⓘ
Returns the result of dividing n
by self
.
This will perform a wrapping division, i.e.
Divisor::<i16>::new(-1).unwrap().div_of(i16::MIN)
will always silently return
i16::MIN
whether the program was compiled with overflow-checks
turned off or not.
§Examples
let d = Divisor::<i16>::new(13).unwrap();
let div = d.div_of(-30);
assert_eq!(div, -2);
Source§impl Divisor<i32>
Available on crate feature _int_i32
only.
impl Divisor<i32>
_int_i32
only.Sourcepub const fn new_i32(d: i32) -> Option<Divisor<i32>> ⓘ
pub const fn new_i32(d: i32) -> Option<Divisor<i32>> ⓘ
Alias of new
with a unique name that helps type inference.
Sourcepub const fn new(d: i32) -> Option<Divisor<i32>> ⓘ
pub const fn new(d: i32) -> Option<Divisor<i32>> ⓘ
Creates a divisor which can be used for faster computation
of division and modulo by d
.
Returns None
if d
equals zero.
§Examples
let d = Divisor::<i32>::new(-21).unwrap();
Sourcepub const fn get(&self) -> i32 ⓘ
pub const fn get(&self) -> i32 ⓘ
Returns the value that was used to construct this divisor as a primitive type.
§Examples
let d = Divisor::<i32>::new(-15).unwrap();
assert_eq!(d.get(), -15);
Sourcepub const fn divides(&self, n: i32) -> bool
pub const fn divides(&self, n: i32) -> bool
Returns true
if n
is divisible by self
.
We take 0
to be divisible by all non-zero numbers.
§Examples
let d = Divisor::<i32>::new(-9).unwrap();
assert!(d.divides(27));
Sourcepub const fn rem_of(&self, n: i32) -> i32 ⓘ
pub const fn rem_of(&self, n: i32) -> i32 ⓘ
Returns the remainder of dividing n
by self
.
§Examples
let d = Divisor::<i32>::new(21).unwrap();
let rem = d.rem_of(-30);
assert_eq!(rem, -9);
Sourcepub const fn div_of(&self, n: i32) -> i32 ⓘ
pub const fn div_of(&self, n: i32) -> i32 ⓘ
Returns the result of dividing n
by self
.
This will perform a wrapping division, i.e.
Divisor::<i32>::new(-1).unwrap().div_of(i32::MIN)
will always silently return
i32::MIN
whether the program was compiled with overflow-checks
turned off or not.
§Examples
let d = Divisor::<i32>::new(13).unwrap();
let div = d.div_of(-30);
assert_eq!(div, -2);
Source§impl Divisor<i64>
Available on crate feature _int_i64
only.
impl Divisor<i64>
_int_i64
only.Sourcepub const fn new_i64(d: i64) -> Option<Divisor<i64>> ⓘ
pub const fn new_i64(d: i64) -> Option<Divisor<i64>> ⓘ
Alias of new
with a unique name that helps type inference.
Sourcepub const fn new(d: i64) -> Option<Divisor<i64>> ⓘ
pub const fn new(d: i64) -> Option<Divisor<i64>> ⓘ
Creates a divisor which can be used for faster computation
of division and modulo by d
.
Returns None
if d
equals zero.
§Examples
let d = Divisor::<i64>::new(-21).unwrap();
Sourcepub const fn get(&self) -> i64 ⓘ
pub const fn get(&self) -> i64 ⓘ
Returns the value that was used to construct this divisor as a primitive type.
§Examples
let d = Divisor::<i64>::new(-15).unwrap();
assert_eq!(d.get(), -15);
Sourcepub const fn divides(&self, n: i64) -> bool
pub const fn divides(&self, n: i64) -> bool
Returns true
if n
is divisible by self
.
We take 0
to be divisible by all non-zero numbers.
§Examples
let d = Divisor::<i64>::new(-9).unwrap();
assert!(d.divides(27));
Sourcepub const fn rem_of(&self, n: i64) -> i64 ⓘ
pub const fn rem_of(&self, n: i64) -> i64 ⓘ
Returns the remainder of dividing n
by self
.
§Examples
let d = Divisor::<i64>::new(21).unwrap();
let rem = d.rem_of(-30);
assert_eq!(rem, -9);
Sourcepub const fn div_of(&self, n: i64) -> i64 ⓘ
pub const fn div_of(&self, n: i64) -> i64 ⓘ
Returns the result of dividing n
by self
.
This will perform a wrapping division, i.e.
Divisor::<i64>::new(-1).unwrap().div_of(i64::MIN)
will always silently return
i64::MIN
whether the program was compiled with overflow-checks
turned off or not.
§Examples
let d = Divisor::<i64>::new(13).unwrap();
let div = d.div_of(-30);
assert_eq!(div, -2);
Source§impl Divisor<i128>
Available on crate feature _int_i128
only.
impl Divisor<i128>
_int_i128
only.Sourcepub const fn new_i128(d: i128) -> Option<Divisor<i128>> ⓘ
pub const fn new_i128(d: i128) -> Option<Divisor<i128>> ⓘ
Alias of new
with a unique name that helps type inference.
Sourcepub const fn new(d: i128) -> Option<Divisor<i128>> ⓘ
pub const fn new(d: i128) -> Option<Divisor<i128>> ⓘ
Creates a divisor which can be used for faster computation
of division and modulo by d
.
Returns None
if d
equals zero.
§Examples
let d = Divisor::<i128>::new(-21).unwrap();
Sourcepub const fn get(&self) -> i128 ⓘ
pub const fn get(&self) -> i128 ⓘ
Returns the value that was used to construct this divisor as a primitive type.
§Examples
let d = Divisor::<i128>::new(-15).unwrap();
assert_eq!(d.get(), -15);
Sourcepub const fn divides(&self, n: i128) -> bool
pub const fn divides(&self, n: i128) -> bool
Returns true
if n
is divisible by self
.
We take 0
to be divisible by all non-zero numbers.
§Examples
let d = Divisor::<i128>::new(-9).unwrap();
assert!(d.divides(27));
Sourcepub const fn rem_of(&self, n: i128) -> i128 ⓘ
pub const fn rem_of(&self, n: i128) -> i128 ⓘ
Returns the remainder of dividing n
by self
.
§Examples
let d = Divisor::<i128>::new(21).unwrap();
let rem = d.rem_of(-30);
assert_eq!(rem, -9);
Sourcepub const fn div_of(&self, n: i128) -> i128 ⓘ
pub const fn div_of(&self, n: i128) -> i128 ⓘ
Returns the result of dividing n
by self
.
This will perform a wrapping division, i.e.
Divisor::<i128>::new(-1).unwrap().div_of(i128::MIN)
will always silently return
i128::MIN
whether the program was compiled with overflow-checks
turned off or not.
§Examples
let d = Divisor::<i128>::new(13).unwrap();
let div = d.div_of(-30);
assert_eq!(div, -2);
Source§impl Divisor<isize>
Available on crate feature _int_isize
only.
impl Divisor<isize>
_int_isize
only.Sourcepub const fn new_isize(d: isize) -> Option<Divisor<isize>> ⓘ
pub const fn new_isize(d: isize) -> Option<Divisor<isize>> ⓘ
Alias of new
with a unique name that helps type inference.
Sourcepub const fn new(d: isize) -> Option<Divisor<isize>> ⓘ
pub const fn new(d: isize) -> Option<Divisor<isize>> ⓘ
Creates a divisor which can be used for faster computation
of division and modulo by d
.
Returns None
if d
equals zero.
§Examples
let d = Divisor::<isize>::new(-21).unwrap();
Sourcepub const fn get(&self) -> isize ⓘ
pub const fn get(&self) -> isize ⓘ
Returns the value that was used to construct this divisor as a primitive type.
§Examples
let d = Divisor::<isize>::new(-15).unwrap();
assert_eq!(d.get(), -15);
Sourcepub const fn divides(&self, n: isize) -> bool
pub const fn divides(&self, n: isize) -> bool
Returns true
if n
is divisible by self
.
We take 0
to be divisible by all non-zero numbers.
§Examples
let d = Divisor::<isize>::new(-9).unwrap();
assert!(d.divides(27));
Sourcepub const fn rem_of(&self, n: isize) -> isize ⓘ
pub const fn rem_of(&self, n: isize) -> isize ⓘ
Returns the remainder of dividing n
by self
.
§Examples
let d = Divisor::<isize>::new(21).unwrap();
let rem = d.rem_of(-30);
assert_eq!(rem, -9);
Sourcepub const fn div_of(&self, n: isize) -> isize ⓘ
pub const fn div_of(&self, n: isize) -> isize ⓘ
Returns the result of dividing n
by self
.
This will perform a wrapping division, i.e.
Divisor::<isize>::new(-1).unwrap().div_of(isize::MIN)
will always silently return
isize::MIN
whether the program was compiled with overflow-checks
turned off or not.
§Examples
let d = Divisor::<isize>::new(13).unwrap();
let div = d.div_of(-30);
assert_eq!(div, -2);
Source§impl Divisor<u8>
Available on crate feature _int_u8
only.
impl Divisor<u8>
_int_u8
only.Sourcepub const fn new_u8(d: u8) -> Option<Divisor<u8>> ⓘ
pub const fn new_u8(d: u8) -> Option<Divisor<u8>> ⓘ
Alias of new
with a unique name that helps type inference.
Sourcepub const fn new(d: u8) -> Option<Divisor<u8>> ⓘ
pub const fn new(d: u8) -> Option<Divisor<u8>> ⓘ
Creates a divisor which can be used for faster computation
of division and modulo by d
.
Returns None
if d
equals zero.
§Examples
let _d = Divisor::<u8>::new(5);
Sourcepub const fn get(&self) -> u8 ⓘ
pub const fn get(&self) -> u8 ⓘ
Returns the value that was used to construct this divisor as a primitive type.
§Examples
let d = Divisor::<u8>::new(7).unwrap();
assert_eq!(d.get(), 7);
Sourcepub const fn divides(&self, n: u8) -> bool
pub const fn divides(&self, n: u8) -> bool
Returns true
if n
is divisible by self
.
We take 0
to be divisible by all non-zero numbers.
§Examples
let d = Divisor::<u8>::new(17).unwrap();
assert!(d.divides(34));
Source§impl Divisor<u16>
Available on crate feature _int_u16
only.
impl Divisor<u16>
_int_u16
only.Sourcepub const fn new_u16(d: u16) -> Option<Divisor<u16>> ⓘ
pub const fn new_u16(d: u16) -> Option<Divisor<u16>> ⓘ
Alias of new
with a unique name that helps type inference.
Sourcepub const fn new(d: u16) -> Option<Divisor<u16>> ⓘ
pub const fn new(d: u16) -> Option<Divisor<u16>> ⓘ
Creates a divisor which can be used for faster computation
of division and modulo by d
.
Returns None
if d
equals zero.
§Examples
let _d = Divisor::<u16>::new(5);
Sourcepub const fn get(&self) -> u16 ⓘ
pub const fn get(&self) -> u16 ⓘ
Returns the value that was used to construct this divisor as a primitive type.
§Examples
let d = Divisor::<u16>::new(7).unwrap();
assert_eq!(d.get(), 7);
Sourcepub const fn divides(&self, n: u16) -> bool
pub const fn divides(&self, n: u16) -> bool
Returns true
if n
is divisible by self
.
We take 0
to be divisible by all non-zero numbers.
§Examples
let d = Divisor::<u16>::new(17).unwrap();
assert!(d.divides(34));
Source§impl Divisor<u32>
Available on crate feature _int_u32
only.
impl Divisor<u32>
_int_u32
only.Sourcepub const fn new_u32(d: u32) -> Option<Divisor<u32>> ⓘ
pub const fn new_u32(d: u32) -> Option<Divisor<u32>> ⓘ
Alias of new
with a unique name that helps type inference.
Sourcepub const fn new(d: u32) -> Option<Divisor<u32>> ⓘ
pub const fn new(d: u32) -> Option<Divisor<u32>> ⓘ
Creates a divisor which can be used for faster computation
of division and modulo by d
.
Returns None
if d
equals zero.
§Examples
let _d = Divisor::<u32>::new(5);
Sourcepub const fn get(&self) -> u32 ⓘ
pub const fn get(&self) -> u32 ⓘ
Returns the value that was used to construct this divisor as a primitive type.
§Examples
let d = Divisor::<u32>::new(7).unwrap();
assert_eq!(d.get(), 7);
Sourcepub const fn divides(&self, n: u32) -> bool
pub const fn divides(&self, n: u32) -> bool
Returns true
if n
is divisible by self
.
We take 0
to be divisible by all non-zero numbers.
§Examples
let d = Divisor::<u32>::new(17).unwrap();
assert!(d.divides(34));
Source§impl Divisor<u64>
Available on crate feature _int_u64
only.
impl Divisor<u64>
_int_u64
only.Sourcepub const fn new_u64(d: u64) -> Option<Divisor<u64>> ⓘ
pub const fn new_u64(d: u64) -> Option<Divisor<u64>> ⓘ
Alias of new
with a unique name that helps type inference.
Sourcepub const fn new(d: u64) -> Option<Divisor<u64>> ⓘ
pub const fn new(d: u64) -> Option<Divisor<u64>> ⓘ
Creates a divisor which can be used for faster computation
of division and modulo by d
.
Returns None
if d
equals zero.
§Examples
let _d = Divisor::<u64>::new(5);
Sourcepub const fn get(&self) -> u64 ⓘ
pub const fn get(&self) -> u64 ⓘ
Returns the value that was used to construct this divisor as a primitive type.
§Examples
let d = Divisor::<u64>::new(7).unwrap();
assert_eq!(d.get(), 7);
Sourcepub const fn divides(&self, n: u64) -> bool
pub const fn divides(&self, n: u64) -> bool
Returns true
if n
is divisible by self
.
We take 0
to be divisible by all non-zero numbers.
§Examples
let d = Divisor::<u64>::new(17).unwrap();
assert!(d.divides(34));
Source§impl Divisor<u128>
Available on crate feature _int_u128
only.
impl Divisor<u128>
_int_u128
only.Sourcepub const fn new_u128(d: u128) -> Option<Divisor<u128>> ⓘ
pub const fn new_u128(d: u128) -> Option<Divisor<u128>> ⓘ
Alias of new
with a unique name that helps type inference.
Sourcepub const fn new(d: u128) -> Option<Divisor<u128>> ⓘ
pub const fn new(d: u128) -> Option<Divisor<u128>> ⓘ
Creates a divisor which can be used for faster computation
of division and modulo by d
.
Returns None
if d
equals zero.
§Examples
let _d = Divisor::<u128>::new(5);
Sourcepub const fn get(&self) -> u128 ⓘ
pub const fn get(&self) -> u128 ⓘ
Returns the value that was used to construct this divisor as a primitive type.
§Examples
let d = Divisor::<u128>::new(7).unwrap();
assert_eq!(d.get(), 7);
Sourcepub const fn divides(&self, n: u128) -> bool
pub const fn divides(&self, n: u128) -> bool
Returns true
if n
is divisible by self
.
We take 0
to be divisible by all non-zero numbers.
§Examples
let d = Divisor::<u128>::new(17).unwrap();
assert!(d.divides(34));
Source§impl Divisor<usize>
Available on crate feature _int_usize
only.
impl Divisor<usize>
_int_usize
only.Sourcepub const fn new_usize(d: usize) -> Option<Divisor<usize>> ⓘ
pub const fn new_usize(d: usize) -> Option<Divisor<usize>> ⓘ
Alias of new
with a unique name that helps type inference.
Sourcepub const fn new(d: usize) -> Option<Divisor<usize>> ⓘ
pub const fn new(d: usize) -> Option<Divisor<usize>> ⓘ
Creates a divisor which can be used for faster computation
of division and modulo by d
.
Returns None
if d
equals zero.
§Examples
let _d = Divisor::<usize>::new(5);
Sourcepub const fn get(&self) -> usize ⓘ
pub const fn get(&self) -> usize ⓘ
Returns the value that was used to construct this divisor as a primitive type.
§Examples
let d = Divisor::<usize>::new(7).unwrap();
assert_eq!(d.get(), 7);
Sourcepub const fn divides(&self, n: usize) -> bool
pub const fn divides(&self, n: usize) -> bool
Returns true
if n
is divisible by self
.
We take 0
to be divisible by all non-zero numbers.
§Examples
let d = Divisor::<usize>::new(17).unwrap();
assert!(d.divides(34));
Trait Implementations§
impl<T: Copy> Copy for Divisor<T>
impl Eq for Divisor<i128>
impl Eq for Divisor<i16>
impl Eq for Divisor<i32>
impl Eq for Divisor<i64>
impl Eq for Divisor<i8>
impl Eq for Divisor<isize>
impl Eq for Divisor<u128>
impl Eq for Divisor<u16>
impl Eq for Divisor<u32>
impl Eq for Divisor<u64>
impl Eq for Divisor<u8>
impl Eq for Divisor<usize>
Auto Trait Implementations§
impl<T> Freeze for Divisor<T>where
T: Freeze,
impl<T> RefUnwindSafe for Divisor<T>where
T: RefUnwindSafe,
impl<T> Send for Divisor<T>where
T: Send,
impl<T> Sync for Divisor<T>where
T: Sync,
impl<T> Unpin for Divisor<T>where
T: Unpin,
impl<T> UnwindSafe for Divisor<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize ⓘ
fn byte_align(&self) -> usize ⓘ
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of_val(&self) -> usize ⓘ
fn mem_align_of_val(&self) -> usize ⓘ
Source§fn mem_size_of_val(&self) -> usize ⓘ
fn mem_size_of_val(&self) -> usize ⓘ
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§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> ⓘ
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 more§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError> ⓘ
§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out
indicating that a T
is niched.