Skip to main content

Pv

Struct Pv 

Source
pub struct Pv<T: PvScalar> { /* private fields */ }
Expand description

Typed handle to a PV record. Cheap to clone; all clones share state.

Implementations§

Source§

impl<T: PvScalar> Pv<T>

Source

pub fn name(&self) -> &str

Source

pub fn units(self, units: impl Into<String>) -> Self

Source

pub fn prec(self, prec: i32) -> Self

Source

pub fn desc(self, desc: impl Into<String>) -> Self

Source

pub fn adel(self, deadband: f64) -> Self

Archive deadband (parsed/exposed via field access; PVA monitors use MDEL).

Source

pub fn mdel(self, deadband: f64) -> Self

Monitor deadband — suppresses monitor posts for changes smaller than this.

Source

pub fn drive_limits(self, low: f64, high: f64) -> Self

Source

pub fn alarm_limits(self, lolo: f64, low: f64, high: f64, hihi: f64) -> Self

Source

pub fn on_put<F>(self, f: F) -> Self
where F: Fn(&Pv<T>, T) -> Result<(), String> + Send + Sync + 'static,

Attach a PUT handler. Err(msg) rejects the PUT on the wire; Ok(()) accepts it. Called with a bound handle to this PV and the typed value.

Source

pub fn scan<F>(self, period: Duration, f: F) -> Self
where F: Fn(&Pv<T>) -> T + Send + Sync + 'static,

Periodically compute and post a new value for this PV.

Source§

impl Pv<f64>

Source

pub fn calc<F>(name: impl Into<String>, inputs: &[&Pv<f64>], f: F) -> Self
where F: Fn(&[f64]) -> f64 + Send + Sync + 'static,

A derived (read-only) PV recomputed whenever any input changes.

Source§

impl Pv<f64>

Source

pub fn ai(name: impl Into<String>, initial: f64) -> Self

Source

pub fn ao(name: impl Into<String>, initial: f64) -> Self

Source§

impl Pv<bool>

Source

pub fn bi(name: impl Into<String>, initial: bool) -> Self

Source

pub fn bo(name: impl Into<String>, initial: bool) -> Self

Source§

impl Pv<String>

Source

pub fn string_in(name: impl Into<String>, initial: impl Into<String>) -> Self

Source

pub fn string_out(name: impl Into<String>, initial: impl Into<String>) -> Self

Source§

impl Pv<i32>

Source

pub fn longin(name: impl Into<String>, initial: i32) -> Self

longin — 32-bit integer input record (read-only over the wire).

Source

pub fn longout(name: impl Into<String>, initial: i32) -> Self

longout — 32-bit integer output record (writable).

Source

pub fn mbbi(name: impl Into<String>, choices: Vec<String>, initial: i32) -> Self

mbbi — multi-bit binary input (enum, read-only). Value = choice index.

Source

pub fn mbbo(name: impl Into<String>, choices: Vec<String>, initial: i32) -> Self

mbbo — multi-bit binary output (enum, writable). Value = choice index.

Source§

impl<T: PvScalar> Pv<T>

Source

pub async fn set(&self, value: T) -> Result<(), PvError>

Write a value through the full posting pipeline (timestamp, alarms, MDEL gating, monitors, links).

Source

pub async fn set_alarm( &self, severity: i32, status: i32, message: &str, ) -> Result<(), PvError>

Explicitly set the record’s alarm severity/status/message, independent of its value. Alarm transitions always post (no MDEL gating, no link evaluation). A no-op re-set (unchanged alarm) is Ok(()).

Source

pub async fn get(&self) -> Result<T, PvError>

Read the current value, typed.

Trait Implementations§

Source§

impl<T: PvScalar> Clone for Pv<T>

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<T: PvScalar> From<Pv<T>> for AnyPv

Source§

fn from(pv: Pv<T>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<T> Freeze for Pv<T>

§

impl<T> RefUnwindSafe for Pv<T>

§

impl<T> Send for Pv<T>

§

impl<T> Sync for Pv<T>

§

impl<T> Unpin for Pv<T>

§

impl<T> UnsafeUnpin for Pv<T>

§

impl<T> UnwindSafe for Pv<T>

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