zino_channel/
subscription.rsuse serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[serde(default)]
pub struct Subscription {
session_id: Option<String>,
source: Option<String>,
topic: Option<String>,
}
impl Subscription {
#[inline]
pub fn new(source: Option<String>, topic: Option<String>) -> Self {
Self {
session_id: None,
source,
topic,
}
}
#[inline]
pub fn set_session_id(&mut self, session_id: Option<String>) {
self.session_id = session_id;
}
#[inline]
pub fn set_source(&mut self, source: Option<String>) {
self.source = source;
}
#[inline]
pub fn set_topic(&mut self, topic: Option<String>) {
self.topic = topic;
}
#[inline]
pub fn session_id(&self) -> Option<&str> {
self.session_id.as_deref()
}
#[inline]
pub fn source(&self) -> Option<&str> {
self.source.as_deref()
}
#[inline]
pub fn topic(&self) -> Option<&str> {
self.topic.as_deref()
}
}