1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-25 09:59:21 +02:00

update examples

This commit is contained in:
Nikolay Kim
2017-12-18 13:06:41 -08:00
parent 27d92f3a23
commit 9ed4159c0c
5 changed files with 13 additions and 14 deletions

View File

@ -11,7 +11,8 @@
//! HttpServer::new(
//! || Application::new()
//! .resource("/{name}", |r| r.f(index)))
//! .serve("127.0.0.1:8080");
//! .bind("127.0.0.1:8080")?
//! .start()
//! }
//! ```
//!

View File

@ -177,9 +177,8 @@ impl<T, A, H, U, V> HttpServer<T, A, H, U>
/// Start listening for incomming connections from a stream.
///
/// This method uses only one thread for handling incoming connections.
pub fn start_incoming<S, Addr>(mut self, stream: S, secure: bool) -> io::Result<Addr>
where Self: ActorAddress<Self, Addr>,
S: Stream<Item=(T, A), Error=io::Error> + 'static
pub fn start_incoming<S>(mut self, stream: S, secure: bool) -> io::Result<SyncAddress<Self>>
where S: Stream<Item=(T, A), Error=io::Error> + 'static
{
if !self.sockets.is_empty() {
let addrs: Vec<(net::SocketAddr, Socket)> = self.sockets.drain().collect();
@ -324,9 +323,7 @@ impl<H: HttpHandler, U, V> HttpServer<TlsStream<TcpStream>, net::SocketAddr, H,
V: IntoHttpHandler<Handler=H>,
{
/// Start listening for incomming tls connections.
pub fn start_tls<Addr>(mut self, pkcs12: ::Pkcs12) -> io::Result<Addr>
where Self: ActorAddress<Self, Addr>,
{
pub fn start_tls(mut self, pkcs12: ::Pkcs12) -> io::Result<SyncAddress<Self>> {
if self.sockets.is_empty() {
Err(io::Error::new(io::ErrorKind::Other, "No socket addresses are bound"))
} else {
@ -363,9 +360,7 @@ impl<H: HttpHandler, U, V> HttpServer<SslStream<TcpStream>, net::SocketAddr, H,
/// Start listening for incomming tls connections.
///
/// This method sets alpn protocols to "h2" and "http/1.1"
pub fn start_ssl<Addr>(mut self, identity: &ParsedPkcs12) -> io::Result<Addr>
where Self: ActorAddress<Self, Addr>,
{
pub fn start_ssl(mut self, identity: &ParsedPkcs12) -> io::Result<SyncAddress<Self>> {
if self.sockets.is_empty() {
Err(io::Error::new(io::ErrorKind::Other, "No socket addresses are bound"))
} else {