mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
Pgsql cube type compile fail (#3459)
* fails to compile as size_of is not found in scope * keep scoping consistent with other type modules * fmt fixes --------- Co-authored-by: kdesjard <kristian.desjardins@nrcan-rncan.gc.ca>
This commit is contained in:
parent
8a17bef7d7
commit
371cf4a0cc
2 changed files with 5 additions and 4 deletions
|
@ -5,6 +5,7 @@ use crate::types::Type;
|
|||
use crate::{PgArgumentBuffer, PgHasArrayType, PgTypeInfo, PgValueFormat, PgValueRef, Postgres};
|
||||
use sqlx_core::bytes::Buf;
|
||||
use sqlx_core::Error;
|
||||
use std::mem;
|
||||
use std::str::FromStr;
|
||||
|
||||
const BYTE_WIDTH: usize = 8;
|
||||
|
@ -304,7 +305,7 @@ fn remove_parentheses(s: &str) -> String {
|
|||
}
|
||||
|
||||
impl Header {
|
||||
const PACKED_WIDTH: usize = size_of::<u32>();
|
||||
const PACKED_WIDTH: usize = mem::size_of::<u32>();
|
||||
|
||||
fn encoded_size(&self) -> usize {
|
||||
Self::PACKED_WIDTH + self.data_size()
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use std::{
|
||||
collections::{btree_map, BTreeMap},
|
||||
mem::size_of,
|
||||
mem,
|
||||
ops::{Deref, DerefMut},
|
||||
str,
|
||||
};
|
||||
|
@ -214,10 +214,10 @@ impl Encode<'_, Postgres> for PgHstore {
|
|||
}
|
||||
|
||||
fn read_length(buf: &mut &[u8]) -> Result<i32, String> {
|
||||
if buf.len() < size_of::<i32>() {
|
||||
if buf.len() < mem::size_of::<i32>() {
|
||||
return Err(format!(
|
||||
"expected {} bytes, got {}",
|
||||
size_of::<i32>(),
|
||||
mem::size_of::<i32>(),
|
||||
buf.len()
|
||||
));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue