pub trait PrimitiveJoin<T, U, const LEN: usize> {
// Required methods
fn from_array_be(values: [U; LEN]) -> T;
fn from_array_le(values: [U; LEN]) -> T;
fn from_array_ne(values: [U; LEN]) -> T;
fn from_slice_be(values: &[U]) -> T;
fn from_slice_le(values: &[U]) -> T;
fn from_slice_ne(values: &[U]) -> T;
}
join
only.Expand description
Offers methods to construct a primitive from an array or slice of smaller primitives.
Methods expecting an array are more efficient than the ones expecting an slice. On the other hand slices of any lenght are supported as follows:
- If the slice contains fewer elements than required, the method will fill in the missing values with zeros.
- If the slice contains more elements than required, the method will ignore the extra elements.
See also the Cast
type for the equivalent const methods, and the
PrimitiveSplit
trait for the opposite operations.
Required Methods§
Sourcefn from_array_be(values: [U; LEN]) -> T
fn from_array_be(values: [U; LEN]) -> T
Constructs a primitive T
from an array of U
in big-endian order.
Sourcefn from_array_le(values: [U; LEN]) -> T
fn from_array_le(values: [U; LEN]) -> T
Constructs a primitive T
from an array of U
in little-endian order.
Sourcefn from_array_ne(values: [U; LEN]) -> T
fn from_array_ne(values: [U; LEN]) -> T
Constructs a primitive T
from an array of U
in native-endian order.
Sourcefn from_slice_be(values: &[U]) -> T
fn from_slice_be(values: &[U]) -> T
Constructs a primitive T
from a slice of U
in big-endian order.
Sourcefn from_slice_le(values: &[U]) -> T
fn from_slice_le(values: &[U]) -> T
Constructs a primitive T
from a slice of U
in little-endian order.
Sourcefn from_slice_ne(values: &[U]) -> T
fn from_slice_ne(values: &[U]) -> T
Constructs a primitive T
from a slice of U
in native-endian order.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.