remove u128 type

This commit is contained in:
Pascal Seitz
2022-10-06 13:36:44 +08:00
parent 0b86658389
commit e50e74acf8
4 changed files with 7 additions and 23 deletions

View File

@@ -400,11 +400,9 @@ impl QueryParser {
let bytes = base64::decode(phrase).map_err(QueryParserError::ExpectedBase64)?;
Ok(Term::from_field_bytes(field, &bytes))
}
FieldType::IpAddr(_) => {
return Err(QueryParserError::UnsupportedQuery(
FieldType::IpAddr(_) => Err(QueryParserError::UnsupportedQuery(
"Range query are not supported on IpAddr field.".to_string(),
));
}
)),
}
}

View File

@@ -68,11 +68,9 @@ pub enum Type {
Json = b'j',
/// IpAddr
IpAddr = b'p',
/// IpAddr
U128 = b'1',
}
const ALL_TYPES: [Type; 11] = [
const ALL_TYPES: [Type; 10] = [
Type::Str,
Type::U64,
Type::I64,
@@ -83,7 +81,6 @@ const ALL_TYPES: [Type; 11] = [
Type::Bytes,
Type::Json,
Type::IpAddr,
Type::U128,
];
impl Type {
@@ -111,7 +108,6 @@ impl Type {
Type::Bytes => "Bytes",
Type::Json => "Json",
Type::IpAddr => "IpAddr",
Type::U128 => "U128",
}
}
@@ -129,7 +125,6 @@ impl Type {
b'b' => Some(Type::Bytes),
b'j' => Some(Type::Json),
b'p' => Some(Type::IpAddr),
b'1' => Some(Type::U128),
_ => None,
}
}

View File

@@ -416,12 +416,7 @@ fn debug_value_bytes(typ: Type, bytes: &[u8], f: &mut fmt::Formatter) -> fmt::Re
}
}
Type::IpAddr => {
let s = as_str(bytes); // TODO: change when serialization changes
write_opt(f, s)?;
}
Type::U128 => {
let s = as_str(bytes); // TODO: change when serialization changes
write_opt(f, s)?;
write!(f, "")?; // TODO change once we actually have IP address terms.
}
}
Ok(())

View File

@@ -41,9 +41,7 @@ impl Eq for Value {}
impl Serialize for Value {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
where S: Serializer {
match *self {
Value::Str(ref v) => serializer.serialize_str(v),
Value::PreTokStr(ref v) => v.serialize(serializer),
@@ -62,9 +60,7 @@ impl Serialize for Value {
impl<'de> Deserialize<'de> for Value {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
{
where D: Deserializer<'de> {
struct ValueVisitor;
impl<'de> Visitor<'de> for ValueVisitor {