pub struct OptInGate { /* private fields */ }Expand description
Telemetry opt-in gate. Manages the enabled/disabled state.
The gate reads from and writes to a config file. Changes are immediate.
Implementations§
Source§impl OptInGate
impl OptInGate
Sourcepub fn new() -> Result<Self>
pub fn new() -> Result<Self>
Create a new opt-in gate with the default config directory.
Looks for config at ~/.mlstack/config/telemetry.json.
If not found, defaults to disabled.
Sourcepub fn with_config_path(config_path: PathBuf) -> Self
pub fn with_config_path(config_path: PathBuf) -> Self
Create a new opt-in gate with a custom config path (for testing).
Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Check if telemetry is currently enabled.
VAL-TELE-010: Returns false by default.
Sourcepub fn enable(&mut self) -> Result<()>
pub fn enable(&mut self) -> Result<()>
Enable telemetry.
VAL-TELE-011: Takes effect immediately, no restart required.
Sourcepub fn disable(&mut self) -> Result<()>
pub fn disable(&mut self) -> Result<()>
Disable telemetry.
VAL-TELE-011: Takes effect immediately, no restart required.
Sourcepub fn config(&self) -> &TelemetryConfig
pub fn config(&self) -> &TelemetryConfig
Get the current config.
Sourcepub fn config_path(&self) -> &PathBuf
pub fn config_path(&self) -> &PathBuf
Get the config file path.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for OptInGate
impl RefUnwindSafe for OptInGate
impl Send for OptInGate
impl Sync for OptInGate
impl Unpin for OptInGate
impl UnsafeUnpin for OptInGate
impl UnwindSafe for OptInGate
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Converts
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> ⓘ
Converts
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