Changing to match the Spellbook DynamicArray to Array naming switch.

This commit is contained in:
Myrddin Dundragon 2017-11-28 18:47:35 -05:00
parent 6a9e75a05c
commit 5aa603e246
4 changed files with 80 additions and 80 deletions

View File

@ -1,6 +1,6 @@
use std::mem; use std::mem;
use spellbook::components::DynamicArray; use spellbook::components::Array;
use ::byte_sized::ByteSized; use ::byte_sized::ByteSized;
@ -91,7 +91,7 @@ pub trait Converter
/// # Panics /// # Panics
/// This will panic if the buffer does not have /// This will panic if the buffer does not have
/// enough space to store the converted value. /// enough space to store the converted value.
fn i16_to_bytes(num: i16) -> DynamicArray<u8> fn i16_to_bytes(num: i16) -> Array<u8>
{ {
Self::u16_to_bytes(num as u16) Self::u16_to_bytes(num as u16)
} }
@ -102,7 +102,7 @@ pub trait Converter
/// # Panics /// # Panics
/// This will panic if the buffer does not have /// This will panic if the buffer does not have
/// enough space to store the converted value. /// enough space to store the converted value.
fn i32_to_bytes(num: i32) -> DynamicArray<u8> fn i32_to_bytes(num: i32) -> Array<u8>
{ {
Self::u32_to_bytes(num as u32) Self::u32_to_bytes(num as u32)
} }
@ -113,7 +113,7 @@ pub trait Converter
/// # Panics /// # Panics
/// This will panic if the buffer does not have /// This will panic if the buffer does not have
/// enough space to store the converted value. /// enough space to store the converted value.
fn i64_to_bytes(num: i64) -> DynamicArray<u8> fn i64_to_bytes(num: i64) -> Array<u8>
{ {
Self::u64_to_bytes(num as u64) Self::u64_to_bytes(num as u64)
} }
@ -128,7 +128,7 @@ pub trait Converter
/// This will panic if the number of bytes /// This will panic if the number of bytes
/// passed in is less than the byte size of the given number /// passed in is less than the byte size of the given number
/// or more than eight. /// or more than eight.
fn isize_to_bytes(num: isize) -> DynamicArray<u8> fn isize_to_bytes(num: isize) -> Array<u8>
{ {
let temp_num: usize; let temp_num: usize;
@ -142,7 +142,7 @@ pub trait Converter
/// # Panics /// # Panics
/// This will panic if the buffer does not have /// This will panic if the buffer does not have
/// enough space to store the converted value. /// enough space to store the converted value.
fn f32_to_bytes(num: f32) -> DynamicArray<u8> fn f32_to_bytes(num: f32) -> Array<u8>
{ {
unsafe unsafe
{ {
@ -156,7 +156,7 @@ pub trait Converter
/// # Panics /// # Panics
/// This will panic if the buffer does not have /// This will panic if the buffer does not have
/// enough space to store the converted value. /// enough space to store the converted value.
fn f64_to_bytes(num: f64) -> DynamicArray<u8> fn f64_to_bytes(num: f64) -> Array<u8>
{ {
unsafe unsafe
{ {
@ -204,7 +204,7 @@ pub trait Converter
/// # Panics /// # Panics
/// This will panic if the buffer does not have /// This will panic if the buffer does not have
/// enough space to store the converted value. /// enough space to store the converted value.
fn u16_to_bytes(num: u16) -> DynamicArray<u8>; fn u16_to_bytes(num: u16) -> Array<u8>;
/// Converts an unsigned 32-bit integer to bytes /// Converts an unsigned 32-bit integer to bytes
/// and places them into the given buffer. /// and places them into the given buffer.
@ -212,7 +212,7 @@ pub trait Converter
/// # Panics /// # Panics
/// This will panic if the buffer does not have /// This will panic if the buffer does not have
/// enough space to store the converted value. /// enough space to store the converted value.
fn u32_to_bytes(num: u32) -> DynamicArray<u8>; fn u32_to_bytes(num: u32) -> Array<u8>;
/// Converts an unsigned 64-bit integer to bytes /// Converts an unsigned 64-bit integer to bytes
/// and places them into the given buffer. /// and places them into the given buffer.
@ -220,7 +220,7 @@ pub trait Converter
/// # Panics /// # Panics
/// This will panic if the buffer does not have /// This will panic if the buffer does not have
/// enough space to store the converted value. /// enough space to store the converted value.
fn u64_to_bytes(num: u64) -> DynamicArray<u8>; fn u64_to_bytes(num: u64) -> Array<u8>;
/// Converts an unsigned integer to bytes /// Converts an unsigned integer to bytes
/// and places them into the given buffer. /// and places them into the given buffer.
@ -232,7 +232,7 @@ pub trait Converter
/// This will panic if the number of bytes /// This will panic if the number of bytes
/// passed in is less than the byte size of the given number /// passed in is less than the byte size of the given number
/// or more than eight. /// or more than eight.
fn usize_to_bytes(num: usize) -> DynamicArray<u8>; fn usize_to_bytes(num: usize) -> Array<u8>;
/// Converts a String to bytes /// Converts a String to bytes
@ -252,7 +252,7 @@ pub trait Converter
/// # Panics /// # Panics
/// This will panic if the buffer does not have /// This will panic if the buffer does not have
/// enough information to convert. /// enough information to convert.
fn string_to_bytes(string: String) -> DynamicArray<u8>; fn string_to_bytes(string: String) -> Array<u8>;
} }

View File

@ -1,4 +1,4 @@
use spellbook::components::DynamicArray; use spellbook::components::Array;
use ::byte_sized::ByteSized; use ::byte_sized::ByteSized;
use ::byte_sized::U64_BYTES; use ::byte_sized::U64_BYTES;
@ -146,25 +146,25 @@ impl Converter for BigEndian
} }
fn u16_to_bytes(num: u16) -> DynamicArray<u8> fn u16_to_bytes(num: u16) -> Array<u8>
{ {
// Unpack the value into it's byte form. // Unpack the value into it's byte form.
unpack_big_endian!(num, u16::BYTES) unpack_big_endian!(num, u16::BYTES)
} }
fn u32_to_bytes(num: u32) -> DynamicArray<u8> fn u32_to_bytes(num: u32) -> Array<u8>
{ {
// Unpack the value into it's byte form. // Unpack the value into it's byte form.
unpack_big_endian!(num, u32::BYTES) unpack_big_endian!(num, u32::BYTES)
} }
fn u64_to_bytes(num: u64) -> DynamicArray<u8> fn u64_to_bytes(num: u64) -> Array<u8>
{ {
// Unpack the value into it's byte form. // Unpack the value into it's byte form.
unpack_big_endian!(num, u64::BYTES) unpack_big_endian!(num, u64::BYTES)
} }
fn usize_to_bytes(num: usize) -> DynamicArray<u8> fn usize_to_bytes(num: usize) -> Array<u8>
{ {
// Unpack the value into it's byte form. // Unpack the value into it's byte form.
unpack_big_endian!(num, usize::BYTES) unpack_big_endian!(num, usize::BYTES)
@ -206,11 +206,11 @@ impl Converter for BigEndian
new_string new_string
} }
fn string_to_bytes(string: String) -> DynamicArray<u8> fn string_to_bytes(string: String) -> Array<u8>
{ {
let bytes: &[u8]; let bytes: &[u8];
let byte_count: u64; let byte_count: u64;
let mut buffer: DynamicArray<u8>; let mut buffer: Array<u8>;
// Turn the string into a byte array. // Turn the string into a byte array.
bytes = string.as_bytes(); bytes = string.as_bytes();
@ -220,7 +220,7 @@ impl Converter for BigEndian
byte_count = bytes.len() as u64; byte_count = bytes.len() as u64;
// Make sure the buffer has enough space for this string. // Make sure the buffer has enough space for this string.
buffer = DynamicArray::with_capacity(bytes.len() + U64_BYTES); buffer = Array::with_capacity(bytes.len() + U64_BYTES);
// Add the count to the buffer. // Add the count to the buffer.
buffer.append(&mut BigEndian::u64_to_bytes(byte_count)); buffer.append(&mut BigEndian::u64_to_bytes(byte_count));
@ -274,25 +274,25 @@ impl Converter for LittleEndian
} }
fn u16_to_bytes(num: u16) -> DynamicArray<u8> fn u16_to_bytes(num: u16) -> Array<u8>
{ {
// Unpack the value into it's byte form. // Unpack the value into it's byte form.
unpack_little_endian!(num, u16::BYTES) unpack_little_endian!(num, u16::BYTES)
} }
fn u32_to_bytes(num: u32) -> DynamicArray<u8> fn u32_to_bytes(num: u32) -> Array<u8>
{ {
// Unpack the value into it's byte form. // Unpack the value into it's byte form.
unpack_little_endian!(num, u32::BYTES) unpack_little_endian!(num, u32::BYTES)
} }
fn u64_to_bytes(num: u64) -> DynamicArray<u8> fn u64_to_bytes(num: u64) -> Array<u8>
{ {
// Unpack the value into it's byte form. // Unpack the value into it's byte form.
unpack_little_endian!(num, u64::BYTES) unpack_little_endian!(num, u64::BYTES)
} }
fn usize_to_bytes(num: usize) -> DynamicArray<u8> fn usize_to_bytes(num: usize) -> Array<u8>
{ {
// Unpack the value into it's byte form. // Unpack the value into it's byte form.
unpack_little_endian!(num, usize::BYTES) unpack_little_endian!(num, usize::BYTES)
@ -334,11 +334,11 @@ impl Converter for LittleEndian
new_string new_string
} }
fn string_to_bytes(string: String) -> DynamicArray<u8> fn string_to_bytes(string: String) -> Array<u8>
{ {
let bytes: &[u8]; let bytes: &[u8];
let byte_count: u64; let byte_count: u64;
let mut buffer: DynamicArray<u8>; let mut buffer: Array<u8>;
// Turn the string into a byte array. // Turn the string into a byte array.
bytes = string.as_bytes(); bytes = string.as_bytes();
@ -348,7 +348,7 @@ impl Converter for LittleEndian
byte_count = bytes.len() as u64; byte_count = bytes.len() as u64;
// Make sure the buffer has enough space for this string. // Make sure the buffer has enough space for this string.
buffer = DynamicArray::with_capacity(bytes.len() + U64_BYTES); buffer = Array::with_capacity(bytes.len() + U64_BYTES);
// Add the count to the buffer. // Add the count to the buffer.
buffer.append(&mut LittleEndian::u64_to_bytes(byte_count)); buffer.append(&mut LittleEndian::u64_to_bytes(byte_count));

View File

@ -63,11 +63,11 @@ macro_rules! unpack_big_endian
($value: expr, $bytes: expr) => ($value: expr, $bytes: expr) =>
{ {
{ {
let mut buffer: ::spellbook::components::DynamicArray<u8>; let mut buffer: ::spellbook::components::Array<u8>;
// Create an array with enough space for this value // Create an array with enough space for this value
// and then bit shift the value into a buffer of bytes. // and then bit shift the value into a buffer of bytes.
buffer = ::spellbook::components::DynamicArray::with_capacity($bytes); buffer = ::spellbook::components::Array::with_capacity($bytes);
for i in 0..$bytes for i in 0..$bytes
{ {
buffer.push(($value >> (($bytes - i) - 1) * 8) as u8); buffer.push(($value >> (($bytes - i) - 1) * 8) as u8);
@ -85,11 +85,11 @@ macro_rules! unpack_little_endian
($value: expr, $bytes: expr) => ($value: expr, $bytes: expr) =>
{ {
{ {
let mut buffer: ::spellbook::components::DynamicArray<u8>; let mut buffer: ::spellbook::components::Array<u8>;
// Create an array with enough space for this value // Create an array with enough space for this value
// and then bit shift the value into a buffer of bytes. // and then bit shift the value into a buffer of bytes.
buffer = ::spellbook::components::DynamicArray::with_capacity($bytes); buffer = ::spellbook::components::Array::with_capacity($bytes);
for i in 0..$bytes for i in 0..$bytes
{ {
buffer.push(($value >> (i * 8)) as u8); buffer.push(($value >> (i * 8)) as u8);
@ -107,7 +107,7 @@ macro_rules! swap_big_to_little_endian
($value: expr, $target_type: ty, $bytes: expr) => ($value: expr, $target_type: ty, $bytes: expr) =>
{ {
{ {
let buffer: ::spellbook::components::DynamicArray<u8>; let buffer: ::spellbook::components::Array<u8>;
// Convert the big endian value to bytes. // Convert the big endian value to bytes.
buffer = unpack_big_endian!($value, $bytes); buffer = unpack_big_endian!($value, $bytes);
@ -124,7 +124,7 @@ macro_rules! swap_little_to_big_endian
($value: expr, $target_type: ty, $bytes: expr) => ($value: expr, $target_type: ty, $bytes: expr) =>
{ {
{ {
let buffer: ::spellbook::components::DynamicArray<u8>; let buffer: ::spellbook::components::Array<u8>;
// Convert the little endian value to bytes. // Convert the little endian value to bytes.
buffer = unpack_little_endian!($value, $bytes); buffer = unpack_little_endian!($value, $bytes);

View File

@ -1,10 +1,10 @@
use spellbook::components::DynamicArray; use spellbook::components::Array;
#[cfg(feature="convert_sigils")] #[cfg(feature="convert_sigils")]
use sigils::{Zero, Number, Real}; use sigils::{Zero, Number, Real};
#[cfg(feature="convert_sigils")] #[cfg(feature="convert_sigils")]
use sigils::vector::{DynamicArraytor, DynamicArraytor2, DynamicArraytor3, DynamicArraytor4}; use sigils::vector::{Arraytor, Arraytor2, Arraytor3, Arraytor4};
#[cfg(feature="convert_sigils")] #[cfg(feature="convert_sigils")]
use sigils::quaternion::Quaternion; use sigils::quaternion::Quaternion;
@ -35,14 +35,14 @@ pub trait Transmutable: Sized
/// Transmute this type to an array of bytes in /// Transmute this type to an array of bytes in
/// the Platform's endian. /// the Platform's endian.
fn to_bytes(self) -> DynamicArray<u8> fn to_bytes(self) -> Array<u8>
{ {
self.as_endian_bytes(Endianess::Platform) self.as_endian_bytes(Endianess::Platform)
} }
/// Transmute this type to an array of bytes in /// Transmute this type to an array of bytes in
/// the desired endian. /// the desired endian.
fn to_endian_bytes(self, endianess: Endianess) -> DynamicArray<u8> fn to_endian_bytes(self, endianess: Endianess) -> Array<u8>
{ {
self.as_endian_bytes(endianess) self.as_endian_bytes(endianess)
} }
@ -50,14 +50,14 @@ pub trait Transmutable: Sized
/// Transmute this type to an array of bytes in /// Transmute this type to an array of bytes in
/// the Platform's endian. /// the Platform's endian.
fn as_bytes(&self) -> DynamicArray<u8> fn as_bytes(&self) -> Array<u8>
{ {
self.as_endian_bytes(Endianess::Platform) self.as_endian_bytes(Endianess::Platform)
} }
/// Transmute this type to an array of bytes in /// Transmute this type to an array of bytes in
/// the desired endian. /// the desired endian.
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8>; fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>;
/// Get the current size of this Transmutable in bytes. /// Get the current size of this Transmutable in bytes.
@ -149,7 +149,7 @@ impl Transmutable for u8
} }
#[allow(unused_variables)] #[allow(unused_variables)]
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
// A single byte has no endian form. // A single byte has no endian form.
vec![*self] vec![*self]
@ -173,7 +173,7 @@ impl Transmutable for u16
handle_endianess_from_bytes!(buffer, endianess, bytes_to_u16) handle_endianess_from_bytes!(buffer, endianess, bytes_to_u16)
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
// Return the Endianess conversion. // Return the Endianess conversion.
handle_endianess_to_bytes!(self, endianess, u16_to_bytes) handle_endianess_to_bytes!(self, endianess, u16_to_bytes)
@ -197,7 +197,7 @@ impl Transmutable for u32
handle_endianess_from_bytes!(buffer, endianess, bytes_to_u32) handle_endianess_from_bytes!(buffer, endianess, bytes_to_u32)
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
handle_endianess_to_bytes!(self, endianess, u32_to_bytes) handle_endianess_to_bytes!(self, endianess, u32_to_bytes)
@ -221,7 +221,7 @@ impl Transmutable for u64
handle_endianess_from_bytes!(buffer, endianess, bytes_to_u64) handle_endianess_from_bytes!(buffer, endianess, bytes_to_u64)
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
handle_endianess_to_bytes!(self, endianess, u64_to_bytes) handle_endianess_to_bytes!(self, endianess, u64_to_bytes)
@ -245,7 +245,7 @@ impl Transmutable for usize
handle_endianess_from_bytes!(buffer, endianess, bytes_to_usize) handle_endianess_from_bytes!(buffer, endianess, bytes_to_usize)
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
handle_endianess_to_bytes!(self, endianess, usize_to_bytes) handle_endianess_to_bytes!(self, endianess, usize_to_bytes)
@ -270,7 +270,7 @@ impl Transmutable for i8
} }
#[allow(unused_variables)] #[allow(unused_variables)]
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
vec![*self as u8] vec![*self as u8]
} }
@ -293,7 +293,7 @@ impl Transmutable for i16
handle_endianess_from_bytes!(buffer, endianess, bytes_to_i16) handle_endianess_from_bytes!(buffer, endianess, bytes_to_i16)
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
handle_endianess_to_bytes!(self, endianess, i16_to_bytes) handle_endianess_to_bytes!(self, endianess, i16_to_bytes)
@ -317,7 +317,7 @@ impl Transmutable for i32
handle_endianess_from_bytes!(buffer, endianess, bytes_to_i32) handle_endianess_from_bytes!(buffer, endianess, bytes_to_i32)
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
handle_endianess_to_bytes!(self, endianess, i32_to_bytes) handle_endianess_to_bytes!(self, endianess, i32_to_bytes)
@ -341,7 +341,7 @@ impl Transmutable for i64
handle_endianess_from_bytes!(buffer, endianess, bytes_to_i64) handle_endianess_from_bytes!(buffer, endianess, bytes_to_i64)
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
handle_endianess_to_bytes!(self, endianess, i64_to_bytes) handle_endianess_to_bytes!(self, endianess, i64_to_bytes)
@ -365,7 +365,7 @@ impl Transmutable for isize
handle_endianess_from_bytes!(buffer, endianess, bytes_to_isize) handle_endianess_from_bytes!(buffer, endianess, bytes_to_isize)
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
handle_endianess_to_bytes!(self, endianess, isize_to_bytes) handle_endianess_to_bytes!(self, endianess, isize_to_bytes)
@ -389,7 +389,7 @@ impl Transmutable for f32
handle_endianess_from_bytes!(buffer, endianess, bytes_to_f32) handle_endianess_from_bytes!(buffer, endianess, bytes_to_f32)
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
handle_endianess_to_bytes!(self, endianess, f32_to_bytes) handle_endianess_to_bytes!(self, endianess, f32_to_bytes)
@ -413,7 +413,7 @@ impl Transmutable for f64
handle_endianess_from_bytes!(buffer, endianess, bytes_to_f64) handle_endianess_from_bytes!(buffer, endianess, bytes_to_f64)
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
handle_endianess_to_bytes!(self, endianess, f64_to_bytes) handle_endianess_to_bytes!(self, endianess, f64_to_bytes)
@ -433,7 +433,7 @@ impl Transmutable for String
handle_endianess_from_bytes!(buffer, endianess, bytes_to_string) handle_endianess_from_bytes!(buffer, endianess, bytes_to_string)
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
// We are not using the macro because *String is a str. // We are not using the macro because *String is a str.
@ -468,17 +468,17 @@ impl Transmutable for String
} }
#[cfg(feature="convert_sigils")] #[cfg(feature="convert_sigils")]
impl<T> Transmutable for DynamicArraytor2<T> where T: Number + ByteSized + Transmutable impl<T> Transmutable for Arraytor2<T> where T: Number + ByteSized + Transmutable
{ {
fn from_endian_bytes(buffer: &[u8], endianess: Endianess) -> Self fn from_endian_bytes(buffer: &[u8], endianess: Endianess) -> Self
{ {
let byte_size: usize; let byte_size: usize;
let num_bytes: usize; let num_bytes: usize;
let mut vec: DynamicArraytor2<T>; let mut vec: Arraytor2<T>;
// Determine the number of bytes requires to // Determine the number of bytes requires to
// represent a DynamicArraytor2. // represent a Arraytor2.
vec = DynamicArraytor2::<T>::zero(); vec = Arraytor2::<T>::zero();
byte_size = T::get_byte_size(); byte_size = T::get_byte_size();
num_bytes = byte_size * vec.get_size() as usize; num_bytes = byte_size * vec.get_size() as usize;
@ -494,20 +494,20 @@ impl<T> Transmutable for DynamicArraytor2<T> where T: Number + ByteSized + Trans
vec vec
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
let byte_size: usize; let byte_size: usize;
let num_bytes: usize; let num_bytes: usize;
let mut buffer: DynamicArray<u8>; let mut buffer: Array<u8>;
// Determine the number of bytes requires to // Determine the number of bytes requires to
// represent a DynamicArraytor2. // represent a Arraytor2.
byte_size = T::get_byte_size(); byte_size = T::get_byte_size();
num_bytes = byte_size * self.get_size() as usize; num_bytes = byte_size * self.get_size() as usize;
// Make sure that there is enough space to store // Make sure that there is enough space to store
// the bytes from this type. // the bytes from this type.
buffer = DynamicArray::with_capacity(num_bytes); buffer = Array::with_capacity(num_bytes);
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
buffer.append(&mut self.x.as_endian_bytes(endianess)); buffer.append(&mut self.x.as_endian_bytes(endianess));
@ -524,17 +524,17 @@ impl<T> Transmutable for DynamicArraytor2<T> where T: Number + ByteSized + Trans
} }
#[cfg(feature="convert_sigils")] #[cfg(feature="convert_sigils")]
impl<T> Transmutable for DynamicArraytor3<T> where T: Number + ByteSized + Transmutable impl<T> Transmutable for Arraytor3<T> where T: Number + ByteSized + Transmutable
{ {
fn from_endian_bytes(buffer: &[u8], endianess: Endianess) -> Self fn from_endian_bytes(buffer: &[u8], endianess: Endianess) -> Self
{ {
let byte_size: usize; let byte_size: usize;
let num_bytes: usize; let num_bytes: usize;
let mut vec: DynamicArraytor3<T>; let mut vec: Arraytor3<T>;
// Determine the number of bytes requires to // Determine the number of bytes requires to
// represent a DynamicArraytor3. // represent a Arraytor3.
vec = DynamicArraytor3::<T>::zero(); vec = Arraytor3::<T>::zero();
byte_size = T::get_byte_size(); byte_size = T::get_byte_size();
num_bytes = byte_size * vec.get_size() as usize; num_bytes = byte_size * vec.get_size() as usize;
@ -552,20 +552,20 @@ impl<T> Transmutable for DynamicArraytor3<T> where T: Number + ByteSized + Trans
vec vec
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
let byte_size: usize; let byte_size: usize;
let num_bytes: usize; let num_bytes: usize;
let mut buffer: DynamicArray<u8>; let mut buffer: Array<u8>;
// Determine the number of bytes requires to // Determine the number of bytes requires to
// represent a DynamicArraytor3. // represent a Arraytor3.
byte_size = T::get_byte_size(); byte_size = T::get_byte_size();
num_bytes = byte_size * self.get_size() as usize; num_bytes = byte_size * self.get_size() as usize;
// Make sure that there is enough space to store // Make sure that there is enough space to store
// the bytes from this type. // the bytes from this type.
buffer = DynamicArray::with_capacity(num_bytes); buffer = Array::with_capacity(num_bytes);
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
buffer.append(&mut self.x.as_endian_bytes(endianess)); buffer.append(&mut self.x.as_endian_bytes(endianess));
@ -583,17 +583,17 @@ impl<T> Transmutable for DynamicArraytor3<T> where T: Number + ByteSized + Trans
} }
#[cfg(feature="convert_sigils")] #[cfg(feature="convert_sigils")]
impl<T> Transmutable for DynamicArraytor4<T> where T: Number + ByteSized + Transmutable impl<T> Transmutable for Arraytor4<T> where T: Number + ByteSized + Transmutable
{ {
fn from_endian_bytes(buffer: &[u8], endianess: Endianess) -> Self fn from_endian_bytes(buffer: &[u8], endianess: Endianess) -> Self
{ {
let byte_size: usize; let byte_size: usize;
let num_bytes: usize; let num_bytes: usize;
let mut vec: DynamicArraytor4<T>; let mut vec: Arraytor4<T>;
// Determine the number of bytes requires to // Determine the number of bytes requires to
// represent a DynamicArraytor4. // represent a Arraytor4.
vec = DynamicArraytor4::<T>::zero(); vec = Arraytor4::<T>::zero();
byte_size = T::get_byte_size(); byte_size = T::get_byte_size();
num_bytes = byte_size * vec.get_size() as usize; num_bytes = byte_size * vec.get_size() as usize;
@ -613,20 +613,20 @@ impl<T> Transmutable for DynamicArraytor4<T> where T: Number + ByteSized + Trans
vec vec
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
let byte_size: usize; let byte_size: usize;
let num_bytes: usize; let num_bytes: usize;
let mut buffer: DynamicArray<u8>; let mut buffer: Array<u8>;
// Determine the number of bytes requires to // Determine the number of bytes requires to
// represent a DynamicArraytor4. // represent a Arraytor4.
byte_size = T::get_byte_size(); byte_size = T::get_byte_size();
num_bytes = byte_size * self.get_size() as usize; num_bytes = byte_size * self.get_size() as usize;
// Make sure that there is enough space to store // Make sure that there is enough space to store
// the bytes from this type. // the bytes from this type.
buffer = DynamicArray::with_capacity(num_bytes); buffer = Array::with_capacity(num_bytes);
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
buffer.append(&mut self.x.as_endian_bytes(endianess)); buffer.append(&mut self.x.as_endian_bytes(endianess));
@ -667,16 +667,16 @@ impl<T> Transmutable for Quaternion<T>
// Convert the given bytes to this type and return it. // Convert the given bytes to this type and return it.
quat.scalar = T::from_endian_bytes(&buffer[0..byte_size], endianess); quat.scalar = T::from_endian_bytes(&buffer[0..byte_size], endianess);
quat.vector = quat.vector =
DynamicArraytor3::<T>::from_endian_bytes(&buffer[byte_size..num_bytes], Arraytor3::<T>::from_endian_bytes(&buffer[byte_size..num_bytes],
endianess); endianess);
quat quat
} }
fn as_endian_bytes(&self, endianess: Endianess) -> DynamicArray<u8> fn as_endian_bytes(&self, endianess: Endianess) -> Array<u8>
{ {
let byte_size: usize; let byte_size: usize;
let num_bytes: usize; let num_bytes: usize;
let mut buffer: DynamicArray<u8>; let mut buffer: Array<u8>;
// Determine the number of bytes requires to // Determine the number of bytes requires to
// represent a Quaternion. // represent a Quaternion.
@ -685,7 +685,7 @@ impl<T> Transmutable for Quaternion<T>
// Make sure that there is enough space to store // Make sure that there is enough space to store
// the bytes from this type. // the bytes from this type.
buffer = DynamicArray::with_capacity(num_bytes); buffer = Array::with_capacity(num_bytes);
// Convert this to bytes and add it to the buffer. // Convert this to bytes and add it to the buffer.
buffer.append(&mut self.scalar.as_endian_bytes(endianess)); buffer.append(&mut self.scalar.as_endian_bytes(endianess));