Skip to content

Commit

Permalink
Merge branch 'main' into bevy-0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
Jondolf committed Jul 11, 2024
2 parents 322f0da + f28ef09 commit a81f1f1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions matchbox_protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ cfg_if! {
if #[cfg(feature = "json")] {
pub type JsonPeerRequest = PeerRequest<serde_json::Value>;
pub type JsonPeerEvent = PeerEvent<serde_json::Value>;
use std::fmt;

impl ToString for JsonPeerRequest {
fn to_string(&self) -> String {
serde_json::to_string(self).expect("error serializing message")

impl fmt::Display for JsonPeerRequest {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", serde_json::to_string(self).map_err(|_| fmt::Error)?)
}
}
impl std::str::FromStr for JsonPeerRequest {
Expand All @@ -48,9 +50,9 @@ cfg_if! {
}
}

impl ToString for JsonPeerEvent {
fn to_string(&self) -> String {
serde_json::to_string(self).expect("error serializing message")
impl fmt::Display for JsonPeerEvent {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{}", serde_json::to_string(self).map_err(|_| fmt::Error)?)
}
}
impl std::str::FromStr for JsonPeerEvent {
Expand Down

0 comments on commit a81f1f1

Please sign in to comment.