<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="generator" content="rustdoc"> <meta name="description" content="API documentation for the Rust `ServerConnection` struct in crate `solicit`."> <meta name="keywords" content="rust, rustlang, rust-lang, ServerConnection"> <title>solicit::http::server::ServerConnection - Rust</title> <link rel="stylesheet" type="text/css" href="../../../rustdoc.css"> <link rel="stylesheet" type="text/css" href="../../../main.css"> </head> <body class="rustdoc"> <!--[if lte IE 8]> <div class="warning"> This old browser is unsupported and will most likely display funky things. </div> <![endif]--> <nav class="sidebar"> <p class='location'><a href='../../index.html'>solicit</a>::<wbr><a href='../index.html'>http</a>::<wbr><a href='index.html'>server</a></p><script>window.sidebarCurrent = {name: 'ServerConnection', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script> </nav> <nav class="sub"> <form class="search-form js-only"> <div class="search-container"> <input class="search-input" name="search" autocomplete="off" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"> </div> </form> </nav> <section id='main' class="content struct"> <h1 class='fqn'><span class='in-band'>Struct <a href='../../index.html'>solicit</a>::<wbr><a href='../index.html'>http</a>::<wbr><a href='index.html'>server</a>::<wbr><a class='struct' href=''>ServerConnection</a></span><span class='out-of-band'><span id='render-detail'> <a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs"> [<span class='inner'>−</span>] </a> </span><a id='src-1476' class='srclink' href='../../../src/solicit/http/server.rs.html#83-91' title='goto source code'>[src]</a></span></h1> <pre class='rust struct'>pub struct ServerConnection<S, R, State = <a class='struct' href='../../../solicit/http/session/struct.DefaultSessionState.html' title='solicit::http::session::DefaultSessionState'>DefaultSessionState</a><<a class='struct' href='../../../solicit/http/session/struct.DefaultStream.html' title='solicit::http::session::DefaultStream'>DefaultStream</a>>> <span class='where'>where S: <a class='trait' href='../../../solicit/http/connection/trait.SendFrame.html' title='solicit::http::connection::SendFrame'>SendFrame</a>, R: <a class='trait' href='../../../solicit/http/connection/trait.ReceiveFrame.html' title='solicit::http::connection::ReceiveFrame'>ReceiveFrame</a>, State: <a class='trait' href='../../../solicit/http/session/trait.SessionState.html' title='solicit::http::session::SessionState'>SessionState</a></span> { pub state: State, // some fields omitted }</pre><div class='docblock'><p>The struct provides a more convenient API for server-related functionality of an HTTP/2 connection, such as sending a response back to the client.</p> </div><h2 class='fields'>Fields</h2><span id='structfield.state' class='structfield'><code>state: State</code> </span><span class='stab '></span><div class='docblock'><p>The state of the session associated to this client connection. Maintains the status of the connection streams.</p> </div><h2 id='methods'>Methods</h2><h3 class='impl'><span class='in-band'><code>impl<S, R, State> <a class='struct' href='../../../solicit/http/server/struct.ServerConnection.html' title='solicit::http::server::ServerConnection'>ServerConnection</a><S, R, State> <span class='where'>where S: <a class='trait' href='../../../solicit/http/connection/trait.SendFrame.html' title='solicit::http::connection::SendFrame'>SendFrame</a>, R: <a class='trait' href='../../../solicit/http/connection/trait.ReceiveFrame.html' title='solicit::http::connection::ReceiveFrame'>ReceiveFrame</a>, State: <a class='trait' href='../../../solicit/http/session/trait.SessionState.html' title='solicit::http::session::SessionState'>SessionState</a></span></code></span><span class='out-of-band'><div class='ghost'></div><a id='src-1482' class='srclink' href='../../../src/solicit/http/server.rs.html#93-166' title='goto source code'>[src]</a></span></h3> <div class='impl-items'><h4 id='method.with_connection' class='method'><code>fn <a href='#method.with_connection' class='fnname'>with_connection</a>(conn: <a class='struct' href='../../../solicit/http/connection/struct.HttpConnection.html' title='solicit::http::connection::HttpConnection'>HttpConnection</a><S, R>, state: State) -> <a class='struct' href='../../../solicit/http/server/struct.ServerConnection.html' title='solicit::http::server::ServerConnection'>ServerConnection</a><S, R, State></code></h4> <div class='docblock'><p>Creates a new <code>ServerConnection</code> that will use the given <code>HttpConnection</code> for its underlying HTTP/2 communication.</p> </div><h4 id='method.scheme' class='method'><code>fn <a href='#method.scheme' class='fnname'>scheme</a>(&self) -> <a class='enum' href='../../../solicit/http/enum.HttpScheme.html' title='solicit::http::HttpScheme'>HttpScheme</a></code></h4> <div class='docblock'><p>Returns the scheme of the underlying <code>HttpConnection</code>.</p> </div><h4 id='method.init' class='method'><code>fn <a href='#method.init' class='fnname'>init</a>(&mut self) -> <a class='type' href='../../../solicit/http/type.HttpResult.html' title='solicit::http::HttpResult'>HttpResult</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>></code></h4> <div class='docblock'><p>Initializes the <code>ServerConnection</code> by sending the server's settings and processing the client's. If the client does not provide a settings frame, returns an error.</p> <p>TODO This method should eventually be split into two.</p> </div><h4 id='method.handle_next_frame' class='method'><code>fn <a href='#method.handle_next_frame' class='fnname'>handle_next_frame</a>(&mut self) -> <a class='type' href='../../../solicit/http/type.HttpResult.html' title='solicit::http::HttpResult'>HttpResult</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>></code></h4> <div class='docblock'><p>Fully handles the next incoming frame. Events are passed on to the internal <code>session</code> instance.</p> </div><h4 id='method.start_response' class='method'><code>fn <a href='#method.start_response' class='fnname'>start_response</a>(&mut self, headers: <a class='struct' href='https://doc.rust-lang.org/nightly/collections/vec/struct.Vec.html' title='collections::vec::Vec'>Vec</a><<a class='type' href='../../../solicit/http/type.Header.html' title='solicit::http::Header'>Header</a>>, stream_id: <a class='type' href='../../../solicit/http/type.StreamId.html' title='solicit::http::StreamId'>StreamId</a>, end_stream: <a class='enum' href='../../../solicit/http/connection/enum.EndStream.html' title='solicit::http::connection::EndStream'>EndStream</a>) -> <a class='type' href='../../../solicit/http/type.HttpResult.html' title='solicit::http::HttpResult'>HttpResult</a><<a class='primitive' href='https://doc.rust-lang.org/nightly/std/primitive.tuple.html'>()</a>></code></h4> <div class='docblock'><p>Starts a response on the stream with the given ID by sending the given headers.</p> <p>The body of the response is assumed to be provided by the <code>Stream</code> instance stored within the connection's state. (The body does not have to be ready when this method is called, as long as the <code>Stream</code> instance knows how to provide it to the connection later on.)</p> </div><h4 id='method.send_next_data' class='method'><code>fn <a href='#method.send_next_data' class='fnname'>send_next_data</a>(&mut self) -> <a class='type' href='../../../solicit/http/type.HttpResult.html' title='solicit::http::HttpResult'>HttpResult</a><<a class='enum' href='../../../solicit/http/connection/enum.SendStatus.html' title='solicit::http::connection::SendStatus'>SendStatus</a>></code></h4> <div class='docblock'><p>Queues a new DATA frame onto the underlying <code>SendFrame</code>.</p> <p>Currently, no prioritization of streams is taken into account and which stream's data is queued cannot be relied on.</p> </div></div></section> <section id='search' class="content hidden"></section> <section class="footer"></section> <aside id="help" class="hidden"> <div> <h1 class="hidden">Help</h1> <div class="shortcuts"> <h2>Keyboard Shortcuts</h2> <dl> <dt>?</dt> <dd>Show this help dialog</dd> <dt>S</dt> <dd>Focus the search field</dd> <dt>⇤</dt> <dd>Move up in search results</dd> <dt>⇥</dt> <dd>Move down in search results</dd> <dt>⏎</dt> <dd>Go to active search result</dd> <dt>+</dt> <dd>Collapse/expand all sections</dd> </dl> </div> <div class="infos"> <h2>Search Tricks</h2> <p> Prefix searches with a type followed by a colon (e.g. <code>fn:</code>) to restrict the search to a given type. </p> <p> Accepted types are: <code>fn</code>, <code>mod</code>, <code>struct</code>, <code>enum</code>, <code>trait</code>, <code>type</code>, <code>macro</code>, and <code>const</code>. </p> <p> Search functions by type signature (e.g. <code>vec -> usize</code> or <code>* -> vec</code>) </p> </div> </div> </aside> <script> window.rootPath = "../../../"; window.currentCrate = "solicit"; window.playgroundUrl = ""; </script> <script src="../../../jquery.js"></script> <script src="../../../main.js"></script> <script defer src="../../../search-index.js"></script> </body> </html>