pub trait OverflowingFrom<T>: Sized {
// Required method
fn overflowing_from(value: T) -> (Self, bool);
}
Expand description
Converts a value from one type to another, where if the conversion is not exact the result will
wrap around. The result is returned along with a bool
that indicates whether wrapping has
occurred.
If OverflowingFrom
is implemented, it usually makes sense to implement WrappingFrom
as
well.
Required Methods§
fn overflowing_from(value: T) -> (Self, bool)
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl OverflowingFrom<i8> for u8
impl OverflowingFrom<i8> for u8
Source§fn overflowing_from(value: i8) -> (u8, bool)
fn overflowing_from(value: i8) -> (u8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i8> for u16
impl OverflowingFrom<i8> for u16
Source§fn overflowing_from(value: i8) -> (u16, bool)
fn overflowing_from(value: i8) -> (u16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i8> for u32
impl OverflowingFrom<i8> for u32
Source§fn overflowing_from(value: i8) -> (u32, bool)
fn overflowing_from(value: i8) -> (u32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i8> for u64
impl OverflowingFrom<i8> for u64
Source§fn overflowing_from(value: i8) -> (u64, bool)
fn overflowing_from(value: i8) -> (u64, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i8> for u128
impl OverflowingFrom<i8> for u128
Source§fn overflowing_from(value: i8) -> (u128, bool)
fn overflowing_from(value: i8) -> (u128, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i8> for usize
impl OverflowingFrom<i8> for usize
Source§fn overflowing_from(value: i8) -> (usize, bool)
fn overflowing_from(value: i8) -> (usize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i16> for i8
impl OverflowingFrom<i16> for i8
Source§fn overflowing_from(value: i16) -> (i8, bool)
fn overflowing_from(value: i16) -> (i8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i16> for u8
impl OverflowingFrom<i16> for u8
Source§fn overflowing_from(value: i16) -> (u8, bool)
fn overflowing_from(value: i16) -> (u8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i16> for u16
impl OverflowingFrom<i16> for u16
Source§fn overflowing_from(value: i16) -> (u16, bool)
fn overflowing_from(value: i16) -> (u16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i16> for u32
impl OverflowingFrom<i16> for u32
Source§fn overflowing_from(value: i16) -> (u32, bool)
fn overflowing_from(value: i16) -> (u32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i16> for u64
impl OverflowingFrom<i16> for u64
Source§fn overflowing_from(value: i16) -> (u64, bool)
fn overflowing_from(value: i16) -> (u64, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i16> for u128
impl OverflowingFrom<i16> for u128
Source§fn overflowing_from(value: i16) -> (u128, bool)
fn overflowing_from(value: i16) -> (u128, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i16> for usize
impl OverflowingFrom<i16> for usize
Source§fn overflowing_from(value: i16) -> (usize, bool)
fn overflowing_from(value: i16) -> (usize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i32> for i8
impl OverflowingFrom<i32> for i8
Source§fn overflowing_from(value: i32) -> (i8, bool)
fn overflowing_from(value: i32) -> (i8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i32> for i16
impl OverflowingFrom<i32> for i16
Source§fn overflowing_from(value: i32) -> (i16, bool)
fn overflowing_from(value: i32) -> (i16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i32> for isize
impl OverflowingFrom<i32> for isize
Source§fn overflowing_from(value: i32) -> (isize, bool)
fn overflowing_from(value: i32) -> (isize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i32> for u8
impl OverflowingFrom<i32> for u8
Source§fn overflowing_from(value: i32) -> (u8, bool)
fn overflowing_from(value: i32) -> (u8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i32> for u16
impl OverflowingFrom<i32> for u16
Source§fn overflowing_from(value: i32) -> (u16, bool)
fn overflowing_from(value: i32) -> (u16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i32> for u32
impl OverflowingFrom<i32> for u32
Source§fn overflowing_from(value: i32) -> (u32, bool)
fn overflowing_from(value: i32) -> (u32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i32> for u64
impl OverflowingFrom<i32> for u64
Source§fn overflowing_from(value: i32) -> (u64, bool)
fn overflowing_from(value: i32) -> (u64, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i32> for u128
impl OverflowingFrom<i32> for u128
Source§fn overflowing_from(value: i32) -> (u128, bool)
fn overflowing_from(value: i32) -> (u128, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i32> for usize
impl OverflowingFrom<i32> for usize
Source§fn overflowing_from(value: i32) -> (usize, bool)
fn overflowing_from(value: i32) -> (usize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i64> for i8
impl OverflowingFrom<i64> for i8
Source§fn overflowing_from(value: i64) -> (i8, bool)
fn overflowing_from(value: i64) -> (i8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i64> for i16
impl OverflowingFrom<i64> for i16
Source§fn overflowing_from(value: i64) -> (i16, bool)
fn overflowing_from(value: i64) -> (i16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i64> for i32
impl OverflowingFrom<i64> for i32
Source§fn overflowing_from(value: i64) -> (i32, bool)
fn overflowing_from(value: i64) -> (i32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i64> for isize
impl OverflowingFrom<i64> for isize
Source§fn overflowing_from(value: i64) -> (isize, bool)
fn overflowing_from(value: i64) -> (isize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i64> for u8
impl OverflowingFrom<i64> for u8
Source§fn overflowing_from(value: i64) -> (u8, bool)
fn overflowing_from(value: i64) -> (u8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i64> for u16
impl OverflowingFrom<i64> for u16
Source§fn overflowing_from(value: i64) -> (u16, bool)
fn overflowing_from(value: i64) -> (u16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i64> for u32
impl OverflowingFrom<i64> for u32
Source§fn overflowing_from(value: i64) -> (u32, bool)
fn overflowing_from(value: i64) -> (u32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i64> for u64
impl OverflowingFrom<i64> for u64
Source§fn overflowing_from(value: i64) -> (u64, bool)
fn overflowing_from(value: i64) -> (u64, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i64> for u128
impl OverflowingFrom<i64> for u128
Source§fn overflowing_from(value: i64) -> (u128, bool)
fn overflowing_from(value: i64) -> (u128, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i64> for usize
impl OverflowingFrom<i64> for usize
Source§fn overflowing_from(value: i64) -> (usize, bool)
fn overflowing_from(value: i64) -> (usize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i128> for i8
impl OverflowingFrom<i128> for i8
Source§fn overflowing_from(value: i128) -> (i8, bool)
fn overflowing_from(value: i128) -> (i8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i128> for i16
impl OverflowingFrom<i128> for i16
Source§fn overflowing_from(value: i128) -> (i16, bool)
fn overflowing_from(value: i128) -> (i16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i128> for i32
impl OverflowingFrom<i128> for i32
Source§fn overflowing_from(value: i128) -> (i32, bool)
fn overflowing_from(value: i128) -> (i32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i128> for i64
impl OverflowingFrom<i128> for i64
Source§fn overflowing_from(value: i128) -> (i64, bool)
fn overflowing_from(value: i128) -> (i64, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i128> for isize
impl OverflowingFrom<i128> for isize
Source§fn overflowing_from(value: i128) -> (isize, bool)
fn overflowing_from(value: i128) -> (isize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i128> for u8
impl OverflowingFrom<i128> for u8
Source§fn overflowing_from(value: i128) -> (u8, bool)
fn overflowing_from(value: i128) -> (u8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i128> for u16
impl OverflowingFrom<i128> for u16
Source§fn overflowing_from(value: i128) -> (u16, bool)
fn overflowing_from(value: i128) -> (u16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i128> for u32
impl OverflowingFrom<i128> for u32
Source§fn overflowing_from(value: i128) -> (u32, bool)
fn overflowing_from(value: i128) -> (u32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i128> for u64
impl OverflowingFrom<i128> for u64
Source§fn overflowing_from(value: i128) -> (u64, bool)
fn overflowing_from(value: i128) -> (u64, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i128> for u128
impl OverflowingFrom<i128> for u128
Source§fn overflowing_from(value: i128) -> (u128, bool)
fn overflowing_from(value: i128) -> (u128, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<i128> for usize
impl OverflowingFrom<i128> for usize
Source§fn overflowing_from(value: i128) -> (usize, bool)
fn overflowing_from(value: i128) -> (usize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<isize> for i8
impl OverflowingFrom<isize> for i8
Source§fn overflowing_from(value: isize) -> (i8, bool)
fn overflowing_from(value: isize) -> (i8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<isize> for i16
impl OverflowingFrom<isize> for i16
Source§fn overflowing_from(value: isize) -> (i16, bool)
fn overflowing_from(value: isize) -> (i16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<isize> for i32
impl OverflowingFrom<isize> for i32
Source§fn overflowing_from(value: isize) -> (i32, bool)
fn overflowing_from(value: isize) -> (i32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<isize> for i64
impl OverflowingFrom<isize> for i64
Source§fn overflowing_from(value: isize) -> (i64, bool)
fn overflowing_from(value: isize) -> (i64, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<isize> for i128
impl OverflowingFrom<isize> for i128
Source§fn overflowing_from(value: isize) -> (i128, bool)
fn overflowing_from(value: isize) -> (i128, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<isize> for isize
impl OverflowingFrom<isize> for isize
Source§impl OverflowingFrom<isize> for u8
impl OverflowingFrom<isize> for u8
Source§fn overflowing_from(value: isize) -> (u8, bool)
fn overflowing_from(value: isize) -> (u8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<isize> for u16
impl OverflowingFrom<isize> for u16
Source§fn overflowing_from(value: isize) -> (u16, bool)
fn overflowing_from(value: isize) -> (u16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<isize> for u32
impl OverflowingFrom<isize> for u32
Source§fn overflowing_from(value: isize) -> (u32, bool)
fn overflowing_from(value: isize) -> (u32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<isize> for u64
impl OverflowingFrom<isize> for u64
Source§fn overflowing_from(value: isize) -> (u64, bool)
fn overflowing_from(value: isize) -> (u64, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<isize> for u128
impl OverflowingFrom<isize> for u128
Source§fn overflowing_from(value: isize) -> (u128, bool)
fn overflowing_from(value: isize) -> (u128, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<isize> for usize
impl OverflowingFrom<isize> for usize
Source§fn overflowing_from(value: isize) -> (usize, bool)
fn overflowing_from(value: isize) -> (usize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u8> for i8
impl OverflowingFrom<u8> for i8
Source§fn overflowing_from(value: u8) -> (i8, bool)
fn overflowing_from(value: u8) -> (i8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u16> for i8
impl OverflowingFrom<u16> for i8
Source§fn overflowing_from(value: u16) -> (i8, bool)
fn overflowing_from(value: u16) -> (i8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u16> for i16
impl OverflowingFrom<u16> for i16
Source§fn overflowing_from(value: u16) -> (i16, bool)
fn overflowing_from(value: u16) -> (i16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u16> for isize
impl OverflowingFrom<u16> for isize
Source§fn overflowing_from(value: u16) -> (isize, bool)
fn overflowing_from(value: u16) -> (isize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u16> for u8
impl OverflowingFrom<u16> for u8
Source§fn overflowing_from(value: u16) -> (u8, bool)
fn overflowing_from(value: u16) -> (u8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u32> for i8
impl OverflowingFrom<u32> for i8
Source§fn overflowing_from(value: u32) -> (i8, bool)
fn overflowing_from(value: u32) -> (i8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u32> for i16
impl OverflowingFrom<u32> for i16
Source§fn overflowing_from(value: u32) -> (i16, bool)
fn overflowing_from(value: u32) -> (i16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u32> for i32
impl OverflowingFrom<u32> for i32
Source§fn overflowing_from(value: u32) -> (i32, bool)
fn overflowing_from(value: u32) -> (i32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u32> for isize
impl OverflowingFrom<u32> for isize
Source§fn overflowing_from(value: u32) -> (isize, bool)
fn overflowing_from(value: u32) -> (isize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u32> for u8
impl OverflowingFrom<u32> for u8
Source§fn overflowing_from(value: u32) -> (u8, bool)
fn overflowing_from(value: u32) -> (u8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u32> for u16
impl OverflowingFrom<u32> for u16
Source§fn overflowing_from(value: u32) -> (u16, bool)
fn overflowing_from(value: u32) -> (u16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u32> for usize
impl OverflowingFrom<u32> for usize
Source§fn overflowing_from(value: u32) -> (usize, bool)
fn overflowing_from(value: u32) -> (usize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u64> for i8
impl OverflowingFrom<u64> for i8
Source§fn overflowing_from(value: u64) -> (i8, bool)
fn overflowing_from(value: u64) -> (i8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u64> for i16
impl OverflowingFrom<u64> for i16
Source§fn overflowing_from(value: u64) -> (i16, bool)
fn overflowing_from(value: u64) -> (i16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u64> for i32
impl OverflowingFrom<u64> for i32
Source§fn overflowing_from(value: u64) -> (i32, bool)
fn overflowing_from(value: u64) -> (i32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u64> for i64
impl OverflowingFrom<u64> for i64
Source§fn overflowing_from(value: u64) -> (i64, bool)
fn overflowing_from(value: u64) -> (i64, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u64> for isize
impl OverflowingFrom<u64> for isize
Source§fn overflowing_from(value: u64) -> (isize, bool)
fn overflowing_from(value: u64) -> (isize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u64> for u8
impl OverflowingFrom<u64> for u8
Source§fn overflowing_from(value: u64) -> (u8, bool)
fn overflowing_from(value: u64) -> (u8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u64> for u16
impl OverflowingFrom<u64> for u16
Source§fn overflowing_from(value: u64) -> (u16, bool)
fn overflowing_from(value: u64) -> (u16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u64> for u32
impl OverflowingFrom<u64> for u32
Source§fn overflowing_from(value: u64) -> (u32, bool)
fn overflowing_from(value: u64) -> (u32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u64> for usize
impl OverflowingFrom<u64> for usize
Source§fn overflowing_from(value: u64) -> (usize, bool)
fn overflowing_from(value: u64) -> (usize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u128> for i8
impl OverflowingFrom<u128> for i8
Source§fn overflowing_from(value: u128) -> (i8, bool)
fn overflowing_from(value: u128) -> (i8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u128> for i16
impl OverflowingFrom<u128> for i16
Source§fn overflowing_from(value: u128) -> (i16, bool)
fn overflowing_from(value: u128) -> (i16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u128> for i32
impl OverflowingFrom<u128> for i32
Source§fn overflowing_from(value: u128) -> (i32, bool)
fn overflowing_from(value: u128) -> (i32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u128> for i64
impl OverflowingFrom<u128> for i64
Source§fn overflowing_from(value: u128) -> (i64, bool)
fn overflowing_from(value: u128) -> (i64, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u128> for i128
impl OverflowingFrom<u128> for i128
Source§fn overflowing_from(value: u128) -> (i128, bool)
fn overflowing_from(value: u128) -> (i128, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u128> for isize
impl OverflowingFrom<u128> for isize
Source§fn overflowing_from(value: u128) -> (isize, bool)
fn overflowing_from(value: u128) -> (isize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u128> for u8
impl OverflowingFrom<u128> for u8
Source§fn overflowing_from(value: u128) -> (u8, bool)
fn overflowing_from(value: u128) -> (u8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u128> for u16
impl OverflowingFrom<u128> for u16
Source§fn overflowing_from(value: u128) -> (u16, bool)
fn overflowing_from(value: u128) -> (u16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u128> for u32
impl OverflowingFrom<u128> for u32
Source§fn overflowing_from(value: u128) -> (u32, bool)
fn overflowing_from(value: u128) -> (u32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u128> for u64
impl OverflowingFrom<u128> for u64
Source§fn overflowing_from(value: u128) -> (u64, bool)
fn overflowing_from(value: u128) -> (u64, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<u128> for usize
impl OverflowingFrom<u128> for usize
Source§fn overflowing_from(value: u128) -> (usize, bool)
fn overflowing_from(value: u128) -> (usize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<usize> for i8
impl OverflowingFrom<usize> for i8
Source§fn overflowing_from(value: usize) -> (i8, bool)
fn overflowing_from(value: usize) -> (i8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<usize> for i16
impl OverflowingFrom<usize> for i16
Source§fn overflowing_from(value: usize) -> (i16, bool)
fn overflowing_from(value: usize) -> (i16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<usize> for i32
impl OverflowingFrom<usize> for i32
Source§fn overflowing_from(value: usize) -> (i32, bool)
fn overflowing_from(value: usize) -> (i32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<usize> for i64
impl OverflowingFrom<usize> for i64
Source§fn overflowing_from(value: usize) -> (i64, bool)
fn overflowing_from(value: usize) -> (i64, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<usize> for i128
impl OverflowingFrom<usize> for i128
Source§fn overflowing_from(value: usize) -> (i128, bool)
fn overflowing_from(value: usize) -> (i128, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<usize> for isize
impl OverflowingFrom<usize> for isize
Source§fn overflowing_from(value: usize) -> (isize, bool)
fn overflowing_from(value: usize) -> (isize, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<usize> for u8
impl OverflowingFrom<usize> for u8
Source§fn overflowing_from(value: usize) -> (u8, bool)
fn overflowing_from(value: usize) -> (u8, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<usize> for u16
impl OverflowingFrom<usize> for u16
Source§fn overflowing_from(value: usize) -> (u16, bool)
fn overflowing_from(value: usize) -> (u16, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<usize> for u32
impl OverflowingFrom<usize> for u32
Source§fn overflowing_from(value: usize) -> (u32, bool)
fn overflowing_from(value: usize) -> (u32, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<usize> for u64
impl OverflowingFrom<usize> for u64
Source§fn overflowing_from(value: usize) -> (u64, bool)
fn overflowing_from(value: usize) -> (u64, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.
Source§impl OverflowingFrom<usize> for u128
impl OverflowingFrom<usize> for u128
Source§fn overflowing_from(value: usize) -> (u128, bool)
fn overflowing_from(value: usize) -> (u128, bool)
Converts a value to another type. If the value cannot be represented in the new type, it is wrapped. The second component of the result indicates whether overflow occurred.
Let $W$ be the width of the target type.
If the target type is unsigned, then $f_W(n) = (m, k \neq 0)$, where $m < 2^W$ and $n + 2^W k = m$ for some $k \in \Z$.
If the target type is signed, then $f_W(n) = (m, k \neq 0)$, where $-2^{W-1} \leq m < 2^{W-1}$ and $n + 2^W k = m$ for some $k \in \Z$.
§Worst-case complexity
Constant time and additional memory.
§Examples
See here.