fix: type size bit length
This commit is contained in:
parent
7773a2585e
commit
4c826923a5
2 changed files with 4 additions and 4 deletions
|
|
@ -36,9 +36,9 @@ pub enum TypeConversionError {
|
||||||
NumberDecodeFailed(#[from] ParseFloatError),
|
NumberDecodeFailed(#[from] ParseFloatError),
|
||||||
#[error("failed to parse int from text")]
|
#[error("failed to parse int from text")]
|
||||||
IntDecodeFailed(#[from] ParseIntError),
|
IntDecodeFailed(#[from] ParseIntError),
|
||||||
#[error("uknown type with oid {oid} and size {size}")]
|
#[error("unknown type with oid {oid} and size {size}")]
|
||||||
UnknownType {
|
UnknownType {
|
||||||
oid: i32,
|
oid: i32,
|
||||||
size: i32
|
size: i16
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ impl Value {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn type_size(&self) -> i32 {
|
pub fn type_size(&self) -> i16 {
|
||||||
match self {
|
match self {
|
||||||
Self::Number(_) => 8,
|
Self::Number(_) => 8,
|
||||||
Self::Indexable(val) => match val {
|
Self::Indexable(val) => match val {
|
||||||
|
|
@ -75,7 +75,7 @@ impl Value {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn from_text_bytes(bytes: &[u8], type_oid: i32, type_size: i32) -> Result<Value, TypeConversionError> {
|
pub fn from_text_bytes(bytes: &[u8], type_oid: i32, type_size: i16) -> Result<Value, TypeConversionError> {
|
||||||
match (type_oid, type_size) {
|
match (type_oid, type_size) {
|
||||||
(701, 8) => {
|
(701, 8) => {
|
||||||
let s = std::str::from_utf8(bytes)?;
|
let s = std::str::from_utf8(bytes)?;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue