mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-28 02:51:07 +00:00
Block import and export (#272)
* Block export and import * Export and import using std streams * Made AuthorituId::from_slice private
This commit is contained in:
committed by
Gav Wood
parent
12268ae700
commit
aa747e3fae
@@ -38,6 +38,7 @@ pub trait Input {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
impl<'a> Input for &'a [u8] {
|
||||
fn read(&mut self, into: &mut [u8]) -> usize {
|
||||
let len = ::core::cmp::min(into.len(), self.len());
|
||||
@@ -47,6 +48,13 @@ impl<'a> Input for &'a [u8] {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl<R: ::std::io::Read> Input for R {
|
||||
fn read(&mut self, into: &mut [u8]) -> usize {
|
||||
(self as &mut ::std::io::Read).read(into).unwrap_or(0)
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait that allows zero-copy read/write of value-references to/from slices in LE format.
|
||||
pub trait Slicable: Sized {
|
||||
/// Attempt to deserialise the value from input.
|
||||
|
||||
Reference in New Issue
Block a user