Skip to main content

DbFieldType

Enum DbFieldType 

Source
#[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

Source

pub fn from_u16(v: u16) -> Result<DbFieldType, CaError>

Source

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 (UShortLong=4, ULongDouble=8), so this width is never used to size a CA value array for the unsigned types.

Source

pub fn sts_dbr_type(&self) -> u16

Return the DBR_STS_xxx type code for this native type (Int64 maps to DBR_STS_DOUBLE).

Source

pub fn time_dbr_type(&self) -> u16

Return the DBR_TIME_xxx type code for this native type (Int64 maps to DBR_TIME_DOUBLE).

Source

pub fn gr_dbr_type(&self) -> u16

Return the DBR_GR_xxx type code for this native type (Int64 maps to DBR_GR_DOUBLE).

Source

pub fn ctrl_dbr_type(&self) -> u16

Return the DBR_CTRL_xxx type code for this native type (Int64 maps to DBR_CTRL_DOUBLE).

Source

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.

Source

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

Source§

fn clone(&self) -> DbFieldType

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 Copy for DbFieldType

Source§

impl Debug for DbFieldType

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for DbFieldType

Source§

impl PartialEq for DbFieldType

Source§

fn eq(&self, other: &DbFieldType) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for DbFieldType

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> 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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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