pub struct Protocol;Expand description
A marker type representing HTTP protocol variants.
This struct serves as a namespace for protocol-related utility functions, providing methods to identify HTTP and HTTPS protocols and retrieve their default port numbers.
Implementations§
Source§impl Protocol
Implementation of protocol identification and port resolution methods.
impl Protocol
Implementation of protocol identification and port resolution methods.
This implementation block provides utility functions for working with HTTP protocol strings, enabling identification of HTTP/HTTPS variants and retrieval of their standard port numbers.
Sourcepub fn get_port(protocol: &str) -> u16
pub fn get_port(protocol: &str) -> u16
Returns the default port number for the given protocol.
Performs a case-insensitive comparison to determine the protocol type and returns the corresponding standard port number.
§Arguments
&str: A string slice representing the protocol to lookup.
§Returns
u16: The default port number for the protocol.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Protocol
impl<'de> Deserialize<'de> for Protocol
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Protocol
impl Eq for Protocol
impl StructuralPartialEq for Protocol
Auto Trait Implementations§
impl Freeze for Protocol
impl RefUnwindSafe for Protocol
impl Send for Protocol
impl Sync for Protocol
impl Unpin for Protocol
impl UnwindSafe for Protocol
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