提交 f6fe0aa1 authored 作者: Serhij S's avatar Serhij S

new with vars no Default required, sleep step public

上级 3cfac76b
...@@ -30,7 +30,7 @@ pub mod prelude { ...@@ -30,7 +30,7 @@ pub mod prelude {
/// Result type, which must be returned by workers' `run` method /// Result type, which must be returned by workers' `run` method
pub type WResult = Result<(), Box<dyn std::error::Error>>; pub type WResult = Result<(), Box<dyn std::error::Error>>;
const SLEEP_SLEEP: Duration = Duration::from_millis(100); pub const SLEEP_STEP: Duration = Duration::from_millis(100);
/// Controller state beacon. Can be cloned and shared with no limitations. /// Controller state beacon. Can be cloned and shared with no limitations.
#[derive(Clone)] #[derive(Clone)]
...@@ -125,10 +125,7 @@ where ...@@ -125,10 +125,7 @@ where
} }
} }
/// Creates a new controller instance with a pre-defined variables object /// Creates a new controller instance with a pre-defined variables object
pub fn new_with_variables(variables: V) -> Self pub fn new_with_variables(variables: V) -> Self {
where
V: Default,
{
Self { Self {
supervisor: <_>::default(), supervisor: <_>::default(),
hub: <_>::default(), hub: <_>::default(),
...@@ -233,7 +230,7 @@ where ...@@ -233,7 +230,7 @@ where
/// Blocks until the controller goes into stopping/stopped /// Blocks until the controller goes into stopping/stopped
pub fn block_while_online(&self) { pub fn block_while_online(&self) {
while self.state.is_online() { while self.state.is_online() {
thread::sleep(SLEEP_SLEEP); thread::sleep(SLEEP_STEP);
} }
self.state.set(ControllerStateKind::Stopped); self.state.set(ControllerStateKind::Stopped);
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论