Is there a way for me to use the standard Result<T, E> type inside a Substrate module?

Viewed 71

Substrate already defines its own result type as Result<(), &'static str> and doesn't let me use the generic type. How can I use the Rust standard Result<T, E> type?

1 Answers

It's possible to use the Rust standard Result type in a module's private function, but not the dispatchable function.

You need to import it first by use rstd::result, then use it like result::Result<your-value-type, your-error-type>.

Related