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§

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl VecFromOtherTypeSlice<u8> for u8

source§

fn vec_from_other_type_slice(xs: &[u8]) -> Vec<Self>

Converts a slice of one type of value to a Vec of the same type.

In this case, it just converts the slice to a Vec the usual way.

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn vec_from_other_type_slice(xs: &[u16]) -> Vec<Self>

Converts a slice of one type of value to a Vec of the same type.

In this case, it just converts the slice to a Vec the usual way.

§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 u32

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

fn vec_from_other_type_slice(xs: &[u32]) -> Vec<Self>

Converts a slice of one type of value to a Vec of the same type.

In this case, it just converts the slice to a Vec the usual way.

§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 u64

source§

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

source§

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

source§

fn vec_from_other_type_slice(xs: &[u32]) -> Vec<Self>

Converts a slice of u32s to a Vec of usizes.

§Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is xs.len().

See here.

source§

impl VecFromOtherTypeSlice<u64> for u8

source§

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

source§

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

source§

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

source§

fn vec_from_other_type_slice(xs: &[u64]) -> Vec<Self>

Converts a slice of one type of value to a Vec of the same type.

In this case, it just converts the slice to a Vec the usual way.

§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 u128

source§

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

source§

fn vec_from_other_type_slice(xs: &[u64]) -> Vec<Self>

Converts a slice of u64s to a Vec of usizes.

§Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is xs.len().

See here.

source§

impl VecFromOtherTypeSlice<u128> for u8

source§

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

source§

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

source§

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

source§

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

source§

fn vec_from_other_type_slice(xs: &[u128]) -> Vec<Self>

Converts a slice of one type of value to a Vec of the same type.

In this case, it just converts the slice to a Vec the usual way.

§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 usize

source§

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

source§

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

source§

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

source§

fn vec_from_other_type_slice(xs: &[usize]) -> Vec<Self>

Converts a slice of usizes to a Vec of u32s.

§Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is xs.len().

See here.

source§

impl VecFromOtherTypeSlice<usize> for u64

source§

fn vec_from_other_type_slice(xs: &[usize]) -> Vec<Self>

Converts a slice of usizes to a Vec of u64s.

§Worst-case complexity

$T(n) = O(n)$

$M(n) = O(n)$

where $T$ is time, $M$ is additional memory, and $n$ is xs.len().

See here.

source§

impl VecFromOtherTypeSlice<usize> for u128

source§

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.

source§

impl VecFromOtherTypeSlice<usize> for usize

source§

fn vec_from_other_type_slice(xs: &[usize]) -> Vec<Self>

Converts a slice of one type of value to a Vec of the same type.

In this case, it just converts the slice to a Vec the usual way.

§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.

Implementors§