Implement From trait for DaemonMessageApp to facilitate conversions from String, NewAppRes, and AppNodeResources
This commit is contained in:
parent
df3a4631dd
commit
fce5788493
@ -1,3 +1,4 @@
|
|||||||
|
use crate::pb::brain::{daemon_message_app, AppNodeResources, DaemonMessageApp, NewAppRes};
|
||||||
use crate::pb::brain::{AppResource, MappedPort, NewAppReq};
|
use crate::pb::brain::{AppResource, MappedPort, NewAppReq};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
@ -79,3 +80,27 @@ impl From<MappedPort> for (u16, u16) {
|
|||||||
(val.host_port as u16, val.app_port as u16)
|
(val.host_port as u16, val.app_port as u16)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<String> for DaemonMessageApp {
|
||||||
|
fn from(value: String) -> Self {
|
||||||
|
Self {
|
||||||
|
msg: Some(daemon_message_app::Msg::Pubkey(value)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<NewAppRes> for DaemonMessageApp {
|
||||||
|
fn from(value: NewAppRes) -> Self {
|
||||||
|
Self {
|
||||||
|
msg: Some(daemon_message_app::Msg::NewAppRes(value)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<AppNodeResources> for DaemonMessageApp {
|
||||||
|
fn from(value: AppNodeResources) -> Self {
|
||||||
|
Self {
|
||||||
|
msg: Some(daemon_message_app::Msg::AppNodeResources(value)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user