use uuid::Uuid;
#[derive(Debug, Clone)]
pub struct WatcherOptions {
pub channel: String,
pub ignore_self: bool,
pub local_id: String,
}
impl Default for WatcherOptions {
fn default() -> Self {
Self {
channel: "/casbin".to_string(),
ignore_self: false,
local_id: Uuid::new_v4().to_string(),
}
}
}
impl WatcherOptions {
pub fn new() -> Self {
Self::default()
}
pub fn with_channel(mut self, channel: String) -> Self {
self.channel = channel;
self
}
pub fn with_ignore_self(mut self, ignore_self: bool) -> Self {
self.ignore_self = ignore_self;
self
}
pub fn with_local_id(mut self, local_id: String) -> Self {
self.local_id = local_id;
self
}
}