use serde::{Deserialize, Serialize};
pub enum ColumnType {
Integer(i64),
String(String),
Float(f64),
Bool(bool),
}
impl Serialize for ColumnType {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: serde::Serializer,
{
match self {
ColumnType::Integer(val) => val.serialize(serializer),
ColumnType::String(val) => val.serialize(serializer),
ColumnType::Float(val) => val.serialize(serializer),
ColumnType::Bool(val) => val.serialize(serializer),
}
}
}
#[derive(Serialize, Deserialize)]
struct Filter<'a> {
attribute_name: &'a str,
operator: &'a str,
value: ColumnType,
value_type: &'a str,
}
fn main() {
}
Deserialize要怎么写,怎么避免引起'de生命周期
1
共 2 条评论, 1 页
评论区
写评论谢谢
--
👇
liusen-adalab: