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

feat(gservice): consider impl #[panicking] macro for fns in service #262

Open
breathx opened this issue May 20, 2024 · 3 comments
Open

feat(gservice): consider impl #[panicking] macro for fns in service #262

breathx opened this issue May 20, 2024 · 3 comments

Comments

@breathx
Copy link
Member

breathx commented May 20, 2024

The macro will require Result in return type, but it only will be for ability to use ?. On expand it will unwrap() the result and return only Ok(T)

@DennisInSky
Copy link
Member

@breathx can you please elaborate on this? Any examples of usage?

@DennisInSky
Copy link
Member

DennisInSky commented Jul 31, 2024

@breathx better description is on you

fn mint(&nut self, value: u64) -> bool {
ler r: Result<bool, String> = some_func();
r.unwrap(); // intentionally
}

#[panicking]
fn mint(&nut self, value: u64) -> Result<bool, String> {
ler r: Result<bool, String> = some_func()?;
}

@vobradovich
Copy link
Member

Wouldn't it be better to use the existing route attribute with the unwrap_result prameter?

#[route(unwrap_result)]
fn mint(&nut self, value: u64) -> Result<bool, String> {
    ler r: Result<bool, String> = some_func()?;
}

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

3 participants