Changed the name of to_bytes to as_bytes to conform to other code.

An into_bytes function, which just called as_bytes, was decided as not
being needed because it would require that the Transmutable trait have
the requirement of being Sized. This may not be desirable in the future,
so for now there is no into_bytes. It can easily be added later with
a change to 9 lines of code.
This commit is contained in:
Myrddin Dundragon 2016-12-22 13:47:56 -05:00
parent 04c94db9f5
commit 143a6d60bc
2 changed files with 542 additions and 523 deletions

View File

@ -505,7 +505,7 @@ pub fn network_to_platform_order<T>(val: T) -> T
else else
{ {
// Convert the value from Big endian to Little endian. // Convert the value from Big endian to Little endian.
buffer = val.to_endian_bytes(Endianess::Network); buffer = val.as_endian_bytes(Endianess::Network);
T::from_endian_bytes(buffer.as_slice(), Endianess::Platform) T::from_endian_bytes(buffer.as_slice(), Endianess::Platform)
} }
} }
@ -526,7 +526,7 @@ pub fn platform_to_network_order<T>(val: T) -> T
else else
{ {
// Convert the value from Little endian to Big endian. // Convert the value from Little endian to Big endian.
buffer = val.to_endian_bytes(Endianess::Platform); buffer = val.as_endian_bytes(Endianess::Platform);
T::from_endian_bytes(buffer.as_slice(), Endianess::Network) T::from_endian_bytes(buffer.as_slice(), Endianess::Network)
} }
} }

File diff suppressed because it is too large Load Diff