pub struct DeviceConfigBuilder { /* private fields */ }Expand description
Builder for creating device configurations.
This builder provides a fluent API for constructing DeviceConfig
instances with validation at build time.
Implementations§
Source§impl DeviceConfigBuilder
impl DeviceConfigBuilder
Sourcepub fn new(id: impl Into<String>, name: impl Into<String>) -> Self
pub fn new(id: impl Into<String>, name: impl Into<String>) -> Self
Create a new device configuration builder.
§Arguments
id- Unique device identifiername- Human-readable device name
Sourcepub fn description(self, description: impl Into<String>) -> Self
pub fn description(self, description: impl Into<String>) -> Self
Set the device description.
Sourcepub fn metadata(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn metadata(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a metadata key-value pair.
Sourcepub fn with_metadata(self, metadata: HashMap<String, String>) -> Self
pub fn with_metadata(self, metadata: HashMap<String, String>) -> Self
Add multiple metadata entries.
Set tags for this device.
Sourcepub fn tag(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn tag(self, key: impl Into<String>, value: impl Into<String>) -> Self
Add a single tag (key-value pair).
Sourcepub fn add_point(self, point: DataPointDef) -> Self
pub fn add_point(self, point: DataPointDef) -> Self
Add a data point definition.
Sourcepub fn add_points(self, points: impl IntoIterator<Item = DataPointDef>) -> Self
pub fn add_points(self, points: impl IntoIterator<Item = DataPointDef>) -> Self
Add multiple data point definitions.
Sourcepub fn skip_validation(self) -> Self
pub fn skip_validation(self) -> Self
Disable validation at build time.
Sourcepub fn build(self) -> Result<DeviceConfig>
pub fn build(self) -> Result<DeviceConfig>
Build the device configuration.
Trait Implementations§
Source§impl Clone for DeviceConfigBuilder
impl Clone for DeviceConfigBuilder
Source§fn clone(&self) -> DeviceConfigBuilder
fn clone(&self) -> DeviceConfigBuilder
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 moreAuto Trait Implementations§
impl Freeze for DeviceConfigBuilder
impl RefUnwindSafe for DeviceConfigBuilder
impl Send for DeviceConfigBuilder
impl Sync for DeviceConfigBuilder
impl Unpin for DeviceConfigBuilder
impl UnsafeUnpin for DeviceConfigBuilder
impl UnwindSafe for DeviceConfigBuilder
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