Skip to main content

SensorOptionsBuilder

Struct SensorOptionsBuilder 

Source
pub struct SensorOptionsBuilder<'a> { /* private fields */ }
Expand description

Fluent builder for SensorOptions.

Per CLAUDE.md §2 Self::new takes no parameters, every parameter has a fluent setter, and Self::build validates the mandatory ones — returning Error::LocalIllegalArgument if they were not set. Like SensorOptions it has no Java counterpart and exists solely to satisfy that naming rule (DoD #7).

Implementations§

Source§

impl<'a> SensorOptionsBuilder<'a>

Source

pub fn new() -> Self

Creates a builder with every mandatory parameter unset and every other parameter at the value Java passes on the caller’s behalf.

Source

pub fn set_name(self, name: &'a str) -> Self

Sets SensorOptions::name, a mandatory parameter: Self::build panics if it was not set.

Source

pub fn set_config(self, config: Option<Arc<MetricConfig>>) -> Self

Sets SensorOptions::config.

Source

pub fn set_inactive_sensor_expiration_time_seconds( self, inactive_sensor_expiration_time_seconds: i64, ) -> Self

Sets SensorOptions::inactive_sensor_expiration_time_seconds.

Source

pub fn set_recording_level(self, recording_level: RecordingLevel) -> Self

Sets SensorOptions::recording_level.

Source

pub fn set_parents(self, parents: &'a [Arc<Sensor>]) -> Self

Sets SensorOptions::parents.

Source

pub fn build(self) -> Result<SensorOptions<'a>, Error>

Returns the built options.

Per CLAUDE.md §2 the mandatory parameters are validated here rather than being named in the constructor, so a later Java version that makes one of them optional changes the set this accepts instead of adding a second constructor. Today there is one mandatory set: name.

§Errors

Returns Error::LocalIllegalArgument naming the first parameter of that set which was not given a setter call. Only presence is checked here; semantic validation belongs to the method the options are passed to (CLAUDE.md §2).

Trait Implementations§

Source§

impl<'a> Default for SensorOptionsBuilder<'a>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V