[−][src]Trait srv_rs::SrvRecord
Representation of types that contain the fields of a SRV record.
Associated Types
type Target: Display + ?Sized
[src]
Type representing the SRV record's target. Must implement Display
so
it can be used to create a Uri
.
Required methods
pub fn target(&self) -> &Self::Target
[src]
Gets a SRV record's target.
pub fn port(&self) -> u16
[src]
Gets a SRV record's port.
pub fn priority(&self) -> u16
[src]
Gets a SRV record's priority.
pub fn weight(&self) -> u16
[src]
Gets a SRV record's weight.
Provided methods
pub fn parse(
&self,
scheme: impl TryInto<Scheme, Error = impl Into<Error>>,
path_and_query: impl TryInto<PathAndQuery, Error = impl Into<Error>>
) -> Result<Uri, Error>
[src]
&self,
scheme: impl TryInto<Scheme, Error = impl Into<Error>>,
path_and_query: impl TryInto<PathAndQuery, Error = impl Into<Error>>
) -> Result<Uri, Error>
Parses a SRV record into a URI with a given scheme (e.g. https) and
path_and_query
(used as a suffix in the URI).
use srv_rs::{resolver::libresolv::LibResolvSrvRecord, SrvRecord}; let record = LibResolvSrvRecord { priority: 1, weight: 100, port: 8211, target: String::from("srv-client-rust.deshaw.org"), }; assert_eq!( &record.parse("https", "/")?.to_string(), "https://srv-client-rust.deshaw.org:8211/" ); assert_eq!( &record.parse("http", "/bar")?.to_string(), "http://srv-client-rust.deshaw.org:8211/bar" );
pub fn sort_key(&self, rng: impl Rng) -> (u16, Reverse<u32>)
[src]
Generates a key to sort a SRV record by priority and weight per RFC 2782.