use super::BuilderInner;
use crate::pipes::watch::{WatcherConfig, WatcherState};
impl BuilderInner {
pub fn new(config: WatcherConfig, state: WatcherState) -> Self {
Self { config, state }
}
pub fn from_config(config: WatcherConfig) -> Self {
Self {
config,
state: WatcherState::default(),
}
}
pub fn from_state(state: WatcherState) -> Self {
Self {
config: WatcherConfig::default(),
state,
}
}
pub const fn config(&self) -> &WatcherConfig {
&self.config
}
pub fn config_mut(&mut self) -> &mut WatcherConfig {
&mut self.config
}
pub const fn state(&self) -> &WatcherState {
&self.state
}
pub fn state_mut(&mut self) -> &mut WatcherState {
&mut self.state
}
pub fn set_config(&mut self, config: WatcherConfig) -> &mut Self {
self.config = config;
self
}
pub fn set_state(&mut self, state: WatcherState) -> &mut Self {
self.state = state;
self
}
pub fn with_config(self, config: WatcherConfig) -> Self {
Self {
config,
..self
}
}
pub fn with_state(self, state: WatcherState) -> Self {
Self { state, ..self }
}
}
impl Default for BuilderInner {
fn default() -> Self {
Self {
config: WatcherConfig::default(),
state: WatcherState::default(),
}
}
}