Files
GopherGate/target/doc/src/mio/net/mod.rs.html
T
2026-02-26 12:00:21 -05:00

40 lines
5.9 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="Source of the Rust file `/home/newkirk/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mio-1.1.1/src/net/mod.rs`."><title>mod.rs - source</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="mio" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.1 (01f6ddf75 2026-02-11) (Arch Linux rust 1:1.93.1-1)" data-channel="1.93.1" data-search-js="search-9e2438ea.js" data-stringdex-js="stringdex-a3946164.js" data-settings-js="settings-c38705f0.js" ><script src="../../../static.files/storage-e2aeef58.js"></script><script defer src="../../../static.files/src-script-813739b1.js"></script><script defer src="../../../src-files.js"></script><script defer src="../../../static.files/main-a410ff4d.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-263c88ec.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc src"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="src-sidebar-title"><h2>Files</h2></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><section id="main-content" class="content"><div class="main-heading"><h1><div class="sub-heading">mio/net/</div>mod.rs</h1><rustdoc-toolbar></rustdoc-toolbar></div><div class="example-wrap digits-2"><pre class="rust"><code><a href=#1 id=1 data-nosnippet>1</a><span class="doccomment">//! Networking primitives.
<a href=#2 id=2 data-nosnippet>2</a>//!
<a href=#3 id=3 data-nosnippet>3</a>//! The types provided in this module are non-blocking by default and are
<a href=#4 id=4 data-nosnippet>4</a>//! designed to be portable across all supported Mio platforms. As long as the
<a href=#5 id=5 data-nosnippet>5</a>//! [portability guidelines] are followed, the behavior should be identical no
<a href=#6 id=6 data-nosnippet>6</a>//! matter the target platform.
<a href=#7 id=7 data-nosnippet>7</a>//!
<a href=#8 id=8 data-nosnippet>8</a>//! [portability guidelines]: ../struct.Poll.html#portability
<a href=#9 id=9 data-nosnippet>9</a>//!
<a href=#10 id=10 data-nosnippet>10</a>//! # Notes
<a href=#11 id=11 data-nosnippet>11</a>//!
<a href=#12 id=12 data-nosnippet>12</a>//! When using a datagram based socket, i.e. [`UdpSocket`] or [`UnixDatagram`],
<a href=#13 id=13 data-nosnippet>13</a>//! it's only possible to receive a packet once. This means that if you provide a
<a href=#14 id=14 data-nosnippet>14</a>//! buffer that is too small you won't be able to receive the data anymore. How
<a href=#15 id=15 data-nosnippet>15</a>//! OSs deal with this situation is different for each OS:
<a href=#16 id=16 data-nosnippet>16</a>//! * Unixes, such as Linux, FreeBSD and macOS, will simply fill the buffer and
<a href=#17 id=17 data-nosnippet>17</a>//! return the amount of bytes written. This means that if the returned value
<a href=#18 id=18 data-nosnippet>18</a>//! is equal to the size of the buffer it may have only written a part of the
<a href=#19 id=19 data-nosnippet>19</a>//! packet (or the packet has the same size as the buffer).
<a href=#20 id=20 data-nosnippet>20</a>//! * Windows returns an `WSAEMSGSIZE` error.
<a href=#21 id=21 data-nosnippet>21</a>//!
<a href=#22 id=22 data-nosnippet>22</a>//! Mio does not change the value (either ok or error) returned by the OS, it's
<a href=#23 id=23 data-nosnippet>23</a>//! up to the user to handle this. How to deal with these differences is still up
<a href=#24 id=24 data-nosnippet>24</a>//! for debate, specifically in
<a href=#25 id=25 data-nosnippet>25</a>//! &lt;https://github.com/rust-lang/rust/issues/55794&gt;. The best advice we can
<a href=#26 id=26 data-nosnippet>26</a>//! give is to always call receive with a large enough buffer.
<a href=#27 id=27 data-nosnippet>27</a>
<a href=#28 id=28 data-nosnippet>28</a></span><span class="kw">mod </span>tcp;
<a href=#29 id=29 data-nosnippet>29</a><span class="kw">pub use </span><span class="self">self</span>::tcp::{TcpListener, TcpStream};
<a href=#30 id=30 data-nosnippet>30</a>
<a href=#31 id=31 data-nosnippet>31</a><span class="attr">#[cfg(not(target_os = <span class="string">"wasi"</span>))]
<a href=#32 id=32 data-nosnippet>32</a></span><span class="kw">mod </span>udp;
<a href=#33 id=33 data-nosnippet>33</a><span class="attr">#[cfg(not(target_os = <span class="string">"wasi"</span>))]
<a href=#34 id=34 data-nosnippet>34</a></span><span class="kw">pub use </span><span class="self">self</span>::udp::UdpSocket;
<a href=#35 id=35 data-nosnippet>35</a>
<a href=#36 id=36 data-nosnippet>36</a><span class="attr">#[cfg(unix)]
<a href=#37 id=37 data-nosnippet>37</a></span><span class="kw">mod </span>uds;
<a href=#38 id=38 data-nosnippet>38</a><span class="attr">#[cfg(unix)]
<a href=#39 id=39 data-nosnippet>39</a></span><span class="kw">pub use </span><span class="self">self</span>::uds::{UnixDatagram, UnixListener, UnixStream};
</code></pre></div></section></main></body></html>