Refactor: simplify module call definitions (#24)

* Refactor: simplify module call definitions

* Fix compilation errors after merge

* Add missing comments and remove unused imports

* Now it compiles
This commit is contained in:
Andrew Jones
2019-11-21 17:53:45 +00:00
committed by GitHub
parent 5242939f4d
commit 17abfb49b2
6 changed files with 136 additions and 323 deletions
+1 -11
View File
@@ -1,8 +1,4 @@
use parity_scale_codec::{
Encode,
EncodeAsRef,
HasCompact,
};
use parity_scale_codec::Encode;
#[derive(Clone)]
pub struct Encoded(pub Vec<u8>);
@@ -12,9 +8,3 @@ impl Encode for Encoded {
self.0.to_owned()
}
}
pub fn compact<T: HasCompact>(t: T) -> Encoded {
let encodable: <<T as HasCompact>::Type as EncodeAsRef<'_, T>>::RefType =
From::from(&t);
Encoded(encodable.encode())
}