From 21587215acbb2ea41a314adf5a704da01457cead Mon Sep 17 00:00:00 2001 From: Ryan Summers Date: Wed, 13 Sep 2023 12:03:52 +0200 Subject: [PATCH] Cleaning up ToPayload implementations --- src/publication.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/publication.rs b/src/publication.rs index 54ae600..0f2824a 100644 --- a/src/publication.rs +++ b/src/publication.rs @@ -30,13 +30,6 @@ impl<'a> ToPayload for &'a str { } } -impl ToPayload for [u8; N] { - type Error = (); - - fn serialize(self, buffer: &mut [u8]) -> Result { - (&self[..]).serialize(buffer) - } -} impl ToPayload for &[u8; N] { type Error = (); @@ -45,6 +38,12 @@ impl ToPayload for &[u8; N] { } } +/// A publication where the payload is serialized directly into the transmission buffer in the +/// future. +/// +/// # Note +/// This is "deferred" because the closure will only be called once the publication is actually +/// sent. pub struct DeferredPublication Result> { func: F, }