pub trait PrimitiveInteger:
Sealed
+ Debug
+ Clone
+ Copy
+ PartialEq
+ Eq
+ PartialOrd
+ Ord
+ Add<Output = Self>
+ Sub<Output = Self>
+ Mul<Output = Self>
+ Div<Output = Self>
+ Rem<Output = Self>
+ Shl<Output = Self>
+ Shr<Output = Self>
+ BitAnd<Output = Self>
+ BitOr<Output = Self>
+ BitXor<Output = Self>
+ Sum
+ Product
+ Scalar
+ Zero
+ One
+ PrimitiveIntegerUtils
+ IntegerVectorBackend<2, Aligned>
+ IntegerVectorBackend<3, Aligned>
+ IntegerVectorBackend<4, Aligned>
+ IntegerVectorBackend<2, Unaligned>
+ IntegerVectorBackend<3, Unaligned>
+ IntegerVectorBackend<4, Unaligned>
+ PrimitiveInteger { }Expand description
A trait for all primitive integer types.
Implemented for i8, i16, i32, i64, i128, isize,
u8, u16, u32, u64, u128 and usize.
This trait can be used in generic contexts to access integer-specific functionality for vectors, matrices, etc. This trait does not expose any functions directly.
Currently many integer functions cannot be used in generic contexts because their names conflict with floating-point functions. When the type system allows this, all functions will be available.
§Examples
fn example<T: PrimitiveInteger>(vector: Vec3<T>) -> Vec3<T> {
vector.wrapping_add(vector)
}
assert_eq!(
example::<i32>(Vec3::new(1, 2, 3)),
Vec3::new(2, 4, 6),
);Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".