-
Notifications
You must be signed in to change notification settings - Fork 252
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
ABI generation fails with Self
return types
#972
Comments
Is there a common use for |
Not a common one, but I think it is a valid one. I've seen devs try this, and it only doesn't really work when there are storage collections in the state. But if everything is in-memory and you just want to return all of the state, there could be a reason to do so.
To confirm, this fails also, right? #[near_bindgen]
// derive default, serde, ....
struct MyType {
data: u8,
}
#[near_bindgen]
impl MyType {
pub fn get_state(self) -> Self { self }
// or
pub fn get_state(&self) -> &Self { self }
} |
My intuition would agree with this. If they really wanted to serialize the state as a return value, they could use the type name explicitly or a number of other ways to work around. Might be best to nudge devs away from this, as I've noticed a few times devs have accidentally forgotten to mark the fn as |
The text was updated successfully, but these errors were encountered: