docs(server): deprecated bind_connection, note about Connection's Opaque item

This commit is contained in:
Sean McArthur
2018-01-30 13:18:51 -08:00
parent 44af273853
commit 2a74b91181
2 changed files with 13 additions and 10 deletions

View File

@@ -105,6 +105,16 @@ pub struct AddrIncoming {
/// A future binding a connection with a Service. /// A future binding a connection with a Service.
/// ///
/// Polling this future will drive HTTP forward. /// Polling this future will drive HTTP forward.
///
/// # Note
///
/// This will currently yield an unnameable (`Opaque`) value
/// on success. The purpose of this is that nothing can be assumed about
/// the type, not even it's name. It's probable that in a later release,
/// this future yields the underlying IO object, which could be done without
/// a breaking change.
///
/// It is likely best to just map the value to `()`, for now.
#[must_use = "futures do nothing unless polled"] #[must_use = "futures do nothing unless polled"]
pub struct Connection<I, S> pub struct Connection<I, S>
where where

View File

@@ -30,17 +30,10 @@ impl<B: AsRef<[u8]> + 'static> Http<B> {
/// Use this `Http` instance to create a new server task which handles the /// Use this `Http` instance to create a new server task which handles the
/// connection `io` provided. /// connection `io` provided.
/// ///
/// This is the low-level method used to actually spawn handling a TCP /// # Deprecated
/// connection, typically. The `handle` provided is the event loop on which
/// the server task will be spawned, `io` is the I/O object associated with
/// this connection (data that's read/written), `remote_addr` is the remote
/// peer address of the HTTP client, and `service` defines how HTTP requests
/// will be handled (and mapped to responses).
/// ///
/// This method is typically not invoked directly but is rather transitively /// This method is deprecated. If seeking a replacement, consider
/// used through [`bind`](#method.bind). This can be useful, /// `Http::serve_connection`.
/// however, when writing mocks or accepting sockets from a non-TCP
/// location.
pub fn bind_connection<S, I, Bd>(&self, pub fn bind_connection<S, I, Bd>(&self,
handle: &Handle, handle: &Handle,
io: I, io: I,