# [−][src]Crate net2

Extensions to `std::net` networking types.

This crate implements a number of extensions to the standard `std::net` networking types, hopefully being slated for inclusion into the standard library in the future. The goal of this crate is to expose all sorts of cross-platform and platform-specific configuration options of UDP/TCP sockets. System APIs are wrapped with as thin a layer as possible instead of bundling multiple actions into one API call.

More information about the design of this crate can be found in the associated rfc

# Examples

    use net2::TcpBuilder;

    let tcp = TcpBuilder::new_v4().unwrap();
    tcp.reuse_address(true).unwrap()
       .only_v6(false).unwrap();

    let mut stream = tcp.connect("127.0.0.1:80").unwrap();

    // use `stream` as a TcpStream

## Modules

unix | Unix-specific extensions to the `std::net` types.

## Structs

TcpBuilder | An "in progress" TCP socket which has not yet been connected or listened.
UdpBuilder | An "in progress" UDP socket which has not yet been connected.

## Traits

TcpListenerExt | Extension methods for the standard `TcpListener` type in `std::net`.
TcpStreamExt | Extension methods for the standard `TcpStream` type in `std::net`.
UdpSocketExt | Extension methods for the standard `UdpSocket` type in `std::net`.

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g., `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g., `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g., `str,u8` or `String,struct:Vec,test`)