mirror of
https://github.com/isar/rusqlite.git
synced 2024-11-26 11:31:37 +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
|
||||
`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
|
||||
returns an iterator over rows after they have been mapped to a static type, e.g., types without
|
||||
references to other values.
|
||||
Strongly consider using the method `query_map()` instead, if you can.
|
||||
`query_map()` returns an iterator over rows-mapped-to-some-`'static`-type. This
|
||||
iterator does not have any of the above issues with panics due to attempting to
|
||||
access stale rows.
|
||||
|
||||
## Author
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user