Skip to content

Commit d7309f8

Browse files
committed
Update docs
1 parent efb899d commit d7309f8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ Fine provides implementations for the following types:
181181
> circumvented.
182182
>
183183
> Similarly, when returning large binaries, prefer creating the term
184-
> with `enif_make_new_binary` and returning `fine::Term`, as shown below.
184+
> with `enif_make_new_binary` and returning `fine::Term`, instead of
185+
> allocating an intermediary `std::string`, as shown below.
185186
>
186187
> ```c++
187188
> fine::Term read_data(ErlNifEnv *env) {
@@ -196,9 +197,12 @@ Fine provides implementations for the following types:
196197
> }
197198
> ```
198199
>
199-
> You can also return `ErlNifBinary` allocated with `enif_alloc_binary`,
200-
> but keep in mind that returning the binary converts it to term, which
201-
> in turn transfers the ownership, so you should not use that `ErlNifBinary`
200+
> You can also return `std::string_view`, as long as the data it points
201+
> to outlives the return.
202+
>
203+
> In case you return `ErlNifBinary` allocated with `enif_alloc_binary`,
204+
> keep in mind that returning the binary converts it to term, which in
205+
> turn transfers the ownership, so you should not use that `ErlNifBinary`
202206
> after the NIF finishes.
203207
204208
You can extend encoding/decoding to work on custom types by defining

0 commit comments

Comments
 (0)