mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-12 23:37:13 +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 crate::{PgArgumentBuffer, PgHasArrayType, PgTypeInfo, PgValueFormat, PgValueRef, Postgres};
|
||||||
use sqlx_core::bytes::Buf;
|
use sqlx_core::bytes::Buf;
|
||||||
use sqlx_core::Error;
|
use sqlx_core::Error;
|
||||||
|
use std::mem;
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
|
|
||||||
const BYTE_WIDTH: usize = 8;
|
const BYTE_WIDTH: usize = 8;
|
||||||
|
@ -304,7 +305,7 @@ fn remove_parentheses(s: &str) -> String {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Header {
|
impl Header {
|
||||||
const PACKED_WIDTH: usize = size_of::<u32>();
|
const PACKED_WIDTH: usize = mem::size_of::<u32>();
|
||||||
|
|
||||||
fn encoded_size(&self) -> usize {
|
fn encoded_size(&self) -> usize {
|
||||||
Self::PACKED_WIDTH + self.data_size()
|
Self::PACKED_WIDTH + self.data_size()
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use std::{
|
use std::{
|
||||||
collections::{btree_map, BTreeMap},
|
collections::{btree_map, BTreeMap},
|
||||||
mem::size_of,
|
mem,
|
||||||
ops::{Deref, DerefMut},
|
ops::{Deref, DerefMut},
|
||||||
str,
|
str,
|
||||||
};
|
};
|
||||||
|
@ -214,10 +214,10 @@ impl Encode<'_, Postgres> for PgHstore {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_length(buf: &mut &[u8]) -> Result<i32, String> {
|
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!(
|
return Err(format!(
|
||||||
"expected {} bytes, got {}",
|
"expected {} bytes, got {}",
|
||||||
size_of::<i32>(),
|
mem::size_of::<i32>(),
|
||||||
buf.len()
|
buf.len()
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue