pub struct RuntimePolicy { /* private fields */ }Expand description
Runtime choices used to create one immutable operation context.
The default policy is deterministic. System state is consulted only after callers explicitly
select a system adapter, either individually or through RuntimePolicy::try_native.
Implementations§
Source§impl RuntimePolicy
impl RuntimePolicy
Sourcepub const NATIVE_SYSTEM_ADAPTER_IDS: &'static [&'static str]
pub const NATIVE_SYSTEM_ADAPTER_IDS: &'static [&'static str]
System adapters selected by Self::try_native.
This list is a policy contract, not a report of what Cargo compiled. Consumers that
advertise a native policy should intersect it with compiled_system_adapter_ids.
Sourcepub fn deterministic() -> Self
pub fn deterministic() -> Self
Returns the deterministic, target-independent core policy.
Sourcepub fn try_native() -> Result<Self, RuntimePolicyError>
pub fn try_native() -> Result<Self, RuntimePolicyError>
Selects the native clock, complete local-time rules, and random source.
Timing instrumentation remains opt-in through RuntimePolicy::try_with_system_timing
because enabling it changes observable diagnostics and adds work to every operation.
Sourcepub fn from_operation_context(context: OperationContext) -> Self
pub fn from_operation_context(context: OperationContext) -> Self
Replays an already captured operation without consulting system state again.
pub fn with_fixed_unix_millis(self, unix_millis: i64) -> Self
pub fn try_with_system_clock(self) -> Result<Self, RuntimePolicyError>
pub fn with_fixed_today(self, today: Option<CivilDate>) -> Self
Sourcepub fn try_with_fixed_today_at_local_midnight(
self,
today: CivilDate,
) -> Result<Self, RuntimePolicyError>
pub fn try_with_fixed_today_at_local_midnight( self, today: CivilDate, ) -> Result<Self, RuntimePolicyError>
Freezes both the local calendar day and the operation clock at that day’s local midnight.
Use this when a host accepts a date-only configuration value such as fixed_today.
Resolving it through the selected time zone preserves target-date DST behavior and returns
a typed error when the date cannot be represented instead of overflowing at an offset
boundary.
Sourcepub fn try_with_fixed_local_offset_minutes(
self,
offset_minutes: i32,
) -> Result<Self, RuntimePolicyError>
pub fn try_with_fixed_local_offset_minutes( self, offset_minutes: i32, ) -> Result<Self, RuntimePolicyError>
Selects a fixed UTC offset without overloading a sentinel value to mean “system”.
pub fn with_local_time_zone(self, time_zone: LocalTimeZone) -> Self
pub fn try_with_system_time_zone(self) -> Result<Self, RuntimePolicyError>
pub fn with_fixed_seed(self, seed: u64) -> Self
pub fn try_with_system_random(self) -> Result<Self, RuntimePolicyError>
Sourcepub fn try_with_system_timing(self) -> Result<Self, RuntimePolicyError>
pub fn try_with_system_timing(self) -> Result<Self, RuntimePolicyError>
Enables the compiled system timing adapter.
pub fn fixed_local_offset_minutes(&self) -> Option<i32>
pub fn fixed_today(&self) -> Option<CivilDate>
pub fn local_time_zone(&self) -> &LocalTimeZone
Sourcepub fn begin_operation(&self) -> Result<OperationContext, RuntimePolicyError>
pub fn begin_operation(&self) -> Result<OperationContext, RuntimePolicyError>
Freezes all selected adapters for one parse or render operation.
Trait Implementations§
Source§impl Clone for RuntimePolicy
impl Clone for RuntimePolicy
Source§impl Debug for RuntimePolicy
impl Debug for RuntimePolicy
Source§impl Default for RuntimePolicy
impl Default for RuntimePolicy
impl Eq for RuntimePolicy
Source§impl PartialEq for RuntimePolicy
impl PartialEq for RuntimePolicy
impl StructuralPartialEq for RuntimePolicy
Auto Trait Implementations§
impl Freeze for RuntimePolicy
impl RefUnwindSafe for RuntimePolicy
impl Send for RuntimePolicy
impl Sync for RuntimePolicy
impl Unpin for RuntimePolicy
impl UnsafeUnpin for RuntimePolicy
impl UnwindSafe for RuntimePolicy
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.