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::resolvedispub(crate), so a crate outsideepics-base-rscannot make one and must go throughPvDatabase::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;
RecordInstancekeeps 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>
impl<'a> LinkBacking<'a>
Sourcepub const fn none() -> Self
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.
Sourcepub const fn resolved(resolved: &'a HashMap<String, LinkMetadata>) -> Self
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>
impl<'a> Clone for LinkBacking<'a>
Source§fn clone(&self) -> LinkBacking<'a>
fn clone(&self) -> LinkBacking<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more