-
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
types: make subscription ID String Cow. #594
Conversation
impl<'a> SubscriptionId<'a> { | ||
/// Convert `SubscriptionId<'a>` to `SubscriptionId<'static>` so that it can be moved across threads. | ||
/// | ||
/// This can cause an allocation if the id is a string. |
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.
technically only if s
is a str slice.
} | ||
|
||
impl<'a> TryFrom<JsonValue> for SubscriptionId<'a> { | ||
type Error = (); |
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.
Would there be any use in making this more specific so that we can catch the "wrong value type" vs "value too large" errors below?
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.
yupp,
Offhand it looks like we just use |
A bit of motivation for this change would be good, the code looks fine but I'm not sure why we need this. |
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.
LGTM, not sure it's entirely necessary given we should be using numbers anyway :)
Yeah, it's compat stuff for other libraries (e.g. jsonrpc crate) but not sure if we need anymore so maybe better just to use |
Yeah you are correct, I didn't manage to get rid of however, this is not useful without further refactoring I guess besides to |
No description provided.