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
sourceimpl 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.
sourceimpl FromStr for PortRange
impl FromStr for PortRange
type Err = PolicyError
type Err = PolicyError
The associated error which can be returned from parsing.
impl Eq for PortRange
impl StructuralEq for PortRange
impl StructuralPartialEq for PortRange
Auto Trait Implementations
impl RefUnwindSafe for PortRange
impl Send for PortRange
impl Sync for PortRange
impl Unpin for PortRange
impl UnwindSafe for PortRange
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more