Struct tor_netdoc::types::policy::PortRange
source · pub struct PortRange {
pub lo: u16,
pub hi: u16,
}
Expand description
A PortRange is a set of consecutively numbered TCP or UDP ports.
§Example
use tor_netdoc::types::policy::PortRange;
let r: PortRange = "22-8000".parse().unwrap();
assert!(r.contains(128));
assert!(r.contains(22));
assert!(r.contains(8000));
assert!(! r.contains(21));
assert!(! r.contains(8001));
Fields§
§lo: u16
The first port in this range.
hi: u16
The last port in this range.
Implementations§
Trait Implementations§
source§impl Display for PortRange
impl Display for PortRange
A PortRange is displayed as a number if it contains a single port, and as a start point and end point separated by a dash if it contains more than one port.
source§impl FromStr for PortRange
impl FromStr for PortRange
§type Err = PolicyError
type Err = PolicyError
The associated error which can be returned from parsing.
source§impl PartialEq for PortRange
impl PartialEq for PortRange
impl Eq for PortRange
impl StructuralPartialEq for PortRange
Auto Trait Implementations§
impl Freeze for PortRange
impl RefUnwindSafe for PortRange
impl Send for PortRange
impl Sync for PortRange
impl Unpin for PortRange
impl UnwindSafe for PortRange
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
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§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