fix grumbles

This commit is contained in:
Robert Habermeier
2018-01-23 17:43:35 +01:00
parent c27ea0b73b
commit 21a4f9f821
10 changed files with 30 additions and 13 deletions
@@ -16,7 +16,7 @@
//! Serialisation.
use runtime_support::vec::Vec;
use runtime_support::prelude::*;
use runtime_support::{mem, slice};
use joiner::Joiner;
use endiansensitive::EndianSensitive;
@@ -44,8 +44,7 @@ pub trait Slicable: Sized {
/// Trait to mark that a type is not trivially (essentially "in place") serialisable.
pub trait NonTrivialSlicable: Slicable {}
// note: the copy bound and static lifetimes are necessary for safety of `set_as_slice`.
impl<T: Copy + EndianSensitive + 'static> Slicable for T {
impl<T: EndianSensitive> Slicable for T {
fn set_as_slice<F: FnOnce(&mut [u8]) -> bool>(fill_slice: F) -> Option<Self> {
let size = mem::size_of::<T>();
let mut result: T = unsafe { mem::zeroed() };