Added `DefaultMessageSender`, `DefaultMessageReceiver`, `DefaultMessageSenderReceiver` types, which function the same as `()` for the cases of the trait(s) that they implement.

Fortune for rsh's current commit: Half blessing − 半吉
specialisation
Avril 3 years ago
parent 36f3ed4586
commit 4877a843bd
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -24,6 +24,25 @@ pub trait MessageReceiver
impl MessageSender for (){} impl MessageSender for (){}
impl MessageReceiver for (){} impl MessageReceiver for (){}
/// Identical to `()` in terms of the use of the MessageSender trait.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DefaultMessageSender;
impl MessageSender for DefaultMessageSender{}
/// Identical to `()` in terms of the use of the MessageReceiver trait.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DefaultMessageReceiver;
impl MessageReceiver for DefaultMessageReceiver{}
/// Identical to `()` in terms of the use of the MessageSender/Receiver traits.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct DefaultMessageSenderReceiver;
impl MessageSender for DefaultMessageSenderReceiver{}
impl MessageReceiver for DefaultMessageSenderReceiver{}
#[derive(Debug)] #[derive(Debug)]
pub(super) struct WriteCounter<W:?Sized>(pub usize, pub W); pub(super) struct WriteCounter<W:?Sized>(pub usize, pub W);

Loading…
Cancel
Save