15 lines
14 KiB
HTML
15 lines
14 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="API documentation for the Rust `ToSocketAddrs` trait in crate `tokio`."><meta name="keywords" content="rust, rustlang, rust-lang, ToSocketAddrs"><title>tokio::net::ToSocketAddrs - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css" disabled ><link rel="stylesheet" type="text/css" href="../../ayu.css" disabled ><script id="default-settings"></script><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="icon" type="image/svg+xml" href="../../favicon.svg">
|
||
<link rel="alternate icon" type="image/png" href="../../favicon-16x16.png">
|
||
<link rel="alternate icon" type="image/png" href="../../favicon-32x32.png"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc trait"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">☰</div><a href='../../tokio/index.html'><div class='logo-container rust-logo'><img src='../../rust-logo.png' alt='logo'></div></a><p class="location">Trait ToSocketAddrs</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#foreign-impls">Implementations on Foreign Types</a><div class="sidebar-links"><a href="#impl-ToSocketAddrs-for-%26%27_%20T">&'_ T</a><a href="#impl-ToSocketAddrs-for-%26%27_%20%5BSocketAddr%5D">&'_ [SocketAddr]</a><a href="#impl-ToSocketAddrs-for-(%26%27_%20str%2C%20u16)">(&'_ str, u16)</a><a href="#impl-ToSocketAddrs-for-(IpAddr%2C%20u16)">(IpAddr, u16)</a><a href="#impl-ToSocketAddrs-for-(Ipv4Addr%2C%20u16)">(Ipv4Addr, u16)</a><a href="#impl-ToSocketAddrs-for-(Ipv6Addr%2C%20u16)">(Ipv6Addr, u16)</a><a href="#impl-ToSocketAddrs-for-(String%2C%20u16)">(String, u16)</a><a href="#impl-ToSocketAddrs-for-SocketAddr">SocketAddr</a><a href="#impl-ToSocketAddrs-for-SocketAddrV4">SocketAddrV4</a><a href="#impl-ToSocketAddrs-for-SocketAddrV6">SocketAddrV6</a><a href="#impl-ToSocketAddrs-for-String">String</a><a href="#impl-ToSocketAddrs-for-str">str</a></div><a class="sidebar-title" href="#implementors">Implementors</a></div><p class="location"><a href="../index.html">tokio</a>::<wbr><a href="index.html">net</a></p><script>window.sidebarCurrent = {name: "ToSocketAddrs", ty: "trait", relpath: ""};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!" aria-haspopup="menu"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices" role="menu"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"></div><span class="help-button">?</span>
|
||
<a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class="fqn"><span class="out-of-band"><span id="render-detail"><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class="inner">−</span>]</a></span><a class="srclink" href="../../src/tokio/net/addr.rs.html#22" title="goto source code">[src]</a></span><span class="in-band">Trait <a href="../index.html">tokio</a>::<wbr><a href="index.html">net</a>::<wbr><a class="trait" href="">ToSocketAddrs</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class="rust trait">pub trait ToSocketAddrs: ToSocketAddrsPriv { }</pre></div><div class="docblock"><p>Converts or resolves without blocking to one or more <code>SocketAddr</code> values.</p>
|
||
<h1 id="dns" class="section-header"><a href="#dns">DNS</a></h1>
|
||
<p>Implementations of <code>ToSocketAddrs</code> for string types require a DNS lookup.
|
||
These implementations are only provided when Tokio is used with the
|
||
<strong><code>net</code></strong> feature flag.</p>
|
||
<h1 id="calling" class="section-header"><a href="#calling">Calling</a></h1>
|
||
<p>Currently, this trait is only used as an argument to Tokio functions that
|
||
need to reference a target socket address. To perform a <code>SocketAddr</code>
|
||
conversion directly, use <a href="../../tokio/net/fn.lookup_host.html"><code>lookup_host()</code></a>.</p>
|
||
<p>This trait is sealed and is intended to be opaque. The details of the trait
|
||
will change. Stabilization is pending enhancements to the Rust language.</p>
|
||
</div><h2 id="foreign-impls" class="small-section-header">Implementations on Foreign Types<a href="#foreign-impls" class="anchor"></a></h2><h3 id="impl-ToSocketAddrs-for-%26%27_%20T" class="impl"><code class="in-band">impl<T: <a class="trait" href="../../tokio/net/trait.ToSocketAddrs.html" title="trait tokio::net::ToSocketAddrs">ToSocketAddrs</a> + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>, '_> <a class="trait" href="../../tokio/net/trait.ToSocketAddrs.html" title="trait tokio::net::ToSocketAddrs">ToSocketAddrs</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&'_ </a>T</code><a href="#impl-ToSocketAddrs-for-%26%27_%20T" class="anchor"></a><a class="srclink" href="../../src/tokio/net/addr.rs.html#37" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-ToSocketAddrs-for-SocketAddr" class="impl"><code class="in-band">impl <a class="trait" href="../../tokio/net/trait.ToSocketAddrs.html" title="trait tokio::net::ToSocketAddrs">ToSocketAddrs</a> for <a class="enum" href="https://doc.rust-lang.org/nightly/std/net/addr/enum.SocketAddr.html" title="enum std::net::addr::SocketAddr">SocketAddr</a></code><a href="#impl-ToSocketAddrs-for-SocketAddr" class="anchor"></a><a class="srclink" href="../../src/tokio/net/addr.rs.html#53" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-ToSocketAddrs-for-SocketAddrV4" class="impl"><code class="in-band">impl <a class="trait" href="../../tokio/net/trait.ToSocketAddrs.html" title="trait tokio::net::ToSocketAddrs">ToSocketAddrs</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/std/net/addr/struct.SocketAddrV4.html" title="struct std::net::addr::SocketAddrV4">SocketAddrV4</a></code><a href="#impl-ToSocketAddrs-for-SocketAddrV4" class="anchor"></a><a class="srclink" href="../../src/tokio/net/addr.rs.html#67" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-ToSocketAddrs-for-SocketAddrV6" class="impl"><code class="in-band">impl <a class="trait" href="../../tokio/net/trait.ToSocketAddrs.html" title="trait tokio::net::ToSocketAddrs">ToSocketAddrs</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/std/net/addr/struct.SocketAddrV6.html" title="struct std::net::addr::SocketAddrV6">SocketAddrV6</a></code><a href="#impl-ToSocketAddrs-for-SocketAddrV6" class="anchor"></a><a class="srclink" href="../../src/tokio/net/addr.rs.html#80" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-ToSocketAddrs-for-(IpAddr%2C%20u16)" class="impl"><code class="in-band">impl <a class="trait" href="../../tokio/net/trait.ToSocketAddrs.html" title="trait tokio::net::ToSocketAddrs">ToSocketAddrs</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="enum" href="https://doc.rust-lang.org/nightly/std/net/ip/enum.IpAddr.html" title="enum std::net::ip::IpAddr">IpAddr</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a href="#impl-ToSocketAddrs-for-(IpAddr%2C%20u16)" class="anchor"></a><a class="srclink" href="../../src/tokio/net/addr.rs.html#93" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-ToSocketAddrs-for-(Ipv4Addr%2C%20u16)" class="impl"><code class="in-band">impl <a class="trait" href="../../tokio/net/trait.ToSocketAddrs.html" title="trait tokio::net::ToSocketAddrs">ToSocketAddrs</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="struct" href="https://doc.rust-lang.org/nightly/std/net/ip/struct.Ipv4Addr.html" title="struct std::net::ip::Ipv4Addr">Ipv4Addr</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a href="#impl-ToSocketAddrs-for-(Ipv4Addr%2C%20u16)" class="anchor"></a><a class="srclink" href="../../src/tokio/net/addr.rs.html#107" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-ToSocketAddrs-for-(Ipv6Addr%2C%20u16)" class="impl"><code class="in-band">impl <a class="trait" href="../../tokio/net/trait.ToSocketAddrs.html" title="trait tokio::net::ToSocketAddrs">ToSocketAddrs</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="struct" href="https://doc.rust-lang.org/nightly/std/net/ip/struct.Ipv6Addr.html" title="struct std::net::ip::Ipv6Addr">Ipv6Addr</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a href="#impl-ToSocketAddrs-for-(Ipv6Addr%2C%20u16)" class="anchor"></a><a class="srclink" href="../../src/tokio/net/addr.rs.html#121" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-ToSocketAddrs-for-%26%27_%20%5BSocketAddr%5D" class="impl"><code class="in-band">impl<'_> <a class="trait" href="../../tokio/net/trait.ToSocketAddrs.html" title="trait tokio::net::ToSocketAddrs">ToSocketAddrs</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">&'_ [</a><a class="enum" href="https://doc.rust-lang.org/nightly/std/net/addr/enum.SocketAddr.html" title="enum std::net::addr::SocketAddr">SocketAddr</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.slice.html">]</a></code><a href="#impl-ToSocketAddrs-for-%26%27_%20%5BSocketAddr%5D" class="anchor"></a><a class="srclink" href="../../src/tokio/net/addr.rs.html#135" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-ToSocketAddrs-for-str" class="impl"><code class="in-band">impl <a class="trait" href="../../tokio/net/trait.ToSocketAddrs.html" title="trait tokio::net::ToSocketAddrs">ToSocketAddrs</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a></code><a href="#impl-ToSocketAddrs-for-str" class="anchor"></a><a class="srclink" href="../../src/tokio/net/addr.rs.html#150" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-ToSocketAddrs-for-(%26%27_%20str%2C%20u16)" class="impl"><code class="in-band">impl<'_> <a class="trait" href="../../tokio/net/trait.ToSocketAddrs.html" title="trait tokio::net::ToSocketAddrs">ToSocketAddrs</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a>&'_ <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a href="#impl-ToSocketAddrs-for-(%26%27_%20str%2C%20u16)" class="anchor"></a><a class="srclink" href="../../src/tokio/net/addr.rs.html#178" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-ToSocketAddrs-for-(String%2C%20u16)" class="impl"><code class="in-band">impl <a class="trait" href="../../tokio/net/trait.ToSocketAddrs.html" title="trait tokio::net::ToSocketAddrs">ToSocketAddrs</a> for <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">(</a><a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u16.html">u16</a><a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.tuple.html">)</a></code><a href="#impl-ToSocketAddrs-for-(String%2C%20u16)" class="anchor"></a><a class="srclink" href="../../src/tokio/net/addr.rs.html#215" title="goto source code">[src]</a></h3><div class="impl-items"></div><h3 id="impl-ToSocketAddrs-for-String" class="impl"><code class="in-band">impl <a class="trait" href="../../tokio/net/trait.ToSocketAddrs.html" title="trait tokio::net::ToSocketAddrs">ToSocketAddrs</a> for <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></code><a href="#impl-ToSocketAddrs-for-String" class="anchor"></a><a class="srclink" href="../../src/tokio/net/addr.rs.html#228" title="goto source code">[src]</a></h3><div class="impl-items"></div><span class="loading-content">Loading content...</span><h2 id="implementors" class="small-section-header">Implementors<a href="#implementors" class="anchor"></a></h2><div class="item-list" id="implementors-list"></div><span class="loading-content">Loading content...</span><script type="text/javascript" src="../../implementors/tokio/net/trait.ToSocketAddrs.js" async></script></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "tokio";</script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html> |