Skip to content

Document that NifResult<T> is NIF control flow, not an Elixir result tuple #751

Description

@hannovonbergen

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions