Skip to main content

RuntimeConfig

Struct RuntimeConfig 

Source
pub struct RuntimeConfig { /* private fields */ }
Expand description

Runtime configuration manager

Provides thread-safe access to global runtime configuration. Configuration changes are immediately visible to all threads.

Implementations§

Source§

impl RuntimeConfig

Source

pub fn global() -> Self

Get the global runtime configuration instance

§Examples
use torsh_core::runtime_config::RuntimeConfig;

let config = RuntimeConfig::global();
println!("Debug level: {:?}", config.debug_level());
Source

pub fn new() -> Self

Create a new isolated runtime configuration (for testing)

§Examples
use torsh_core::runtime_config::RuntimeConfig;

let config = RuntimeConfig::new();
// This config is independent of the global config
Source

pub fn debug_level(&self) -> DebugLevel

Get the current debug level

Source

pub fn set_debug_level(&self, level: DebugLevel)

Set the debug level

§Examples
use torsh_core::runtime_config::{RuntimeConfig, DebugLevel};

RuntimeConfig::global().set_debug_level(DebugLevel::Verbose);
Source

pub fn validation_level(&self) -> ValidationLevel

Get the current validation level

Source

pub fn set_validation_level(&self, level: ValidationLevel)

Set the validation level

§Examples
use torsh_core::runtime_config::{RuntimeConfig, ValidationLevel};

RuntimeConfig::global().set_validation_level(ValidationLevel::Maximum);
Source

pub fn monitoring_scope(&self) -> MonitoringScope

Get the current monitoring scope

Source

pub fn set_monitoring_scope(&self, scope: MonitoringScope)

Set the monitoring scope

§Examples
use torsh_core::runtime_config::{RuntimeConfig, MonitoringScope};

RuntimeConfig::global().set_monitoring_scope(MonitoringScope::Comprehensive);
Source

pub fn memory_tracking(&self) -> MemoryTrackingConfig

Get memory tracking configuration

Source

pub fn set_memory_tracking(&self, config: MemoryTrackingConfig)

Set memory tracking configuration

Source

pub fn log_level(&self) -> LogLevel

Get the current log level

Source

pub fn set_log_level(&self, level: LogLevel)

Set the log level

§Examples
use torsh_core::runtime_config::RuntimeConfig;
use torsh_core::telemetry::LogLevel;

RuntimeConfig::global().set_log_level(LogLevel::Debug);
Source

pub fn is_testing(&self) -> bool

Check if currently running in test mode

Source

pub fn set_testing(&self, testing: bool)

Set testing mode

Source

pub fn panic_on_warnings(&self) -> bool

Check if warnings should panic in debug mode

Source

pub fn set_panic_on_warnings(&self, panic: bool)

Set whether to panic on warnings in debug mode

Source

pub fn get_operation_config(&self, operation: &str) -> Option<OperationConfig>

Get configuration for a specific operation

§Examples
use torsh_core::runtime_config::RuntimeConfig;

let config = RuntimeConfig::global();
if let Some(op_config) = config.get_operation_config("matmul") {
    println!("Matmul metrics enabled: {}", op_config.enable_metrics);
}
Source

pub fn set_operation_config( &self, operation: impl Into<String>, config: OperationConfig, )

Set configuration for a specific operation

§Examples
use torsh_core::runtime_config::{RuntimeConfig, OperationConfig};

let mut config = OperationConfig::default();
config.timeout_ms = Some(1000); // 1 second timeout

RuntimeConfig::global().set_operation_config("slow_operation", config);
Source

pub fn remove_operation_config( &self, operation: &str, ) -> Option<OperationConfig>

Remove configuration for a specific operation

Source

pub fn clear_operation_configs(&self)

Clear all operation-specific configurations

Source

pub fn should_collect_metrics(&self, operation: &str) -> bool

Check if an operation should collect metrics

Source

pub fn should_validate(&self, operation: &str) -> bool

Check if an operation should perform validation

Source

pub fn should_validate_essential(&self) -> bool

Check if essential validation should be performed

Source

pub fn should_validate_standard(&self) -> bool

Check if standard validation should be performed

Source

pub fn should_validate_strict(&self) -> bool

Check if strict validation should be performed

Source

pub fn should_validate_maximum(&self) -> bool

Check if maximum validation should be performed

Source

pub fn apply_preset(&self, preset: ConfigPreset)

Apply a preset configuration for specific environments

§Examples
use torsh_core::runtime_config::{RuntimeConfig, ConfigPreset};

// Development mode
RuntimeConfig::global().apply_preset(ConfigPreset::Development);

// Production mode
RuntimeConfig::global().apply_preset(ConfigPreset::Production);
Source

pub fn reset(&self)

Reset to default configuration

Source

pub fn snapshot(&self) -> RuntimeConfigSnapshot

Get a snapshot of the current configuration (for debugging)

Trait Implementations§

Source§

impl Clone for RuntimeConfig

Source§

fn clone(&self) -> RuntimeConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for RuntimeConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V