Skip to content

Commit 1ee7afa

Browse files
kdesjardKris-Desjardins
authored andcommitted
Pgsql cube type compile fail (launchbadge#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 <[email protected]>
1 parent 7ca3565 commit 1ee7afa

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

sqlx-postgres/src/types/cube.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::types::Type;
55
use crate::{PgArgumentBuffer, PgHasArrayType, PgTypeInfo, PgValueFormat, PgValueRef, Postgres};
66
use sqlx_core::bytes::Buf;
77
use sqlx_core::Error;
8+
use std::mem;
89
use std::str::FromStr;
910

1011
const BYTE_WIDTH: usize = 8;
@@ -304,7 +305,7 @@ fn remove_parentheses(s: &str) -> String {
304305
}
305306

306307
impl Header {
307-
const PACKED_WIDTH: usize = size_of::<u32>();
308+
const PACKED_WIDTH: usize = mem::size_of::<u32>();
308309

309310
fn encoded_size(&self) -> usize {
310311
Self::PACKED_WIDTH + self.data_size()

sqlx-postgres/src/types/hstore.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{
22
collections::{btree_map, BTreeMap},
3-
mem::size_of,
3+
mem,
44
ops::{Deref, DerefMut},
55
str,
66
};
@@ -214,10 +214,10 @@ impl Encode<'_, Postgres> for PgHstore {
214214
}
215215

216216
fn read_length(buf: &mut &[u8]) -> Result<i32, String> {
217-
if buf.len() < size_of::<i32>() {
217+
if buf.len() < mem::size_of::<i32>() {
218218
return Err(format!(
219219
"expected {} bytes, got {}",
220-
size_of::<i32>(),
220+
mem::size_of::<i32>(),
221221
buf.len()
222222
));
223223
}

0 commit comments

Comments
 (0)