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>,
) -> DeviceConfigBuilder
pub fn new( id: impl Into<String>, name: impl Into<String>, ) -> DeviceConfigBuilder
Create a new device configuration builder.
§Arguments
id- Unique device identifiername- Human-readable device name
Sourcepub fn protocol(self, protocol: Protocol) -> DeviceConfigBuilder
pub fn protocol(self, protocol: Protocol) -> DeviceConfigBuilder
Set the protocol for this device.
Sourcepub fn description(self, description: impl Into<String>) -> DeviceConfigBuilder
pub fn description(self, description: impl Into<String>) -> DeviceConfigBuilder
Set the device description.
Sourcepub fn address(self, address: impl Into<String>) -> DeviceConfigBuilder
pub fn address(self, address: impl Into<String>) -> DeviceConfigBuilder
Set the protocol-specific address.
Sourcepub fn metadata(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> DeviceConfigBuilder
pub fn metadata( self, key: impl Into<String>, value: impl Into<String>, ) -> DeviceConfigBuilder
Add a metadata key-value pair.
Sourcepub fn with_metadata(
self,
metadata: HashMap<String, String>,
) -> DeviceConfigBuilder
pub fn with_metadata( self, metadata: HashMap<String, String>, ) -> DeviceConfigBuilder
Add multiple metadata entries.
Set tags for this device.
Sourcepub fn tag(
self,
key: impl Into<String>,
value: impl Into<String>,
) -> DeviceConfigBuilder
pub fn tag( self, key: impl Into<String>, value: impl Into<String>, ) -> DeviceConfigBuilder
Add a single tag (key-value pair).
Sourcepub fn label(self, label: impl Into<String>) -> DeviceConfigBuilder
pub fn label(self, label: impl Into<String>) -> DeviceConfigBuilder
Add a label.
Sourcepub fn labels<I, S>(self, labels: I) -> DeviceConfigBuilder
pub fn labels<I, S>(self, labels: I) -> DeviceConfigBuilder
Add multiple labels.
Sourcepub fn add_point(self, point: DataPointDef) -> DeviceConfigBuilder
pub fn add_point(self, point: DataPointDef) -> DeviceConfigBuilder
Add a data point definition.
Sourcepub fn add_points(
self,
points: impl IntoIterator<Item = DataPointDef>,
) -> DeviceConfigBuilder
pub fn add_points( self, points: impl IntoIterator<Item = DataPointDef>, ) -> DeviceConfigBuilder
Add multiple data point definitions.
Sourcepub fn skip_validation(self) -> DeviceConfigBuilder
pub fn skip_validation(self) -> DeviceConfigBuilder
Disable validation at build time.
Sourcepub fn build(self) -> Result<DeviceConfig, Error>
pub fn build(self) -> Result<DeviceConfig, Error>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more