pub struct DefaultRingShapePolicy {
pub hysteresis: Duration,
}Expand description
Default policy: pick the cheapest shape that fits the current peer counts, with a fixed hysteresis interval after each morph to prevent thrashing under rapid peer-count oscillation.
Mapping (when since_last_morph >= hysteresis):
| producers | consumers | shape |
|---|---|---|
| 1 | 1 | Spsc |
| >=2 | 1 | Mpsc |
| * | >=2 | Mpmc |
While since_last_morph < hysteresis, returns None even if
the target shape differs. While either peer count is 0 the
policy also returns None (no point morphing an empty ring).
Fields§
§hysteresis: DurationImplementations§
Trait Implementations§
Source§impl Default for DefaultRingShapePolicy
impl Default for DefaultRingShapePolicy
Auto Trait Implementations§
impl Freeze for DefaultRingShapePolicy
impl RefUnwindSafe for DefaultRingShapePolicy
impl Send for DefaultRingShapePolicy
impl Sync for DefaultRingShapePolicy
impl Unpin for DefaultRingShapePolicy
impl UnsafeUnpin for DefaultRingShapePolicy
impl UnwindSafe for DefaultRingShapePolicy
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