pub struct RtcPortRange {
min: u16,
max: u16,
}Expand description
Inclusive UDP port range assigned across RTC workers.
Fields§
§min: u16§max: u16Implementations§
Source§impl RtcPortRange
impl RtcPortRange
Sourcepub const fn new(min: u16, max: u16) -> Self
pub const fn new(min: u16, max: u16) -> Self
Stores an inclusive RTC UDP port range without validation.
Callers of Self::port_count or Self::split_for_workers must ensure
min <= max and exclude 0..=u16::MAX, whose count is not representable
by u16.
pub const fn min(self) -> u16
pub const fn max(self) -> u16
Sourcepub const fn port_count(self) -> u16
pub const fn port_count(self) -> u16
Returns the number of ports in the range.
§Panics
May panic when min > max or the range spans every u16 port.
pub fn ports(self) -> impl Iterator<Item = u16>
Sourcepub fn split_for_workers(self, worker_count: usize) -> Option<Vec<Self>>
pub fn split_for_workers(self, worker_count: usize) -> Option<Vec<Self>>
Splits the range into contiguous worker ranges.
Earlier workers receive one extra port when the range does not divide
evenly. Returns None for zero workers or more workers than ports.
§Panics
May panic when min > max or the range spans every u16 port.
Trait Implementations§
Source§impl Clone for RtcPortRange
impl Clone for RtcPortRange
Source§fn clone(&self) -> RtcPortRange
fn clone(&self) -> RtcPortRange
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 moreSource§impl Debug for RtcPortRange
impl Debug for RtcPortRange
Source§impl PartialEq for RtcPortRange
impl PartialEq for RtcPortRange
impl Copy for RtcPortRange
impl Eq for RtcPortRange
impl StructuralPartialEq for RtcPortRange
Auto Trait Implementations§
impl Freeze for RtcPortRange
impl RefUnwindSafe for RtcPortRange
impl Send for RtcPortRange
impl Sync for RtcPortRange
impl Unpin for RtcPortRange
impl UnsafeUnpin for RtcPortRange
impl UnwindSafe for RtcPortRange
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,
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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