pub struct AttributeDefinitionBuilder { /* private fields */ }Expand description
Builders
Builder for creating AttributeDefinition instances.
§Example
use dbc_rs::AttributeDefinitionBuilder;
let attr_def = AttributeDefinitionBuilder::new()
.name("GenMsgCycleTime")
.object_type_message()
.int_type(0, 10000)
.build()?;Implementations§
Source§impl AttributeDefinitionBuilder
impl AttributeDefinitionBuilder
Sourcepub fn build(self) -> Result<AttributeDefinition>
pub fn build(self) -> Result<AttributeDefinition>
Builds the attribute definition.
§Errors
Returns an error if:
- The name is not set
- The value type is not set
- The name exceeds the maximum size
Source§impl AttributeDefinitionBuilder
impl AttributeDefinitionBuilder
Sourcepub fn object_type_network(self) -> Self
pub fn object_type_network(self) -> Self
Sets the object type to Network (global/database level).
Sourcepub fn object_type_node(self) -> Self
pub fn object_type_node(self) -> Self
Sets the object type to Node (BU_).
Sourcepub fn object_type_message(self) -> Self
pub fn object_type_message(self) -> Self
Sets the object type to Message (BO_).
Sourcepub fn object_type_signal(self) -> Self
pub fn object_type_signal(self) -> Self
Sets the object type to Signal (SG_).
Sourcepub fn object_type(self, object_type: AttributeObjectType) -> Self
pub fn object_type(self, object_type: AttributeObjectType) -> Self
Sets the object type directly.
Sourcepub fn int_type(self, min: i64, max: i64) -> Self
pub fn int_type(self, min: i64, max: i64) -> Self
Sets the value type to INT with the given range.
Sourcepub fn hex_type(self, min: i64, max: i64) -> Self
pub fn hex_type(self, min: i64, max: i64) -> Self
Sets the value type to HEX with the given range.
Sourcepub fn float_type(self, min: f64, max: f64) -> Self
pub fn float_type(self, min: f64, max: f64) -> Self
Sets the value type to FLOAT with the given range.
Sourcepub fn string_type(self) -> Self
pub fn string_type(self) -> Self
Sets the value type to STRING.
Sourcepub fn enum_type(self, values: &[&str]) -> Result<Self>
pub fn enum_type(self, values: &[&str]) -> Result<Self>
Sets the value type to ENUM with the given values.
§Errors
Returns an error if any enum value exceeds the maximum name size.
Sourcepub fn value_type(self, value_type: AttributeValueType) -> Self
pub fn value_type(self, value_type: AttributeValueType) -> Self
Sets the value type directly.
Trait Implementations§
Source§impl Clone for AttributeDefinitionBuilder
impl Clone for AttributeDefinitionBuilder
Source§fn clone(&self) -> AttributeDefinitionBuilder
fn clone(&self) -> AttributeDefinitionBuilder
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AttributeDefinitionBuilder
impl Debug for AttributeDefinitionBuilder
Source§impl Default for AttributeDefinitionBuilder
impl Default for AttributeDefinitionBuilder
Source§fn default() -> AttributeDefinitionBuilder
fn default() -> AttributeDefinitionBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AttributeDefinitionBuilder
impl RefUnwindSafe for AttributeDefinitionBuilder
impl Send for AttributeDefinitionBuilder
impl Sync for AttributeDefinitionBuilder
impl Unpin for AttributeDefinitionBuilder
impl UnwindSafe for AttributeDefinitionBuilder
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
Mutably borrows from an owned value. Read more