Debian Codegraph @

/

debian rust-nb-connect 1.2.0-2debian librust-nb-connect-dev debian librust-nb-connect+default-dev debian librust-nb-connect-1-dev debian librust-nb-connect-1+default-dev debian librust-nb-connect-1.2-dev debian librust-nb-connect-1.2+default-dev debian librust-nb-connect-1.2.0-dev debian librust-nb-connect-1.2.0+default-dev cargo nb-connect 1.2.0 debianjsonmakefilemarkdownrustrust-c-abishelltomlyaml 19 files · 75 symbols
View dependency graph

Depends on

  • debhelper (debhelper)
  • dh-cargo (dh-cargo)
  • rust-libc (librust-libc-0.2+default-dev)
  • cargo, librust-socket2-0.5+all-dev, librust-socket2-0.5+default-dev, libstd-rust-dev, rustc
README (full)

nb-connect (deprecated)

Build License Cargo Documentation

This crate is now deprecated in favor of socket2.

Non-blocking TCP or Unix connect.

This crate allows you to create a TcpStream or a UnixStream in a non-blocking way, without waiting for the connection to become fully established.

Examples

use polling::{Event, Poller};
use std::time::Duration;

// Create a pending TCP connection.
let stream = nb_connect::tcp(([127, 0, 0, 1], 80))?;

// Create a poller that waits for the stream to become writable.
let poller = Poller::new()?;
poller.add(&stream, Event::writable(0))?;

// Wait for at most 1 second.
if poller.wait(&mut Vec::new(), Some(Duration::from_secs(1)))? == 0 {
    println!("timeout");
} else if let Some(err) = stream.take_error()? {
    println!("error: {}", err);
} else {
    println!("connected");
}

License

Licensed under either of

  • Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

dir .github/
dir debian/
dir src/
file .cargo_vcs_info.json
file .gitignore
file CHANGELOG.md
file Cargo.toml
file Cargo.toml.orig
file LICENSE-APACHE
file LICENSE-MIT
file README.md