Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8a0eab0 commit 815175fCopy full SHA for 815175f
1 file changed
postgres/src/text_rows.rs
@@ -3,6 +3,7 @@
3
use postgres_shared::rows::RowData;
4
use std::fmt;
5
use std::slice;
6
+use std::str;
7
8
#[doc(inline)]
9
pub use postgres_shared::rows::RowIndex;
@@ -171,7 +172,7 @@ impl<'a> TextRow<'a> {
171
172
None => return None,
173
};
174
- // TODO can we assume these values will always be utf8?
175
- Some(self.data.get(idx).map(|s| ::std::str::from_utf8(s).expect("utf8 encoded")))
+ self.data.get(idx)
176
+ .map(|s| str::from_utf8(s).ok())
177
}
178
0 commit comments