Rust no longer requires extern crate calls as of the 2018 update.

Update all the examples to work with the spellbook Array class as well.
This commit is contained in:
2019-01-20 20:38:42 -05:00
parent 3e4094a50c
commit eec868b406
7 changed files with 41 additions and 66 deletions

View File

@ -1,11 +1,7 @@
extern crate weave;
extern crate alchemy;
use weave::Error;
use spellbook::components::Array;
use alchemy::{Converter, Endianess, PlatformEndian, Transmutable};
use alchemy::platform_to_network_order;
@ -14,11 +10,11 @@ use alchemy::platform_to_network_order;
fn use_converter()
{
let num: u16;
let mut buffer: Vec<u8>;
let mut buffer: Array<u8>;
// Initialize the variables.
num = 32832u16;
buffer = Vec::new();
buffer = Array::new();
println!("Converting the value {} into and out of an array of bytes.", num);
println!("Buffer starts as: {}", stringify_array(buffer.as_slice()));
@ -47,11 +43,11 @@ pub fn use_transmutable()
{
let num: u16;
let endianess: Endianess;
let mut buffer: Vec<u8>;
let mut buffer: Array<u8>;
// Initialize the variables.
num = 32832u16;
buffer = Vec::new();
buffer = Array::new();
endianess = Endianess::Platform;
println!("Converting the value {} into and out of an array of bytes.", num);