1
This commit is contained in:
parent
10fa5e3e2e
commit
16f184bc15
@ -22,7 +22,6 @@ impl r9::ProtoMsg for MessagesUnion {
|
||||
obj: &serde_json::Map<String, serde_json::Value>,
|
||||
id_key: &mut i64,
|
||||
name_key: &mut String) {
|
||||
println!("abcd1");
|
||||
if let MessagesUnion::MtwAliKeyConf(meta) = self {
|
||||
let pb = &mut meta.p.borrow_mut();
|
||||
let desc = pb.descriptor();
|
||||
@ -36,7 +35,6 @@ impl r9::ProtoMsg for MessagesUnion {
|
||||
Some(v) => {
|
||||
match field_desc.get_field_type() {
|
||||
FieldDescriptorProto_Type::TYPE_STRING => {
|
||||
println!("abcd3");
|
||||
os.write_string(field_desc.get_number() as u32, "hello");
|
||||
},
|
||||
_ => {
|
||||
@ -50,7 +48,6 @@ impl r9::ProtoMsg for MessagesUnion {
|
||||
}
|
||||
}
|
||||
}
|
||||
println!("{}", v.len());
|
||||
let mut slice: &[u8] = v.as_slice();
|
||||
let is = &mut ::protobuf::CodedInputStream::new(&mut slice);
|
||||
pb.merge_from(is);
|
||||
@ -102,27 +99,4 @@ fn main() {
|
||||
|
||||
}
|
||||
}
|
||||
let mut msg = mt::AliKeyConf::new();
|
||||
msg.set_value(100);
|
||||
msg.set_access_keyid("abcdefg".to_string());
|
||||
let desc = msg.descriptor();
|
||||
for field in desc.fields() {
|
||||
let field_desc = field.proto();
|
||||
if field_desc.get_field_type() == FieldDescriptorProto_Type::TYPE_STRING {
|
||||
print!("field_name:{} value:{}\n", field.name(), field.get_str(&msg));
|
||||
}
|
||||
}
|
||||
|
||||
let result = File::open("/root/pub/2005/1/conf_test/game2005/gameserver.dev/node1/game2005.gameserver.cluster.json1");
|
||||
match result {
|
||||
Ok(f) => {
|
||||
let v: serde_json::Value = serde_json::from_reader(f).unwrap();
|
||||
println!("{:?}", v[0]["ip"].as_str().unwrap());
|
||||
println!("{:?}", v[0]["instance_id"].as_i64().unwrap());
|
||||
}
|
||||
Err(e) => {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
2
third_party/r9
vendored
2
third_party/r9
vendored
@ -1 +1 @@
|
||||
Subproject commit c8ca016ae7387baf4291feb2769c5475e1a2ae4c
|
||||
Subproject commit bd11c1108eb78ada3b27c56b762cc31e3c3ad029
|
Loading…
x
Reference in New Issue
Block a user