Trait malachite_base::num::conversion::traits::OverflowingFrom

source ·
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§

source

fn overflowing_from(value: T) -> (Self, bool)

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl OverflowingFrom<i8> for i8

source§

fn overflowing_from(value: i8) -> (i8, bool)

Converts a value to its own type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i8> for i16

source§

fn overflowing_from(value: i8) -> (i16, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i8> for i32

source§

fn overflowing_from(value: i8) -> (i32, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i8> for i64

source§

fn overflowing_from(value: i8) -> (i64, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i8> for i128

source§

fn overflowing_from(value: i8) -> (i128, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i8> for isize

source§

fn overflowing_from(value: i8) -> (isize, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i8> for u8

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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 i16

source§

fn overflowing_from(value: i16) -> (i16, bool)

Converts a value to its own type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i16> for i32

source§

fn overflowing_from(value: i16) -> (i32, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i16> for i64

source§

fn overflowing_from(value: i16) -> (i64, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i16> for i128

source§

fn overflowing_from(value: i16) -> (i128, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i16> for isize

source§

fn overflowing_from(value: i16) -> (isize, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i16> for u8

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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 i32

source§

fn overflowing_from(value: i32) -> (i32, bool)

Converts a value to its own type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i32> for i64

source§

fn overflowing_from(value: i32) -> (i64, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i32> for i128

source§

fn overflowing_from(value: i32) -> (i128, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i32> for isize

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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 i64

source§

fn overflowing_from(value: i64) -> (i64, bool)

Converts a value to its own type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i64> for i128

source§

fn overflowing_from(value: i64) -> (i128, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i64> for isize

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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 i128

source§

fn overflowing_from(value: i128) -> (i128, bool)

Converts a value to its own type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<i128> for isize

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn overflowing_from(value: isize) -> (isize, bool)

Converts a value to its own type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<isize> for u8

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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<u8> for i16

source§

fn overflowing_from(value: u8) -> (i16, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u8> for i32

source§

fn overflowing_from(value: u8) -> (i32, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u8> for i64

source§

fn overflowing_from(value: u8) -> (i64, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u8> for i128

source§

fn overflowing_from(value: u8) -> (i128, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u8> for isize

source§

fn overflowing_from(value: u8) -> (isize, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u8> for u8

source§

fn overflowing_from(value: u8) -> (u8, bool)

Converts a value to its own type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u8> for u16

source§

fn overflowing_from(value: u8) -> (u16, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u8> for u32

source§

fn overflowing_from(value: u8) -> (u32, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u8> for u64

source§

fn overflowing_from(value: u8) -> (u64, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u8> for u128

source§

fn overflowing_from(value: u8) -> (u128, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u8> for usize

source§

fn overflowing_from(value: u8) -> (usize, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u16> for i8

source§

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

source§

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 i32

source§

fn overflowing_from(value: u16) -> (i32, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u16> for i64

source§

fn overflowing_from(value: u16) -> (i64, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u16> for i128

source§

fn overflowing_from(value: u16) -> (i128, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u16> for isize

source§

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

source§

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<u16> for u16

source§

fn overflowing_from(value: u16) -> (u16, bool)

Converts a value to its own type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u16> for u32

source§

fn overflowing_from(value: u16) -> (u32, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u16> for u64

source§

fn overflowing_from(value: u16) -> (u64, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u16> for u128

source§

fn overflowing_from(value: u16) -> (u128, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u16> for usize

source§

fn overflowing_from(value: u16) -> (usize, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u32> for i8

source§

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

source§

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

source§

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 i64

source§

fn overflowing_from(value: u32) -> (i64, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u32> for i128

source§

fn overflowing_from(value: u32) -> (i128, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u32> for isize

source§

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

source§

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

source§

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 u32

source§

fn overflowing_from(value: u32) -> (u32, bool)

Converts a value to its own type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u32> for u64

source§

fn overflowing_from(value: u32) -> (u64, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u32> for u128

source§

fn overflowing_from(value: u32) -> (u128, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u32> for usize

source§

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

source§

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

source§

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

source§

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

source§

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 i128

source§

fn overflowing_from(value: u64) -> (i128, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u64> for isize

source§

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

source§

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

source§

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

source§

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 u64

source§

fn overflowing_from(value: u64) -> (u64, bool)

Converts a value to its own type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u64> for u128

source§

fn overflowing_from(value: u64) -> (u128, bool)

Converts a value to the value’s type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u64> for usize

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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 u128

source§

fn overflowing_from(value: u128) -> (u128, bool)

Converts a value to its own type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

source§

impl OverflowingFrom<u128> for usize

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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.

source§

impl OverflowingFrom<usize> for usize

source§

fn overflowing_from(value: usize) -> (usize, bool)

Converts a value to its own type. Since this conversion is always valid and always leaves the value unchanged, the second component of the result is always false (no overflow).

§Worst-case complexity

Constant time and additional memory.

§Examples

See here.

Implementors§