Struct watchexec::config::InitConfig
source · [−]#[non_exhaustive]pub struct InitConfig {
pub error_handler: Box<dyn Handler<ErrorHook> + Send>,
pub error_channel_size: usize,
pub event_channel_size: usize,
}
Expand description
Initialisation configuration for Watchexec
.
This is used only for constructing the instance.
Use InitConfig::default()
to build a new one, and the inherent methods to change values.
This struct is marked non-exhaustive such that new options may be added without breaking change.
Fields (Non-exhaustive)
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.error_handler: Box<dyn Handler<ErrorHook> + Send>
Runtime error handler.
This is run on every runtime error that occurs within watchexec. By default the placeholder
()
handler is used, which discards all errors.
If the handler errors, that error is immediately given to the handler. If this second handler call errors as well, its error is ignored.
Also see the ErrorHook
documentation for returning critical errors from this handler.
Examples
let mut init = InitConfig::default();
init.on_error(|err: ErrorHook| async move {
tracing::error!("{}", err.error);
Ok::<(), Infallible>(())
});
error_channel_size: usize
Internal: the buffer size of the channel which carries runtime errors.
The default (64) is usually fine. If you expect a much larger throughput of runtime errors,
or if your error_handler
is slow, adjusting this value may help.
event_channel_size: usize
Internal: the buffer size of the channel which carries events.
The default (1024) is usually fine. If you expect a much larger throughput of events, adjusting this value may help.
Implementations
sourceimpl InitConfig
impl InitConfig
sourcepub fn on_error(
&mut self,
handler: impl Handler<ErrorHook> + Send + 'static
) -> &mut Self
pub fn on_error(
&mut self,
handler: impl Handler<ErrorHook> + Send + 'static
) -> &mut Self
Set the runtime error handler.
See the documentation on the field for more details.
sourcepub fn error_channel_size(&mut self, size: usize) -> &mut Self
pub fn error_channel_size(&mut self, size: usize) -> &mut Self
Set the buffer size of the channel which carries runtime errors.
See the documentation on the field for more details.
sourcepub fn event_channel_size(&mut self, size: usize) -> &mut Self
pub fn event_channel_size(&mut self, size: usize) -> &mut Self
Set the buffer size of the channel which carries events.
See the documentation on the field for more details.
Trait Implementations
sourceimpl Debug for InitConfig
impl Debug for InitConfig
Auto Trait Implementations
impl !RefUnwindSafe for InitConfig
impl Send for InitConfig
impl !Sync for InitConfig
impl Unpin for InitConfig
impl !UnwindSafe for InitConfig
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more