Skip to main content

SampleTimeSpec

Enum SampleTimeSpec 

Source
pub enum SampleTimeSpec {
    Periodic {
        period: f64,
        offset: f64,
    },
    Variable,
}
Expand description

How a CScript/PyBlock/PyFunction/OctFunc block’s own execution is scheduled, independent of the circuit’s own resolved step (see each BlockKind variant’s own sample_time field).

Variants§

§

Periodic

A fixed sample period period (from ts=/freq=), with an optional phase offset (from to=, required to satisfy 0.0 <= offset < period) delaying when the first hit lands. Every hit after the first is spaced by exactly period.

Default, when to= is omitted: offset == 0.0 — this preserves the exact pre-existing behavior every ts=/freq=-using netlist already had before this field could carry an offset at all: dae-runtime seeds its own per-instance accumulator so the first evaluate_blocks call a block participates in is always due, unconditionally, regardless of period’s own value (verified directly against dae-runtime’s own construction code, not assumed) — i.e. the pre-existing behavior already was “no offset,” not “one period’s delay” as it might look at first glance. An explicit to=X (0 < X < period) genuinely delays the first hit to t=X instead.

Fields

§period: f64

The fixed sample period.

§offset: f64

Phase offset delaying the first hit; 0.0 <= offset < period.

§

Variable

The block computes its own next execution time itself, every time it runs (ts=variable in the netlist) — for a block whose own next event is known analytically at runtime (a modulator’s own scheduled switching instant) rather than fixed at parse time. Requires the backing .so/.py to export the corresponding optional next-sample-hit function/symbol; see cscript_ffi’s/pyblock_ffi’s own module doc comments. Not available for BlockKind::PyFunction/BlockKind::OctFunc (rejected at parse time) — a stateless function call has no instance to remember a requested next-hit time against.

Trait Implementations§

Source§

impl Clone for SampleTimeSpec

Source§

fn clone(&self) -> SampleTimeSpec

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 Copy for SampleTimeSpec

Source§

impl Debug for SampleTimeSpec

Source§

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

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

impl PartialEq for SampleTimeSpec

Source§

fn eq(&self, other: &SampleTimeSpec) -> 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 SampleTimeSpec

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