1
0
mirror of https://github.com/actix/actix-extras.git synced 2025-06-26 02:19:22 +02:00

Add missing API docs

These were written without much knowledge of the actix-web internals!
Please review carefully!
This commit is contained in:
Pascal Hertleif
2018-06-02 15:51:58 +02:00
parent 47b7be4fd3
commit 890a7e70d6
24 changed files with 82 additions and 2 deletions

View File

@ -31,11 +31,17 @@ use {HAS_OPENSSL, HAS_TLS};
/// Client connector usage stats
#[derive(Default, Message)]
pub struct ClientConnectorStats {
/// Number of waited-on connections
pub waits: usize,
/// Number of reused connections
pub reused: usize,
/// Number of opened connections
pub opened: usize,
/// Number of closed connections
pub closed: usize,
/// Number of connections with errors
pub errors: usize,
/// Number of connection timeouts
pub timeouts: usize,
}
@ -1059,6 +1065,7 @@ impl Drop for AcquiredConn {
}
}
/// HTTP client connection
pub struct Connection {
key: Key,
stream: Box<IoStream + Send>,
@ -1082,20 +1089,24 @@ impl Connection {
}
}
/// Raw IO stream
pub fn stream(&mut self) -> &mut IoStream {
&mut *self.stream
}
/// Create a new connection from an IO Stream
pub fn from_stream<T: IoStream + Send>(io: T) -> Connection {
Connection::new(Key::empty(), None, Box::new(io))
}
/// Close connection pool
pub fn close(mut self) {
if let Some(mut pool) = self.pool.take() {
pool.close(self)
}
}
/// Release this connection from the connection pool
pub fn release(mut self) {
if let Some(mut pool) = self.pool.take() {
pool.release(self)