1
This commit is contained in:
parent
463037ecb7
commit
ad26515590
@ -6,11 +6,11 @@ edition = "2021"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
protobuf = "2.25.2"
|
||||
protobuf = "2.9.0"
|
||||
serde = "*"
|
||||
serde_derive = "*"
|
||||
serde_json = "*"
|
||||
r9 = { path = "../../third_party/r9" }
|
||||
|
||||
[build-dependencies]
|
||||
protobuf-codegen-pure = "2.25.2"
|
||||
protobuf-codegen-pure = "2.9.0"
|
||||
|
@ -15,10 +15,14 @@ pub enum MessagesUnion
|
||||
MtwAliKeyConf(Rc::<metawrap::MtwAliKeyConf>)
|
||||
}
|
||||
|
||||
impl MessagesUnion {
|
||||
|
||||
pub fn from_json(&mut self) {
|
||||
impl r9::ProtoMsg for MessagesUnion {
|
||||
|
||||
fn get_proto(&self) -> &dyn Message {
|
||||
match self {
|
||||
MessagesUnion::MtwAliKeyConf(v) => {
|
||||
return &v.p;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -64,9 +68,16 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
let f = File::open("/root/pub/2005/1/conf_test/game2005/gameserver.dev/node1/game2005.gameserver.cluster.json").unwrap();
|
||||
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());
|
||||
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) => {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
pub struct MtwAliKeyConf {
|
||||
pub i: crate::mt::AliKeyConf
|
||||
pub p: crate::mt::AliKeyConf
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user