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:
parent
04c94db9f5
commit
143a6d60bc
@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
1061
src/transmutable.rs
1061
src/transmutable.rs
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user