#[cfg(not(feature = "std"))]
use alloc::{string::String, vec::Vec};
#[cfg(feature = "std")]
use std::{string::String, vec::Vec};
#[derive(Clone, Debug, PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub enum Payload {
None,
Text(String),
Bytes(Vec<u8>),
#[cfg(feature = "serde")]
Json(::serde_json::Value),
}
impl Payload {
pub fn kind(&self) -> &'static str {
match self {
Payload::None => "none",
Payload::Text(_) => "text",
Payload::Bytes(_) => "bytes",
#[cfg(feature = "serde")]
Payload::Json(_) => "json",
}
}
}