Skip to main content

LinkBacking

Struct LinkBacking 

Source
pub struct LinkBacking<'a>(/* private fields */);
Expand description

Remote display / control / valueAlarm metadata snapshot for a link, as exposed by pvxs’s pvalink lset metadata getters.

Mirrors the pvxs/ioc/pvalink_lset.cpp metadata getter set installed at pvxs/ioc/pvalink_lset.cpp:706-732: pvaGetDBFtype, pvaGetElements, pvaGetControlLimits, pvaGetGraphicLimits, pvaGetAlarmLimits, pvaGetPrecision, pvaGetUnits.

Every field is optional: pvxs’s getters read the cached NT structure with Value::as, which leaves the caller’s buffer unchanged when the sub-field is absent. None here means the remote NT value carried no such metadata — the record support then keeps its local/default metadata, exactly as the C path does. The link-backed metadata resolved for one snapshot build — the single channel through which a link’s target metadata can reach a served Snapshot.

The invariant it makes true by construction is a served snapshot’s link-backed metadata was resolved during THIS build. Three things enforce it, none of them a runtime check:

  • the field is private and LinkBacking::resolved is pub(crate), so a crate outside epics-base-rs cannot make one and must go through PvDatabase::channel_snapshot_for_field;
  • it borrows the resolve’s own output, so it cannot outlive the resolve and there is nowhere to store it — a stale value is unrepresentable;
  • RecordInstance keeps no link-metadata map, so the consumer has no second source to read.

C needs no equivalent. dbLock.c:725-760 merges every DB_LINK-connected record into one lock set behind one recursive mutex, so get_units and its siblings call dbGetUnits/dbGetPrecision/… inline under the target’s lock (dbDbLink.c:240-261). The port has one RwLock per record and no lock sets, so it must resolve with no record lock held and hand the answer in; this type is that hand-off.

Implementations§

Source§

impl<'a> LinkBacking<'a>

Source

pub const fn none() -> Self

Nothing was resolved for this build: the record backs no field’s metadata with a link, or the caller is a path that serves only non-link-backed fields. Every lookup answers None, which serves each rset slot’s C seed — the same answer C’s untouched buffer gives for a CONSTANT link, an unresolvable target, or a link its DBLINK_FLAG_VISITED guard refused.

Source

pub const fn resolved(resolved: &'a HashMap<String, LinkMetadata>) -> Self

What the links this record’s metadata is backed by resolved to, keyed by link field (INPA, INPB, …), resolved with no record lock held.

Trait Implementations§

Source§

impl<'a> Clone for LinkBacking<'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> Copy for LinkBacking<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for LinkBacking<'a>

§

impl<'a> RefUnwindSafe for LinkBacking<'a>

§

impl<'a> Send for LinkBacking<'a>

§

impl<'a> Sync for LinkBacking<'a>

§

impl<'a> Unpin for LinkBacking<'a>

§

impl<'a> UnsafeUnpin for LinkBacking<'a>

§

impl<'a> UnwindSafe for LinkBacking<'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