Skip to content

Commit

Permalink
[network] Serialize Vec<u8> with serde_bytes
Browse files Browse the repository at this point in the history
Closes: #3315
Approved by: davidiw
  • Loading branch information
bothra90 authored and bors-libra committed Apr 8, 2020
1 parent 6abd90e commit 718ace8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions network/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pin-project = "0.4.2"
prometheus = { version = "0.8.0", default-features = false }
rand = "0.6.5"
serde = { version = "1.0.106", default-features = false }
serde_bytes = "0.11.3"
serde_repr = "0.1"
thiserror = "1.0"
tokio = { version = "0.2.13", features = ["full"] }
Expand Down
3 changes: 3 additions & 0 deletions network/src/protocols/wire/messaging/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ pub struct RpcRequest {
/// Request priority in the range 0..=255.
pub priority: Priority,
/// Request payload. This will be parsed by the application-level handler.
#[serde(with = "serde_bytes")]
pub raw_request: Vec<u8>,
}

Expand All @@ -77,6 +78,7 @@ pub struct RpcResponse {
/// corresponding request.
pub priority: Priority,
/// Response payload.
#[serde(with = "serde_bytes")]
pub raw_response: Vec<u8>,
}

Expand All @@ -87,5 +89,6 @@ pub struct DirectSendMsg {
/// Message priority in the range 0..=255.
pub priority: Priority,
/// Message payload.
#[serde(with = "serde_bytes")]
pub raw_msg: Vec<u8>,
}

0 comments on commit 718ace8

Please sign in to comment.