-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a method to RpcModule that transforms the module into a RpcModule<()>
, i.e. removes the context.
#660
Conversation
…ule into a `RpcModule<()>`, i.e. removes the context.
tests/tests/rpc_module.rs
Outdated
fn assert_type<T: 'static, Expected: 'static>(_expected: &Expected, explain: Option<&'static str>) { | ||
use core::any::TypeId; | ||
match explain { | ||
None => assert_eq!(TypeId::of::<T>(), TypeId::of::<Expected>()), | ||
Some(explain) => assert_eq!(TypeId::of::<T>(), TypeId::of::<Expected>(), "{}", explain), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it's better to move this check to compile-time? ie:
fn assert_type<Expected>(_expected: &Expected) {}
Usage (compile error if types don't match):
assert_type::<SomeType>(&some_value);
This becomes quite small and could be inlined into the macro if preferred!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cheers!
decontextualize
, that transforms the module into a RpcModule<()>
, i.e. removes the context.RpcModule<()>
, i.e. removes the context.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one simple grumble :)
Co-authored-by: Maciej Hirsz <[email protected]>
Closes #558