pub trait Service:
Sized
+ RefUnwindSafe
+ 'static {
type Req: Serialize + DeserializeOwned;
type Res: Serialize + DeserializeOwned;
type Config: Serialize + DeserializeOwned + Clone + 'static;
// Required methods
fn args(config: &Self::Config) -> Vec<OsString>;
fn timeout(config: &Self::Config) -> Duration;
fn create(config: Self::Config) -> Result<Self, IoError>;
fn handle(&self, request: Self::Req) -> Self::Res;
}Expand description
In order to sandbox some logic, there needs to be an implementation of this trait for it.
Required Associated Types§
Sourcetype Req: Serialize + DeserializeOwned
type Req: Serialize + DeserializeOwned
The request, sent from the parent to the child.
Sourcetype Res: Serialize + DeserializeOwned
type Res: Serialize + DeserializeOwned
The response, sent from the child to the parent after the request has been processed.
Sourcetype Config: Serialize + DeserializeOwned + Clone + 'static
type Config: Serialize + DeserializeOwned + Clone + 'static
The config is passed to the child on startup.
Required Methods§
Sourcefn args(config: &Self::Config) -> Vec<OsString>
fn args(config: &Self::Config) -> Vec<OsString>
When your app is passed these CLI flags, it should call
become_child.
Sourcefn timeout(config: &Self::Config) -> Duration
fn timeout(config: &Self::Config) -> Duration
The amount of time that can be spent servicing queries.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.