pub struct Server { /* private fields */ }Expand description
The protocol state over a surface: whether the client has initialised, who it said it was, the version to announce, and the HTTP endpoint of the shared server this session belongs to, when there is one.
Implementations§
Source§impl Server
impl Server
Sourcepub fn new(surface: Surface, version: &'static str) -> Self
pub fn new(surface: Surface, version: &'static str) -> Self
A server over a surface, announcing version as its own.
Sourcepub fn with_endpoint(self, url: Option<String>) -> Self
pub fn with_endpoint(self, url: Option<String>) -> Self
The base URL of the shared server (http://127.0.0.1:8741) the initialize
instructions name, so that a client learns where Swagger UI and the peers are.
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Has the client completed initialize?
Sourcepub fn client(&self) -> Option<&ClientInfo>
pub fn client(&self) -> Option<&ClientInfo>
What the client said in initialize, when it has.
Sourcepub fn resume(&mut self, client: ClientInfo)
pub fn resume(&mut self, client: ClientInfo)
Resume a session another process was serving: the client already initialised there and will not do so again. The peer is identified on the board as it was.
Sourcepub fn parse_error(reason: &str) -> Value
pub fn parse_error(reason: &str) -> Value
The response to a parse failure of an incoming line.
Sourcepub fn handle(&mut self, message: Value) -> Option<Reply>
pub fn handle(&mut self, message: Value) -> Option<Reply>
Handle one decoded message. A notification yields None; a batch yields a batch of
the responses its requests produced, or None when it held only notifications.
Sourcepub fn instructions(&self) -> String
pub fn instructions(&self) -> String
The text a client reads after initialize: what is served, what of it writes, where
the shared server is, and who else is attached.