mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-22 18:14:11 +00:00
Assume Postgres isn't lying (use UTF-8 unchecked)
This commit is contained in:
@@ -12,7 +12,7 @@ pub trait Decode {
|
||||
pub(crate) fn get_str(src: &[u8]) -> io::Result<&str> {
|
||||
let end = memchr(b'\0', &src).ok_or(io::ErrorKind::UnexpectedEof)?;
|
||||
let buf = &src[..end];
|
||||
let s = str::from_utf8(buf).map_err(|_| io::ErrorKind::InvalidData)?;
|
||||
let s = unsafe { str::from_utf8_unchecked(buf) };
|
||||
|
||||
Ok(s)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user