mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-23 00:39:20 +08:00
Update README's recommendation of query_map
This commit is contained in:
parent
51f6c15c6c
commit
f65eadbc83
@ -90,9 +90,10 @@ fn bad_function_will_panic(conn: &SqliteConnection) -> SqliteResult<i64> {
|
|||||||
There are other, less obvious things that may result in a panic as well, such as calling
|
There are other, less obvious things that may result in a panic as well, such as calling
|
||||||
`collect()` on a `SqliteRows` and then trying to use the collected rows.
|
`collect()` on a `SqliteRows` and then trying to use the collected rows.
|
||||||
|
|
||||||
The method `query_map()` is an alternative to `query()` and is guaranteed not to panic. This method
|
Strongly consider using the method `query_map()` instead, if you can.
|
||||||
returns an iterator over rows after they have been mapped to a static type, e.g., types without
|
`query_map()` returns an iterator over rows-mapped-to-some-`'static`-type. This
|
||||||
references to other values.
|
iterator does not have any of the above issues with panics due to attempting to
|
||||||
|
access stale rows.
|
||||||
|
|
||||||
## Author
|
## Author
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user