pub struct AutoExportConfig {
pub output_path: PathBuf,
pub formats: ExportFormatSet,
pub on_exit: bool,
pub on_panic: bool,
pub on_signal: SignalPolicy,
pub flush_interval: Option<Duration>,
pub exit_timeout: Duration,
}Expand description
Configuration for the automatic export subsystem.
Controls WHERE reports are written, WHICH formats, and WHICH exit paths
trigger an export. All fields have sensible defaults via Default, so a
plain AutoExportConfig::default() yields a working “export HTML+JSON to
./memscope-report on any exit” setup.
Fields§
§output_path: PathBufDirectory to write reports into. Created if missing.
Default: ./memscope-report.
formats: ExportFormatSetWhich output formats to produce. Default: HTML + JSON.
on_exit: boolExport on normal program return (Drop guard fires). Default: true.
on_panic: boolExport on panic (panic-hook chaining). Critical for
panic = "abort" release builds. Default: true.
on_signal: SignalPolicyWhich signals trigger an export. Default: CtrlC.
flush_interval: Option<Duration>If Some(interval), spawn a background worker that flushes every
interval. If None, no background flushing (export only on exit).
Default: None.
exit_timeout: DurationMax time the shutdown path waits for an in-flight export to finish before giving up. Default: 5s.
Implementations§
Source§impl AutoExportConfig
impl AutoExportConfig
Sourcepub fn with_output_path(self, path: impl Into<PathBuf>) -> Self
pub fn with_output_path(self, path: impl Into<PathBuf>) -> Self
Builder-style: set output path.
Sourcepub fn with_formats(self, formats: ExportFormatSet) -> Self
pub fn with_formats(self, formats: ExportFormatSet) -> Self
Builder-style: set formats.
Sourcepub fn with_flush_interval(self, interval: Duration) -> Self
pub fn with_flush_interval(self, interval: Duration) -> Self
Builder-style: enable periodic flushing.
Sourcepub fn with_signal_policy(self, policy: SignalPolicy) -> Self
pub fn with_signal_policy(self, policy: SignalPolicy) -> Self
Builder-style: set signal policy.
Sourcepub fn with_on_exit(self, on_exit: bool) -> Self
pub fn with_on_exit(self, on_exit: bool) -> Self
Builder-style: set the on_exit flag (export on normal Drop).
Sourcepub fn with_on_panic(self, on_panic: bool) -> Self
pub fn with_on_panic(self, on_panic: bool) -> Self
Builder-style: set the on_panic flag (export on panic).
Sourcepub fn with_exit_timeout(self, timeout: Duration) -> Self
pub fn with_exit_timeout(self, timeout: Duration) -> Self
Builder-style: set the shutdown timeout for in-flight exports.
Sourcepub fn is_auto_export_enabled(&self) -> bool
pub fn is_auto_export_enabled(&self) -> bool
True if any export path is enabled (exit, panic, or signal != Off).
Sourcepub fn wants_html(&self) -> bool
pub fn wants_html(&self) -> bool
True if the HTML format is selected.
Sourcepub fn wants_json(&self) -> bool
pub fn wants_json(&self) -> bool
True if the JSON format is selected.
Trait Implementations§
Source§impl Clone for AutoExportConfig
impl Clone for AutoExportConfig
Source§fn clone(&self) -> AutoExportConfig
fn clone(&self) -> AutoExportConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AutoExportConfig
impl Debug for AutoExportConfig
Source§impl Default for AutoExportConfig
impl Default for AutoExportConfig
Source§impl<'de> Deserialize<'de> for AutoExportConfig
impl<'de> Deserialize<'de> for AutoExportConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for AutoExportConfig
impl PartialEq for AutoExportConfig
Source§impl Serialize for AutoExportConfig
impl Serialize for AutoExportConfig
impl StructuralPartialEq for AutoExportConfig
Auto Trait Implementations§
impl Freeze for AutoExportConfig
impl RefUnwindSafe for AutoExportConfig
impl Send for AutoExportConfig
impl Sync for AutoExportConfig
impl Unpin for AutoExportConfig
impl UnsafeUnpin for AutoExportConfig
impl UnwindSafe for AutoExportConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more