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

impl<T> CustomMsg for Option<T> where T: CustomMsg {} #2056

Open
taitruong opened this issue Mar 15, 2024 · 3 comments
Open

impl<T> CustomMsg for Option<T> where T: CustomMsg {} #2056

taitruong opened this issue Mar 15, 2024 · 3 comments

Comments

@taitruong
Copy link

Is it possible to add impl<T> CustomMsg for Option<T> where T: CustomMsg {} it here:

pub trait CustomMsg: Serialize + Clone + fmt::Debug + PartialEq + JsonSchema {}
impl CustomMsg for Empty {}

Because I cannot do this in my contract ofc.

@webmaster128
Copy link
Member

Could you explain more about the use case? How should that be implemented?

@taitruong
Copy link
Author

taitruong commented Mar 21, 2024

In your code you have this:

defined in cosmos_msg.rs:

impl CustomMsg for Empty {}

But this is missing: impl CustomMsg for Option<Empty> {}

Ofc I cannot add it in my contract and get this error:

image

Since this is missing - it is not possible having CustomMsg for Option<Empty> - it is even not possible having any custom struct for Option<T>.

@taitruong
Copy link
Author

@webmaster128 see workaround here: CosmWasm/cw-nfts#156 (comment)

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

No branches or pull requests

2 participants