jsonrpsee_core/
proc_macros_support.rs

1use jsonrpsee_types::ErrorObjectOwned;
2
3// We're marking functions on the error paths as #[cold] to both reduce chance of inlining and to
4// make the generated assembly slightly better.
5
6#[cold]
7pub fn log_fail_parse(arg_pat: &str, ty: &str, err: &ErrorObjectOwned, optional: bool) {
8	let optional = if optional { "optional " } else { "" };
9	tracing::debug!("Error parsing {optional}\"{arg_pat}\" as \"{ty}\": {err}");
10}
11
12#[cold]
13pub fn log_fail_parse_as_object(err: &ErrorObjectOwned) {
14	tracing::debug!("Failed to parse JSON-RPC params as object: {err}");
15}
16
17#[cold]
18pub fn panic_fail_serialize(param: &str, err: serde_json::Error) -> ! {
19	panic!("Parameter `{param}` cannot be serialized: {err}");
20}
21
22#[cfg(debug_assertions)]
23#[cold]
24pub fn panic_fail_register() -> ! {
25	panic!("RPC macro method names should never conflict. This is a bug, please report it.");
26}