api_schema/router.rs: improve doc

This commit is contained in:
Dietmar Maurer 2019-02-17 10:30:41 +01:00
parent ef2f2efbcc
commit d21c2710da
1 changed files with 7 additions and 0 deletions

View File

@ -12,16 +12,23 @@ use hyper::http::request::Parts;
pub type BoxFut = Box<Future<Item = Response<Body>, Error = failure::Error> + Send>; pub type BoxFut = Box<Future<Item = Response<Body>, Error = failure::Error> + Send>;
/// Abstract Interface for API methods to interact with the environment
pub trait RpcEnvironment { pub trait RpcEnvironment {
/// Use this to pass additional result data. It is up to the environment
/// how the data is used.
fn set_result_attrib(&mut self, name: &str, value: Value); fn set_result_attrib(&mut self, name: &str, value: Value);
/// Query additional result data.
fn get_result_attrib(&self, name: &str) -> Option<&Value>; fn get_result_attrib(&self, name: &str) -> Option<&Value>;
/// The environment type
fn env_type(&self) -> RpcEnvironmentType; fn env_type(&self) -> RpcEnvironmentType;
/// Set user name
fn set_user(&mut self, user: Option<String>); fn set_user(&mut self, user: Option<String>);
/// Get user name
fn get_user(&self) -> Option<String>; fn get_user(&self) -> Option<String>;
} }