pub trait TauRpcHandler<R: Runtime>: Sized {
const TRAIT_NAME: &'static str;
const PATH_PREFIX: &'static str;
const EXPORT_PATH: Option<&'static str>;
// Required methods
fn handle_incoming_request(self, invoke: Invoke<R>);
fn spawn(self) -> Sender<Arc<Invoke<R>>>;
fn args_map() -> String;
fn collect_fn_types(type_map: &mut TypeCollection) -> Vec<Function>;
}Expand description
A trait, which is automatically implemented by #[taurpc::procedures], that is used for handling incoming requests
and the type generation.
Required Associated Constants§
const TRAIT_NAME: &'static str
Sourceconst PATH_PREFIX: &'static str
const PATH_PREFIX: &'static str
This handler’s prefix in the TypeScript router.
Sourceconst EXPORT_PATH: Option<&'static str>
const EXPORT_PATH: Option<&'static str>
Bindings export path optionally specified by the user.
Required Methods§
Sourcefn handle_incoming_request(self, invoke: Invoke<R>)
fn handle_incoming_request(self, invoke: Invoke<R>)
Handle a single incoming request
Sourcefn spawn(self) -> Sender<Arc<Invoke<R>>>
fn spawn(self) -> Sender<Arc<Invoke<R>>>
Spawn a new tokio thread that listens for and handles incoming request through a tokio::broadcast::channel.
This is used for when you have multiple handlers inside a router.
Sourcefn args_map() -> String
fn args_map() -> String
Returns a json object containing the arguments for the methods. This is used on the frontend to ensure the arguments are send with their correct idents to the backend.
Sourcefn collect_fn_types(type_map: &mut TypeCollection) -> Vec<Function>
fn collect_fn_types(type_map: &mut TypeCollection) -> Vec<Function>
Returns all of the functions for exporting, all referenced types will be added to type_map.
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.