use bytestring::ByteString;
#[must_use]
#[derive(Debug, Clone)]
pub struct Data {
pub(crate) id: Option<ByteString>,
pub(crate) event: Option<ByteString>,
pub(crate) data: ByteString,
}
impl Data {
pub fn new<T: Into<ByteString>>(data: T) -> Self {
Self {
id: None,
event: None,
data: data.into(),
}
}
pub fn id(mut self, id: impl Into<ByteString>) -> Self {
self.id = Some(id.into());
self
}
pub fn event(mut self, event: impl Into<ByteString>) -> Self {
self.event = Some(event.into());
self
}
}