Skip to content
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

Implement TryFrom on RpcValue #2

Merged
merged 3 commits into from
Jul 3, 2024

Conversation

j4r0u53k
Copy link
Contributor

@j4r0u53k j4r0u53k commented Jul 3, 2024

Implements TryFrom<&RpcValue> and TryFrom<RpcValue> for various
basic types and their references.

TryFrom<&RpcValue> would be useful e.g. for RPC requests params
parsing, where RpcMessge::param() returns Option<&RpcValue>.

TryFrom<RpcValue> can provide more efficient implementation for
larger datatypes (Blob, List, Map, String), where the returned
value is just moved out of the underlying Box without cloning.

Crates using this library can further add any implementations of
TryFrom<RpcValue> or TryFrom<&RpcValue> for their own types
and get a uniform way to perform all types conversions from RpcValue.

j4r0u53k added 2 commits July 3, 2024 02:55
The underlying type is just i64.
Implements TryFrom<&RpcValue> and TryFrom<RpcValue> for various
basic types and their references.

TryFrom<&RpcValue> would be useful e.g. for RPC requests params
parsing, where `RpcMessge::param()` returns `Option<&RpcValue>`.

TryFrom<RpcValue> can provide more efficient implementation for
larger datatypes (Blob, List, Map, String), where the returned
value is just moved out of the underlying Box without cloning.
@j4r0u53k j4r0u53k force-pushed the try-from-rpcvalue branch from 8195050 to 819e71b Compare July 3, 2024 01:37
New features:
 - Implement Copy trait for Decimal
 - Implement `TryFrom<RpcValue>` and `TryFrom<&RpcValue>` for
   basic types and their references.
@fvacek fvacek merged commit f7c2cf3 into silicon-heaven:master Jul 3, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants