1
This commit is contained in:
parent
3c90a3c032
commit
3e8a27dd0e
@ -17,14 +17,40 @@ pub enum MessagesUnion
|
||||
|
||||
impl r9::ProtoMsg for MessagesUnion {
|
||||
|
||||
fn get_proto(&self) -> &dyn Message {
|
||||
match self {
|
||||
MessagesUnion::MtwAliKeyConf(v) => {
|
||||
return &v.p;
|
||||
fn deserialize(&self,
|
||||
obj: &serde_json::Map<String, serde_json::Value>,
|
||||
id_key: &mut i64,
|
||||
name_key: &mut String) {
|
||||
if let MessagesUnion::MtwAliKeyConf(meta) = self {
|
||||
let pb = &mut meta.p.borrow_mut();
|
||||
let desc = pb.descriptor();
|
||||
let mut v = Vec::<u8>::new();
|
||||
{
|
||||
let mut os = ::protobuf::CodedOutputStream::bytes(&mut v);
|
||||
for field in desc.fields() {
|
||||
let field_desc = field.proto();
|
||||
match obj.get(field.name()) {
|
||||
Some(v) => {
|
||||
match field_desc.get_field_type() {
|
||||
FieldDescriptorProto_Type::TYPE_STRING => {
|
||||
os.write_string(field_desc.get_number() as u32, "hello");
|
||||
},
|
||||
_ => {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
None => {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut slice: &[u8] = v.as_slice();
|
||||
let is = &mut ::protobuf::CodedInputStream::new(&mut slice);
|
||||
pb.merge_from(is);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type XValue = r9::XValue::<test::App>;
|
||||
|
@ -1,3 +1,5 @@
|
||||
use std::cell::RefCell;
|
||||
|
||||
pub struct MtwAliKeyConf {
|
||||
pub p: crate::mt::AliKeyConf
|
||||
pub p: RefCell<crate::mt::AliKeyConf>
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user