Skip to content
This repository has been archived by the owner on Dec 26, 2024. It is now read-only.

Commit

Permalink
feat(network): create trait aliases for Query and Data (#1166)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShahakShama committed Sep 18, 2023
1 parent 5130618 commit 52743d2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions crates/papyrus_network/src/streamed_data_protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pub mod handler;
pub mod protocol;

use derive_more::Display;
use prost::Message;

#[derive(Clone, Copy, Debug, Default, Display, Eq, Hash, PartialEq)]
pub struct OutboundSessionId {
Expand All @@ -13,3 +14,11 @@ pub struct OutboundSessionId {
pub struct InboundSessionId {
value: usize,
}

// This is a workaround for the unstable feature trait aliases
// https://doc.rust-lang.org/beta/unstable-book/language-features/trait-alias.html
pub(crate) trait QueryBound: Message + 'static + Default {}
impl<T> QueryBound for T where T: Message + 'static + Default {}

pub(crate) trait DataBound: Message + 'static + Unpin {}
impl<T> DataBound for T where T: Message + 'static + Unpin {}

0 comments on commit 52743d2

Please sign in to comment.