Skip to main content

RuntimePolicy

Struct RuntimePolicy 

Source
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

Source

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.

Source

pub fn deterministic() -> Self

Returns the deterministic, target-independent core policy.

Source

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.

Source

pub fn from_operation_context(context: OperationContext) -> Self

Replays an already captured operation without consulting system state again.

Source

pub fn with_fixed_unix_millis(self, unix_millis: i64) -> Self

Source

pub fn try_with_system_clock(self) -> Result<Self, RuntimePolicyError>

Source

pub fn with_fixed_today(self, today: Option<CivilDate>) -> Self

Source

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.

Source

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”.

Source

pub fn with_local_time_zone(self, time_zone: LocalTimeZone) -> Self

Source

pub fn try_with_system_time_zone(self) -> Result<Self, RuntimePolicyError>

Source

pub fn with_fixed_seed(self, seed: u64) -> Self

Source

pub fn try_with_system_random(self) -> Result<Self, RuntimePolicyError>

Source

pub fn try_with_system_timing(self) -> Result<Self, RuntimePolicyError>

Enables the compiled system timing adapter.

Source

pub fn fixed_local_offset_minutes(&self) -> Option<i32>

Source

pub fn fixed_today(&self) -> Option<CivilDate>

Source

pub fn local_time_zone(&self) -> &LocalTimeZone

Source

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

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for RuntimePolicy

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RuntimePolicy

Source§

fn default() -> Self

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

impl Eq for RuntimePolicy

Source§

impl PartialEq for RuntimePolicy

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RuntimePolicy

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.