mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-01 03:07:56 +00:00
Update to parity-scale-codec (#3232)
* WIP: update codec * WIP * compiling * WIP * rename parity-scale-codec to codec * WIP * fix * remove old comments * use published crates * fix expected error msg * bump version * fmt and fix * remove old comment * fix wrong decoding impl * implement encode like for structures * undo removal of old pending changes * trailingzeroinput * Apply suggestions from code review Co-Authored-By: Bastian Köcher <bkchr@users.noreply.github.com> Co-Authored-By: DemiMarie-parity <48690212+DemiMarie-parity@users.noreply.github.com> * update codec * fmt * version is 1.0.0 * show more error * fmt
This commit is contained in:
committed by
Bastian Köcher
parent
a0d442333f
commit
4ed67e03a4
@@ -37,8 +37,8 @@ use network::{
|
||||
use primitives::H256;
|
||||
|
||||
use std::{
|
||||
io::{Write, Read, stdin, stdout, ErrorKind}, iter, fs::{self, File}, net::{Ipv4Addr, SocketAddr},
|
||||
path::{Path, PathBuf}, str::FromStr,
|
||||
io::{Write, Read, Seek, Cursor, stdin, stdout, ErrorKind}, iter, fs::{self, File},
|
||||
net::{Ipv4Addr, SocketAddr}, path::{Path, PathBuf}, str::FromStr,
|
||||
};
|
||||
|
||||
use names::{Generator, Name};
|
||||
@@ -628,6 +628,11 @@ where
|
||||
).map_err(Into::into)
|
||||
}
|
||||
|
||||
/// Internal trait used to cast to a dynamic type that implements Read and Seek.
|
||||
trait ReadPlusSeek: Read + Seek {}
|
||||
|
||||
impl<T: Read + Seek> ReadPlusSeek for T {}
|
||||
|
||||
fn import_blocks<F, E, S>(
|
||||
cli: ImportBlocksCmd,
|
||||
spec_factory: S,
|
||||
@@ -646,9 +651,13 @@ where
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let file: Box<dyn Read> = match cli.input {
|
||||
let file: Box<dyn ReadPlusSeek> = match cli.input {
|
||||
Some(filename) => Box::new(File::open(filename)?),
|
||||
None => Box::new(stdin()),
|
||||
None => {
|
||||
let mut buffer = Vec::new();
|
||||
stdin().read_to_end(&mut buffer)?;
|
||||
Box::new(Cursor::new(buffer))
|
||||
},
|
||||
};
|
||||
|
||||
let fut = service::chain_ops::import_blocks::<F, _, _>(config, exit.into_exit(), file)?;
|
||||
|
||||
Reference in New Issue
Block a user