@@ -57,15 +57,15 @@ FINE_INIT("Elixir.MyLib.NIF");
5757### Encoding/Decoding
5858
5959Terms are automatically encoded and decoded at the NIF boundary based
60- on the function signature. You may also want to invoke encode/decode
61- directly:
60+ on the function signature. In some cases, you may also want to invoke
61+ encode/decode directly:
6262
6363```cpp
64+ // Encode
6465auto message = std::string("hello world");
6566auto term = fine::encode(env, message);
66- ```
6767
68- ``` cpp
68+ // Decode
6969auto message = fine::decode<std::string>(env, term);
7070```
7171
@@ -220,8 +220,8 @@ Structs can be particularly convenient when using NIF resource objects.
220220When working with resources, it is common to have an Elixir struct
221221corresponding to the resource. In the previous ` Generator ` example,
222222you may define an Elixir struct such as ` %MyLib.Generator{resource: reference} ` .
223- Instead of passing and returning the reference to the NIF, you can
224- pass the struct itself:
223+ Instead of passing and returning the reference from the NIF, you can
224+ pass and return the struct itself:
225225
226226``` cpp
227227#include < fine.hpp>
@@ -329,7 +329,7 @@ fine::raise(env, ExMyError{42})
329329### Atoms
330330
331331It is preferable to define atoms as static variables, this way the
332- corresponding terms are create once, at NIF load time.
332+ corresponding terms are created once, at NIF load time.
333333
334334``` cpp
335335namespace atoms {
0 commit comments