pub trait EvalSite: Send + Sync {
// Required methods
fn site_kind(&self) -> &'static str;
fn address(&self) -> &ServerAddress;
fn codecs(&self) -> &[Symbol];
fn answer(&self, cx: &mut Cx, frame: ServerFrame) -> Result<ServerFrame>;
fn as_any(&self) -> &dyn Any;
// Provided methods
fn answer_with_timeout(
&self,
cx: &mut Cx,
frame: ServerFrame,
_timeout: Option<Duration>,
) -> Result<ServerFrame> { ... }
fn close_connection(&self, _cx: &mut Cx) -> Result<()> { ... }
fn stream(
&self,
cx: &mut Cx,
frame: ServerFrame,
sink: &mut dyn StreamSink,
) -> Result<()> { ... }
fn as_eval_fabric(&self) -> Option<&dyn EvalFabric> { ... }
}Expand description
A request-answering eval endpoint: it accepts server frames and produces
reply frames, optionally streaming or exposing an EvalFabric.
Required Methods§
Sourcefn address(&self) -> &ServerAddress
fn address(&self) -> &ServerAddress
Returns the address this site answers at.
Sourcefn answer(&self, cx: &mut Cx, frame: ServerFrame) -> Result<ServerFrame>
fn answer(&self, cx: &mut Cx, frame: ServerFrame) -> Result<ServerFrame>
Answers frame, returning the reply frame.
Provided Methods§
Sourcefn answer_with_timeout(
&self,
cx: &mut Cx,
frame: ServerFrame,
_timeout: Option<Duration>,
) -> Result<ServerFrame>
fn answer_with_timeout( &self, cx: &mut Cx, frame: ServerFrame, _timeout: Option<Duration>, ) -> Result<ServerFrame>
Answers frame with an optional deadline. Defaults to EvalSite::answer.
Sourcefn close_connection(&self, _cx: &mut Cx) -> Result<()>
fn close_connection(&self, _cx: &mut Cx) -> Result<()>
Closes any connection backing the site. Defaults to a no-op.
Sourcefn stream(
&self,
cx: &mut Cx,
frame: ServerFrame,
sink: &mut dyn StreamSink,
) -> Result<()>
fn stream( &self, cx: &mut Cx, frame: ServerFrame, sink: &mut dyn StreamSink, ) -> Result<()>
Streams the answer to frame into sink. The default path answers once
and emits a single chunk followed by end.
Sourcefn as_eval_fabric(&self) -> Option<&dyn EvalFabric>
fn as_eval_fabric(&self) -> Option<&dyn EvalFabric>
Returns this site as an EvalFabric when it backs one. Defaults to None.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".