Skip to main content

ProcessContext

Struct ProcessContext 

Source
pub struct ProcessContext<'a> {
    pub udf: bool,
    pub udfs: AlarmSeverity,
    pub nsev: AlarmSeverity,
    pub phas: i16,
    pub tse: i16,
    pub time: SystemTime,
    pub dtyp: &'a str,
    pub callback_priority: CallbackPriority,
}
Expand description

Read-only snapshot of framework-owned CommonFields state that a record’s process() or device support’s read() needs to see during the processing cycle.

The framework owns RecordInstance.common; a record process() receives only &mut self (the concrete record) and device support read() receives only &mut dyn Record. Neither can reach CommonFields. C records, by contrast, see dbCommon directly — e.g. epidRecord.c:195 reads pepid->udf, timestampRecord.c:90 reads ptimestamp->tse, devTimeOfDay.c:122 reads psi->phas.

The framework builds a ProcessContext from common and pushes it onto the record (via Record::set_process_context) and onto the device support (via crate::server::device_support::DeviceSupport::set_process_context) immediately before the respective call. This mirrors the existing set_device_did_compute framework-set-hook pattern: additive, no process() / read() signature change.

Fields§

§udf: bool

dbCommon.udf — value is undefined. C records check this at the top of process() (e.g. epidRecord.c:195).

§udfs: AlarmSeverity

dbCommon.udfs — alarm severity raised for a UDF record.

§nsev: AlarmSeverity

dbCommon.nsev — the pending (new) alarm severity this cycle has accumulated so far, BEFORE the record body runs. C dbGetLink folds an MS-class input link’s severity into nsev at fetch time, so a record body that branches on the input severity reads it here — e.g. transformRecord.c:554 if ((ptran->nsev >= INVALID_ALARM) && (ptran->ivla == transformIVLA_DO_NOTHING)). The framework folds every input-link alarm into common.nsev before building this snapshot, so nsev is the single source of truth; the record never re-derives it from the links.

§phas: i16

dbCommon.phas — phase. Used by device support for format selection (devTimeOfDay.c:122).

§tse: i16

dbCommon.tse — time-stamp event. timestampRecord.c:90 branches on tse == epicsTimeEventDeviceTime.

§time: SystemTime

dbCommon.time — the record’s current resolved time stamp at the start of this cycle (the previous cycle’s stamp, or UNIX_EPOCH before the first process). Device support that has to format the record’s time during read() — the std module’s devTimeOfDay.c recGblGetTimeStamp(psi) call, which runs before the framework’s per-cycle timestamp application — resolves the stamp with crate::server::recgbl::get_time_stamp(tse, time). The time member is the device-provided value that helper returns verbatim on the TSE == epicsTimeEventDeviceTime (-2) branch.

§dtyp: &'a str

dbCommon.dtyp — device-support type name. A record’s process() / pre-process hooks can branch on the DTYP to mirror C device support that lives in a separate DSET (e.g. the epid record’s devEpidSoftCallback callback DSET drives the TRIG readback link, whereas devEpidSoft does not).

Borrowed from dbCommon, not owned: the context is built under the record’s own guard and handed straight to the hook, which is the whole of its life. Owning it cost a String per build — two per cycle, three for a record with device support — and the one reader (EpidRecord::set_process_context) copies into its own cell anyway.

dbCommon.tsel used to sit beside it and was read by nobody, so it is not here; a hook that needs the TSEL text should take it the same way this one does.

§callback_priority: CallbackPriority

The callback band dbCommon.prio selects for work this cycle defers — C seqRecord.c:145-146, which re-runs callbackSetPriority(prec->prio, &pcb->callback) at the top of every process() so a PRIO written between cycles takes effect on the next one. Already converted: a record stashes this and hands it to crate::runtime::task::spawn_background rather than re-deriving a band from a raw menu index.

Trait Implementations§

Source§

impl<'a> Clone for ProcessContext<'a>

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<'a> Debug for ProcessContext<'a>

Source§

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

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

impl<'a> PartialEq for ProcessContext<'a>

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<'a> StructuralPartialEq for ProcessContext<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for ProcessContext<'a>

§

impl<'a> RefUnwindSafe for ProcessContext<'a>

§

impl<'a> Send for ProcessContext<'a>

§

impl<'a> Sync for ProcessContext<'a>

§

impl<'a> Unpin for ProcessContext<'a>

§

impl<'a> UnsafeUnpin for ProcessContext<'a>

§

impl<'a> UnwindSafe for ProcessContext<'a>

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> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more