Skip to content

Commit

Permalink
Update usage.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kroggen committed Aug 29, 2018
1 parent 16b011d commit 7b62ace
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,17 +183,15 @@ binn_object_foreach(obj, key, value) {
---
### Containers inside containers
## Nested Structures
We can put containers inside others (a list inside of an object, a list of objects, a list of maps...)
#### Example 1
A list inside of an object
### Example 1: A list inside of an object
> {id: 123, name: "John", values: [2.5, 7.35, 9.15]}
##### Writing
#### Writing
```c
binn *obj, *list;
Expand All @@ -220,7 +218,7 @@ send(sock, binn_ptr(obj), binn_size(obj));
binn_free(obj);
```

##### Reading
#### Reading

```c
int id, i, count;
Expand All @@ -238,13 +236,11 @@ for(i=1; i<=count; i++) {
}
```

#### Example 2

A list of objects
### Example 2: A list of objects

> [ {name: "John", email: "john@gmail.com"} , {name: "Eric", email: "eric@gmail.com"} ]
##### Writing
#### Writing

```c
binn *list, *obj;
Expand Down Expand Up @@ -275,7 +271,7 @@ send(sock, binn_ptr(list), binn_size(list));
binn_free(list);
```
##### Reading
#### Reading
```c
int i, count;
Expand Down

0 comments on commit 7b62ace

Please sign in to comment.