#[repr(u16)]pub enum DbFieldType {
String = 0,
Short = 1,
Float = 2,
Enum = 3,
Char = 4,
Long = 5,
Double = 6,
Int64 = 7,
UInt64 = 8,
UShort = 9,
ULong = 10,
}Expand description
EPICS DBR field types (native types only)
Variants§
String = 0
Short = 1
Float = 2
Enum = 3
Char = 4
Long = 5
Double = 6
Int64 = 7
Internal-only type for int64in/int64out records. No CA wire type 7 exists; over CA these PVs appear as Double (type 6).
UInt64 = 8
Internal-only type for unsigned 64-bit EPICS fields (C DBF_UINT64,
dbStatic dbfType index 8). The CA wire protocol has no 64-bit
type, so over CA these PVs appear as Double (type 6); over PVA they
are served natively as ulong. Mirrors Int64’s CA handling.
UShort = 9
Internal-only type for unsigned 16-bit EPICS fields (C DBF_USHORT,
dbStatic dbfType). The CA wire protocol has no unsigned types, so
the IOC promotes DBF_USHORT to the next signed type that holds its
full 0..=65535 range — DBR_LONG (the C dbDBRnewToDBRold table,
db_convert.h: 5, /*DBR_USHORT to DBR_LONG*/). Over PVA pvxs
serves it natively as ushort (ioc/typeutils.cpp:38-40:
DBR_USHORT -> TypeCode::UInt16). The discriminant is an internal
marker (not a CA wire code); see Self::ca_wire_type.
ULong = 10
Internal-only type for unsigned 32-bit EPICS fields (C DBF_ULONG,
dbStatic dbfType). 0..=4294967295 does not fit in i32, so the
IOC promotes DBF_ULONG to DBR_DOUBLE over CA exactly like
UInt64/Int64 (db_convert.h: 6, /*DBR_ULONG to DBR_DOUBLE*/).
Over PVA pvxs serves it natively as uint (ioc/typeutils.cpp:43-44:
DBR_ULONG -> TypeCode::UInt32).
Implementations§
Source§impl DbFieldType
impl DbFieldType
pub fn from_u16(v: u16) -> Result<DbFieldType, CaError>
Sourcepub fn element_size(&self) -> usize
pub fn element_size(&self) -> usize
Size in bytes for a single element of this type’s native carrier.
This is the carrier width (UShort = 2, ULong = 4), not the
CA-wire-promoted width: the CA value path always promotes via
crate::types::EpicsValue::dbr_type first and sizes buffers off
the promoted type (UShort→Long=4, ULong→Double=8), so this
width is never used to size a CA value array for the unsigned types.
Sourcepub fn sts_dbr_type(&self) -> u16
pub fn sts_dbr_type(&self) -> u16
Return the DBR_STS_xxx type code for this native type
(Int64 maps to DBR_STS_DOUBLE).
Sourcepub fn time_dbr_type(&self) -> u16
pub fn time_dbr_type(&self) -> u16
Return the DBR_TIME_xxx type code for this native type
(Int64 maps to DBR_TIME_DOUBLE).
Sourcepub fn gr_dbr_type(&self) -> u16
pub fn gr_dbr_type(&self) -> u16
Return the DBR_GR_xxx type code for this native type
(Int64 maps to DBR_GR_DOUBLE).
Sourcepub fn ctrl_dbr_type(&self) -> u16
pub fn ctrl_dbr_type(&self) -> u16
Return the DBR_CTRL_xxx type code for this native type
(Int64 maps to DBR_CTRL_DOUBLE).
Sourcepub fn buffer_size(&self, count: usize) -> usize
pub fn buffer_size(&self, count: usize) -> usize
Calculate total buffer size for N elements of this type. Equivalent to C EPICS dbValueSize(type) * count.
Sourcepub fn to_dbr_type(&self) -> DbFieldType
pub fn to_dbr_type(&self) -> DbFieldType
Map field type to request type (C EPICS mapDBFToDBR). DBF_MENU and DBF_DEVICE map to DBR_ENUM in C EPICS. In Rust these are already represented as DbFieldType::Enum, so this is an identity mapping for documentation/completeness.
Trait Implementations§
Source§impl Clone for DbFieldType
impl Clone for DbFieldType
Source§fn clone(&self) -> DbFieldType
fn clone(&self) -> DbFieldType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DbFieldType
Source§impl Debug for DbFieldType
impl Debug for DbFieldType
impl Eq for DbFieldType
Source§impl PartialEq for DbFieldType
impl PartialEq for DbFieldType
Source§fn eq(&self, other: &DbFieldType) -> bool
fn eq(&self, other: &DbFieldType) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DbFieldType
Auto Trait Implementations§
impl Freeze for DbFieldType
impl RefUnwindSafe for DbFieldType
impl Send for DbFieldType
impl Sync for DbFieldType
impl Unpin for DbFieldType
impl UnsafeUnpin for DbFieldType
impl UnwindSafe for DbFieldType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.