File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -181,7 +181,8 @@ Fine provides implementations for the following types:
181
181
> circumvented.
182
182
>
183
183
> 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.
185
186
>
186
187
> ``` c++
187
188
> fine::Term read_data (ErlNifEnv * env) {
@@ -196,9 +197,12 @@ Fine provides implementations for the following types:
196
197
> }
197
198
> ```
198
199
>
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`
202
206
> after the NIF finishes.
203
207
204
208
You can extend encoding/decoding to work on custom types by defining
You can’t perform that action at this time.
0 commit comments