Skip to content

Commit 47af8c7

Browse files
committed
Update docs
1 parent ed9c39e commit 47af8c7

2 files changed

Lines changed: 14 additions & 8 deletions

File tree

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,10 @@ gen.use_container_alloc();
211211
/*
212212
gen.configure(".",
213213
micropb_gen::Config::new()
214-
.string_type("crate::MyString")
215-
.vec_type("crate::MyVec")
216-
.map_type("crate::MyMap")
214+
.string_type("crate::MyString<$N>")
215+
.bytes_type("crate::MyVec<u8, $N>")
216+
.vec_type("crate::MyVec<$T, $N>")
217+
.map_type("crate::MyMap<$K, $V, $N>")
217218
);
218219
*/
219220
@@ -232,7 +233,9 @@ pub struct Containers {
232233
}
233234
```
234235

235-
A container type is expected to implement `PbVec`, `PbString`, or `PbMap` from `micropb::container`, depending on what type of field it's used for. For convenience, `micropb` comes with built-in implementations of the container traits for types from [`heapless`](https://docs.rs/heapless/latest/heapless), [`arrayvec`](https://docs.rs/arrayvec/latest/arrayvec), and [`alloc`](https://doc.rust-lang.org/alloc) (see [Feature Flags](#feature-flags) for details).
236+
A container type is expected to implement `PbVec`, `PbString`, `PbBytes`, or `PbMap` from `micropb::container`, depending on what type of field it's used for. For convenience, `micropb` comes with built-in implementations of the container traits for types from [`heapless`](https://docs.rs/heapless/latest/heapless), [`arrayvec`](https://docs.rs/arrayvec/latest/arrayvec), and [`alloc`](https://doc.rust-lang.org/alloc) (see [Feature Flags](#feature-flags) for details).
237+
238+
However, if only encoding logic is required, then the container traits are unnecessary. In that case, the only requirement for container types is that they dereference into `&[T]`, `&str`, and `&[u8]`, depending on what type of field it's for.
236239

237240
### Optional Fields
238241

micropb/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,10 @@ gen.use_container_alloc();
211211
/*
212212
gen.configure(".",
213213
micropb_gen::Config::new()
214-
.string_type("crate::MyString")
215-
.vec_type("crate::MyVec")
216-
.map_type("crate::MyMap")
214+
.string_type("crate::MyString<$N>")
215+
.bytes_type("crate::MyVec<u8, $N>")
216+
.vec_type("crate::MyVec<$T, $N>")
217+
.map_type("crate::MyMap<$K, $V, $N>")
217218
);
218219
*/
219220
@@ -232,7 +233,9 @@ pub struct Containers {
232233
}
233234
```
234235

235-
A container type is expected to implement `PbVec`, `PbString`, or `PbMap` from `micropb::container`, depending on what type of field it's used for. For convenience, `micropb` comes with built-in implementations of the container traits for types from [`heapless`](https://docs.rs/heapless/latest/heapless), [`arrayvec`](https://docs.rs/arrayvec/latest/arrayvec), and [`alloc`](https://doc.rust-lang.org/alloc) (see [Feature Flags](#feature-flags) for details).
236+
A container type is expected to implement `PbVec`, `PbString`, `PbBytes`, or `PbMap` from `micropb::container`, depending on what type of field it's used for. For convenience, `micropb` comes with built-in implementations of the container traits for types from [`heapless`](https://docs.rs/heapless/latest/heapless), [`arrayvec`](https://docs.rs/arrayvec/latest/arrayvec), and [`alloc`](https://doc.rust-lang.org/alloc) (see [Feature Flags](#feature-flags) for details).
237+
238+
However, if only encoding logic is required, then the container traits are unnecessary. In that case, the only requirement for container types is that they dereference into `&[T]`, `&str`, and `&[u8]`, depending on what type of field it's for.
236239

237240
### Optional Fields
238241

0 commit comments

Comments
 (0)