Replace protobuf crate with prost! (#1390)

* Replace protobuf crate with prost!

* Add copyright headers to build.rs files.

* kad: Fix error when mapping connection types.

Co-Authored-By: Pierre Krieger <pierre.krieger1708@gmail.com>

* Fix more mapping mistakes.

Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
This commit is contained in:
Toralf Wittner
2020-01-15 12:02:02 +01:00
committed by Pierre Krieger
parent 9d2df148cd
commit 680c467f7e
52 changed files with 600 additions and 5836 deletions

View File

@ -21,7 +21,6 @@
use std::error;
use std::fmt;
use std::io::Error as IoError;
use protobuf::error::ProtobufError;
#[derive(Debug)]
pub enum PlainTextError {
@ -29,7 +28,7 @@ pub enum PlainTextError {
IoError(IoError),
/// Failed to parse the handshake protobuf message.
InvalidPayload(Option<ProtobufError>),
InvalidPayload(Option<prost::DecodeError>),
/// The peer id of the exchange isn't consistent with the remote public key.
InvalidPeerId,
@ -68,8 +67,8 @@ impl From<IoError> for PlainTextError {
}
}
impl From<ProtobufError> for PlainTextError {
fn from(err: ProtobufError) -> PlainTextError {
impl From<prost::DecodeError> for PlainTextError {
fn from(err: prost::DecodeError) -> PlainTextError {
PlainTextError::InvalidPayload(Some(err))
}
}