Trait malachite_base::num::conversion::traits::VecFromOtherTypeSlice
source · pub trait VecFromOtherTypeSlice<T: Sized>: Sized {
// Required method
fn vec_from_other_type_slice(slice: &[T]) -> Vec<Self>;
}
Expand description
Converts a slice of one type of value to a Vec
of another type.
Required Methods§
fn vec_from_other_type_slice(slice: &[T]) -> Vec<Self>
Object Safety§
Implementations on Foreign Types§
source§impl VecFromOtherTypeSlice<u8> for u8
impl VecFromOtherTypeSlice<u8> for u8
source§fn vec_from_other_type_slice(xs: &[u8]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u8]) -> Vec<Self>
source§impl VecFromOtherTypeSlice<u8> for u16
impl VecFromOtherTypeSlice<u8> for u16
source§fn vec_from_other_type_slice(xs: &[u8]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u8]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a larger unsigned
type.
Adjacent chunks of values in the input slice will be joined into values of the
output Vec
. If the last few elements of the input slice don’t make up a full
chunk, the most-significant bits of the last output value are set to 0.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = \lceil n / 2^{W-V} \rceil$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u8> for u32
impl VecFromOtherTypeSlice<u8> for u32
source§fn vec_from_other_type_slice(xs: &[u8]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u8]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a larger unsigned
type.
Adjacent chunks of values in the input slice will be joined into values of the
output Vec
. If the last few elements of the input slice don’t make up a full
chunk, the most-significant bits of the last output value are set to 0.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = \lceil n / 2^{W-V} \rceil$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u8> for u64
impl VecFromOtherTypeSlice<u8> for u64
source§fn vec_from_other_type_slice(xs: &[u8]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u8]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a larger unsigned
type.
Adjacent chunks of values in the input slice will be joined into values of the
output Vec
. If the last few elements of the input slice don’t make up a full
chunk, the most-significant bits of the last output value are set to 0.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = \lceil n / 2^{W-V} \rceil$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u8> for u128
impl VecFromOtherTypeSlice<u8> for u128
source§fn vec_from_other_type_slice(xs: &[u8]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u8]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a larger unsigned
type.
Adjacent chunks of values in the input slice will be joined into values of the
output Vec
. If the last few elements of the input slice don’t make up a full
chunk, the most-significant bits of the last output value are set to 0.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = \lceil n / 2^{W-V} \rceil$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u8> for usize
impl VecFromOtherTypeSlice<u8> for usize
source§fn vec_from_other_type_slice(xs: &[u8]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u8]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a larger unsigned
type.
Adjacent chunks of values in the input slice will be joined into values of the
output Vec
. If the last few elements of the input slice don’t make up a full
chunk, the most-significant bits of the last output value are set to 0.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = \lceil n / 2^{W-V} \rceil$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u16> for u8
impl VecFromOtherTypeSlice<u16> for u8
source§fn vec_from_other_type_slice(xs: &[u16]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u16]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a smaller unsigned
type.
Each value of the input slice will be broken up into several values in the output
Vec
.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = 2^{V-W}n$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u16> for u16
impl VecFromOtherTypeSlice<u16> for u16
source§fn vec_from_other_type_slice(xs: &[u16]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u16]) -> Vec<Self>
source§impl VecFromOtherTypeSlice<u16> for u32
impl VecFromOtherTypeSlice<u16> for u32
source§fn vec_from_other_type_slice(xs: &[u16]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u16]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a larger unsigned
type.
Adjacent chunks of values in the input slice will be joined into values of the
output Vec
. If the last few elements of the input slice don’t make up a full
chunk, the most-significant bits of the last output value are set to 0.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = \lceil n / 2^{W-V} \rceil$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u16> for u64
impl VecFromOtherTypeSlice<u16> for u64
source§fn vec_from_other_type_slice(xs: &[u16]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u16]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a larger unsigned
type.
Adjacent chunks of values in the input slice will be joined into values of the
output Vec
. If the last few elements of the input slice don’t make up a full
chunk, the most-significant bits of the last output value are set to 0.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = \lceil n / 2^{W-V} \rceil$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u16> for u128
impl VecFromOtherTypeSlice<u16> for u128
source§fn vec_from_other_type_slice(xs: &[u16]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u16]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a larger unsigned
type.
Adjacent chunks of values in the input slice will be joined into values of the
output Vec
. If the last few elements of the input slice don’t make up a full
chunk, the most-significant bits of the last output value are set to 0.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = \lceil n / 2^{W-V} \rceil$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u16> for usize
impl VecFromOtherTypeSlice<u16> for usize
source§fn vec_from_other_type_slice(xs: &[u16]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u16]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a larger unsigned
type.
Adjacent chunks of values in the input slice will be joined into values of the
output Vec
. If the last few elements of the input slice don’t make up a full
chunk, the most-significant bits of the last output value are set to 0.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = \lceil n / 2^{W-V} \rceil$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u32> for u8
impl VecFromOtherTypeSlice<u32> for u8
source§fn vec_from_other_type_slice(xs: &[u32]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u32]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a smaller unsigned
type.
Each value of the input slice will be broken up into several values in the output
Vec
.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = 2^{V-W}n$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u32> for u16
impl VecFromOtherTypeSlice<u32> for u16
source§fn vec_from_other_type_slice(xs: &[u32]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u32]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a smaller unsigned
type.
Each value of the input slice will be broken up into several values in the output
Vec
.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = 2^{V-W}n$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u32> for u32
impl VecFromOtherTypeSlice<u32> for u32
source§fn vec_from_other_type_slice(xs: &[u32]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u32]) -> Vec<Self>
source§impl VecFromOtherTypeSlice<u32> for u64
impl VecFromOtherTypeSlice<u32> for u64
source§fn vec_from_other_type_slice(xs: &[u32]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u32]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a larger unsigned
type.
Adjacent chunks of values in the input slice will be joined into values of the
output Vec
. If the last few elements of the input slice don’t make up a full
chunk, the most-significant bits of the last output value are set to 0.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = \lceil n / 2^{W-V} \rceil$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u32> for u128
impl VecFromOtherTypeSlice<u32> for u128
source§fn vec_from_other_type_slice(xs: &[u32]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u32]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a larger unsigned
type.
Adjacent chunks of values in the input slice will be joined into values of the
output Vec
. If the last few elements of the input slice don’t make up a full
chunk, the most-significant bits of the last output value are set to 0.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = \lceil n / 2^{W-V} \rceil$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u32> for usize
impl VecFromOtherTypeSlice<u32> for usize
source§impl VecFromOtherTypeSlice<u64> for u8
impl VecFromOtherTypeSlice<u64> for u8
source§fn vec_from_other_type_slice(xs: &[u64]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u64]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a smaller unsigned
type.
Each value of the input slice will be broken up into several values in the output
Vec
.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = 2^{V-W}n$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u64> for u16
impl VecFromOtherTypeSlice<u64> for u16
source§fn vec_from_other_type_slice(xs: &[u64]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u64]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a smaller unsigned
type.
Each value of the input slice will be broken up into several values in the output
Vec
.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = 2^{V-W}n$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u64> for u32
impl VecFromOtherTypeSlice<u64> for u32
source§fn vec_from_other_type_slice(xs: &[u64]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u64]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a smaller unsigned
type.
Each value of the input slice will be broken up into several values in the output
Vec
.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = 2^{V-W}n$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u64> for u64
impl VecFromOtherTypeSlice<u64> for u64
source§fn vec_from_other_type_slice(xs: &[u64]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u64]) -> Vec<Self>
source§impl VecFromOtherTypeSlice<u64> for u128
impl VecFromOtherTypeSlice<u64> for u128
source§fn vec_from_other_type_slice(xs: &[u64]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u64]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a larger unsigned
type.
Adjacent chunks of values in the input slice will be joined into values of the
output Vec
. If the last few elements of the input slice don’t make up a full
chunk, the most-significant bits of the last output value are set to 0.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = \lceil n / 2^{W-V} \rceil$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u64> for usize
impl VecFromOtherTypeSlice<u64> for usize
source§impl VecFromOtherTypeSlice<u128> for u8
impl VecFromOtherTypeSlice<u128> for u8
source§fn vec_from_other_type_slice(xs: &[u128]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u128]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a smaller unsigned
type.
Each value of the input slice will be broken up into several values in the output
Vec
.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = 2^{V-W}n$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u128> for u16
impl VecFromOtherTypeSlice<u128> for u16
source§fn vec_from_other_type_slice(xs: &[u128]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u128]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a smaller unsigned
type.
Each value of the input slice will be broken up into several values in the output
Vec
.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = 2^{V-W}n$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u128> for u32
impl VecFromOtherTypeSlice<u128> for u32
source§fn vec_from_other_type_slice(xs: &[u128]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u128]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a smaller unsigned
type.
Each value of the input slice will be broken up into several values in the output
Vec
.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = 2^{V-W}n$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u128> for u64
impl VecFromOtherTypeSlice<u128> for u64
source§fn vec_from_other_type_slice(xs: &[u128]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u128]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a smaller unsigned
type.
Each value of the input slice will be broken up into several values in the output
Vec
.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = 2^{V-W}n$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<u128> for u128
impl VecFromOtherTypeSlice<u128> for u128
source§fn vec_from_other_type_slice(xs: &[u128]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u128]) -> Vec<Self>
source§impl VecFromOtherTypeSlice<u128> for usize
impl VecFromOtherTypeSlice<u128> for usize
source§fn vec_from_other_type_slice(xs: &[u128]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[u128]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a smaller unsigned
type.
Each value of the input slice will be broken up into several values in the output
Vec
.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = 2^{V-W}n$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<usize> for u8
impl VecFromOtherTypeSlice<usize> for u8
source§fn vec_from_other_type_slice(xs: &[usize]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[usize]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a smaller unsigned
type.
Each value of the input slice will be broken up into several values in the output
Vec
.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = 2^{V-W}n$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<usize> for u16
impl VecFromOtherTypeSlice<usize> for u16
source§fn vec_from_other_type_slice(xs: &[usize]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[usize]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a smaller unsigned
type.
Each value of the input slice will be broken up into several values in the output
Vec
.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = 2^{V-W}n$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.
source§impl VecFromOtherTypeSlice<usize> for u32
impl VecFromOtherTypeSlice<usize> for u32
source§impl VecFromOtherTypeSlice<usize> for u64
impl VecFromOtherTypeSlice<usize> for u64
source§impl VecFromOtherTypeSlice<usize> for u128
impl VecFromOtherTypeSlice<usize> for u128
source§fn vec_from_other_type_slice(xs: &[usize]) -> Vec<Self>
fn vec_from_other_type_slice(xs: &[usize]) -> Vec<Self>
Converts a slice of one type of unsigned integer to a Vec
of a larger unsigned
type.
Adjacent chunks of values in the input slice will be joined into values of the
output Vec
. If the last few elements of the input slice don’t make up a full
chunk, the most-significant bits of the last output value are set to 0.
Let $V$ be the the width of the input type and $W$ the width of the output type.
$f((x_k)_ {k=0}^{n-1}) = (y_k)_ {k=0}^{m-1}$, where
$$ \sum_{j=0}^{n-1}2^{jV}x_j = \sum_{j=0}^{m-1}2^{jW}y_j, $$
$y_j < 2^W$ for all $j$, and $m = \lceil n / 2^{W-V} \rceil$.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(n)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
See here.