Skip to content

refactor: call the trait method instead of the instance method#195

Merged
greyblake merged 1 commit into
greyblake:masterfrom
niusia-ua:refactor/trait-method
Dec 18, 2024
Merged

refactor: call the trait method instead of the instance method#195
greyblake merged 1 commit into
greyblake:masterfrom
niusia-ua:refactor/trait-method

Conversation

@niusia-ua
Copy link
Copy Markdown
Contributor

Hi!

First of all, thank you for this cool crate.

Recently I have worked on implementing support for the borsh crate to make it possible to derive its traits using nutype.
While working on it, I encountered the error that it is impossible to derive both serde and borsh traits.
This was because I used instance methods, and there was a conflict of serialize method implementations.
I solved this using the original trait method, and now everything works fine.

This little change is supposed to avoid such problems in future features.
Also, this will improve code consistency because such an approach is already used in the Deserialize trait implementation.

::serde::de::Deserializer::deserialize_newtype_struct(
    deserializer,
    #type_name_str,
    __Visitor {
        marker: Default::default(),
        lifetime: Default::default(),
    }
)

@greyblake
Copy link
Copy Markdown
Owner

greyblake commented Dec 18, 2024

@niusia-ua Sorry I've missed your PR, thank you for it!
Also it's cool to know, that you're using it (I guess) for NEAR development :)

P.S. I am also from Kharkiv :)

@greyblake greyblake merged commit d421d73 into greyblake:master Dec 18, 2024
@greyblake
Copy link
Copy Markdown
Owner

@niusia-ua The change is available in 0.5.1

@niusia-ua
Copy link
Copy Markdown
Contributor Author

@greyblake Awesome! Thanks!

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