Start: `UntypedMessageValue` for unsafe casting of `SerializedMessage`s

Fortune for rsh's current commit: Half blessing − 半吉
message-write-to-buf
Avril 3 years ago
parent 7765c33070
commit c286708bff
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -1,7 +1,6 @@
//! Messages
use super::*;
use std::marker::PhantomData;
use serde::{Serialize, Deserialize};
use cryptohelpers::{
sha256,
aes,

@ -1,5 +1,6 @@
//! Message values
use super::*;
use serde::{Serialize, Deserialize};
/// A value that can be used for messages.
pub trait MessageValue: Serialize + for<'de> Deserialize<'de>{}
@ -24,3 +25,9 @@ pub struct MessageValueAny(Box<dyn Any +'static>);
//impl<T> MessageValue for DynamicMessageValue<T>
//where T: Serialize + for<'de> Deserialize<'de> + Any{}
*/
/// A type-unsafe `MessageValue` that can be used to transmute `SerializedMessage` instances.
///
/// This operation is unsafe and can result in deserializing the `SerializedMessage` failing, or even worse, a type confusion.
#[derive(Debug, Serialize, Deserialize)]
pub enum UntypedMessageValue{}

Loading…
Cancel
Save