Skip to main content

PvaServerBuilder

Struct PvaServerBuilder 

Source
pub struct PvaServerBuilder { /* private fields */ }
Expand description

Builder for PvaServer.

let server = PvaServer::builder()
    .ai("TEMP:READBACK", 22.5)
    .ao("TEMP:SETPOINT", 25.0)
    .bo("HEATER:ON", false)
    .port(5075)
    .build();

Implementations§

Source§

impl PvaServerBuilder

Source

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

Add an ai (analog input, read-only) record.

Source

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

Add an ao (analog output, writable) record.

Source

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

Add a bi (binary input, read-only) record.

Source

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

Add a bo (binary output, writable) record.

Source

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

Add a stringin (string input, read-only) record.

Source

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

Add a stringout (string output, writable) record.

Source

pub fn waveform(self, name: impl Into<String>, data: ScalarArrayValue) -> Self

Add a waveform record (array) with the given initial data.

Source

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

Add an mbbi (multi-bit binary input, read-only) NTEnum record.

Source

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

Add an mbbo (multi-bit binary output, writable) NTEnum record.

Source

pub fn generic( self, name: impl Into<String>, struct_id: impl Into<String>, fields: Vec<(String, PvValue)>, ) -> Self

Add a generic structure record with a custom struct ID and fields.

Source

pub fn db_file(self, path: impl AsRef<str>) -> Self

Load records from an EPICS .db file.

Source

pub fn db_string(self, content: &str) -> Self

Parse records from an EPICS .db string.

Source

pub fn on_put<F>(self, name: impl Into<String>, callback: F) -> Self
where F: Fn(&str, &DecodedValue) + Send + Sync + 'static,

Register a callback invoked when a PUT is applied to the named PV.

Source

pub fn scan<F>( self, name: impl Into<String>, period: Duration, callback: F, ) -> Self
where F: Fn(&str) -> ScalarValue + Send + Sync + 'static,

Register a periodic scan callback that produces a new value for a PV.

Link an output PV to one or more input PVs.

Whenever any input PV changes (via set_value, protocol PUT, or another link), the compute callback is invoked with the current values of all inputs (in order) and the result is written to the output PV.

.link("CALC:SUM", &["INPUT:A", "INPUT:B"], |values| {
    let a = values[0].as_f64().unwrap_or(0.0);
    let b = values[1].as_f64().unwrap_or(0.0);
    ScalarValue::F64(a + b)
})
Source

pub fn port(self, port: u16) -> Self

Set the TCP port (default 5075).

Source

pub fn udp_port(self, port: u16) -> Self

Set the UDP search port (default 5076).

Source

pub fn listen_ip(self, ip: IpAddr) -> Self

Set the IP address to listen on.

Source

pub fn advertise_ip(self, ip: IpAddr) -> Self

Set the IP address to advertise in search responses.

Source

pub fn compute_alarms(self, enabled: bool) -> Self

Enable alarm computation from limits.

Source

pub fn beacon_period(self, secs: u64) -> Self

Set the beacon broadcast period in seconds (default 15).

Source

pub fn conn_timeout(self, timeout: Duration) -> Self

Set the idle connection timeout (default ~18 hours).

Source

pub fn pvlist_mode(self, mode: PvListMode) -> Self

Set the PV list mode (default PvListMode::List).

Source

pub fn pvlist_max(self, max: usize) -> Self

Set the maximum number of PV names in pvlist responses (default 1024).

Source

pub fn pvlist_allow_pattern(self, pattern: Regex) -> Self

Set a regex filter for PV names exposed by pvlist.

Source

pub fn build(self) -> PvaServer

Build the PvaServer.

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