notify: Even better documentation
This commit is contained in:
parent
cfac28272b
commit
6dae26212d
|
@ -109,10 +109,14 @@ impl Display for Microseconds {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Timeout for the [`Notifier::barrier()`](super::Notifier::barrier).
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub enum BarrierTimeout {
|
pub enum BarrierTimeout {
|
||||||
|
/// Will block indefinitely.
|
||||||
Infinite,
|
Infinite,
|
||||||
|
/// Will not block at all and return immediately even if no event has happened.
|
||||||
Immediate,
|
Immediate,
|
||||||
|
/// Will block for a number of milliseconds.
|
||||||
NonZero(PollTimeout),
|
NonZero(PollTimeout),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,17 +130,18 @@ impl BarrierTimeout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Variant of [`BarrierTimeout`] for positive timeout.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct PollTimeout(core::num::NonZeroI32);
|
pub struct PollTimeout(core::num::NonZeroI32);
|
||||||
|
|
||||||
impl TryFrom<core::num::NonZeroI32> for PollTimeout {
|
impl TryFrom<core::num::NonZeroI32> for PollTimeout {
|
||||||
type Error = error::PollTimeoutFromIntError;
|
type Error = error::PollTimeoutFromIntError;
|
||||||
|
|
||||||
fn try_from(value: core::num::NonZeroI32) -> Result<Self, Self::Error> {
|
fn try_from(milliseconds: core::num::NonZeroI32) -> Result<Self, Self::Error> {
|
||||||
if value.is_negative() {
|
if milliseconds.is_negative() {
|
||||||
return Err(Self::Error::Negative);
|
return Err(Self::Error::Negative);
|
||||||
}
|
}
|
||||||
Ok(Self(value))
|
Ok(Self(milliseconds))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,6 +178,9 @@ impl Display for BusError<'_> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// An arbitrary custom state other than `BARRIER=1`.
|
||||||
|
///
|
||||||
|
/// `BARRIER=1` is blocked as it result in special expectations by the protocol.
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||||
pub struct OtherState<'a>(&'a str);
|
pub struct OtherState<'a>(&'a str);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue