pub struct ConnectionIntervalBuilder { /* private fields */ }
Expand description
Intermediate builder for the ConnectionInterval
.
Implementations§
Source§impl ConnectionIntervalBuilder
impl ConnectionIntervalBuilder
Sourcepub fn new() -> ConnectionIntervalBuilder
pub fn new() -> ConnectionIntervalBuilder
Initializes a new builder.
Sourcepub fn with_range(
&mut self,
min: Duration,
max: Duration,
) -> &mut ConnectionIntervalBuilder
pub fn with_range( &mut self, min: Duration, max: Duration, ) -> &mut ConnectionIntervalBuilder
Sourcepub fn with_latency(&mut self, latency: u16) -> &mut ConnectionIntervalBuilder
pub fn with_latency(&mut self, latency: u16) -> &mut ConnectionIntervalBuilder
Sourcepub fn with_supervision_timeout(
&mut self,
timeout: Duration,
) -> &mut ConnectionIntervalBuilder
pub fn with_supervision_timeout( &mut self, timeout: Duration, ) -> &mut ConnectionIntervalBuilder
Sourcepub fn build(&self) -> Result<ConnectionInterval, ConnectionIntervalError>
pub fn build(&self) -> Result<ConnectionInterval, ConnectionIntervalError>
Builds the connection interval if all parameters are valid.
§Errors
- Incomplete if any of
with_range
,with_latency
, orwith_supervision_timeout
have not been called. - IntervalTooShort if the minimum range value is less than 7.5 ms.
- IntervalTooLong if the maximum range value is greater than 4 seconds.
- IntervalInverted if the minimum range value is greater than the maximum.
- BadConnectionLatency if the connection latency is 500 or more.
- SupervisionTimeoutTooShort if the supervision timeout is less than 100 ms, or if it is less than the computed minimum: (1 + latency) * interval max * 2.
- SupervisionTimeoutTooLong if the supervision timeout is more than 32 seconds.
- ImpossibleSupervisionTimeout if the computed minimum supervision timeout ((1 + latency) * interval max * 2) is 32 seconds or more.
Trait Implementations§
Source§impl Default for ConnectionIntervalBuilder
impl Default for ConnectionIntervalBuilder
Source§fn default() -> ConnectionIntervalBuilder
fn default() -> ConnectionIntervalBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConnectionIntervalBuilder
impl RefUnwindSafe for ConnectionIntervalBuilder
impl Send for ConnectionIntervalBuilder
impl Sync for ConnectionIntervalBuilder
impl Unpin for ConnectionIntervalBuilder
impl UnwindSafe for ConnectionIntervalBuilder
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