Created a trait for specifying byte size for a type.
There is now a ByteSized trait that can be used to specify how many bytes it takes to represent a piece of data. This has been implemented for all of the primitive number types. With this information Transmutable was able to create a Vector2 wrapper that will need to be tested. If it works then soon after Vectors and other Sigils types can be turned into Transmutable types. This also has the changes for the original tests and example to use the new ByteSized information.
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
extern crate alchemy;
|
||||
|
||||
|
||||
use alchemy::F32_BYTES;
|
||||
use alchemy::{Converter, PlatformEndian};
|
||||
|
||||
|
||||
@ -11,11 +12,11 @@ pub fn main()
|
||||
{
|
||||
let num: f32;
|
||||
let final_num: f32;
|
||||
let mut buffer: [u8; 4];
|
||||
let mut buffer: [u8; F32_BYTES];
|
||||
|
||||
// Initialize the variables.
|
||||
num = 6.291985f32;
|
||||
buffer = [0u8; 4];
|
||||
buffer = [0u8; F32_BYTES];
|
||||
|
||||
println!("Converting the value {} into and out of an array of bytes.", num);
|
||||
println!("Buffer starts as: {}", stringify_array(&buffer));
|
||||
|
Reference in New Issue
Block a user