Please add documentation to NifResult<T> explaining that when it is used as the return type of a NIF, it is handled via NifReturnable rather than encoded as a normal Result<T, E> value. In particular, the documentation should state that Ok(T) returns T directly, and that a custom Result<T, E> where E: Encoder should be used when the intended Elixir API is {:ok, ...} | {:error, ...}` result tuples.
I just stumbled over this behavior, and I think documenting it would also help prevent confusion like in #659.
Please add documentation to
NifResult<T>explaining that when it is used as the return type of a NIF, it is handled viaNifReturnablerather than encoded as a normalResult<T, E>value. In particular, the documentation should state thatOk(T)returnsTdirectly, and that a customResult<T, E>whereE: Encodershould be used when the intended Elixir API is{:ok, ...} |{:error, ...}` result tuples.I just stumbled over this behavior, and I think documenting it would also help prevent confusion like in #659.