2025-09-04 08:25:22 +09:00
|
|
|
use std::time::Duration;
|
|
|
|
|
|
|
|
|
|
use iroh::endpoint::ControlMsg;
|
|
|
|
|
use prost_types::DurationError;
|
|
|
|
|
|
2025-09-05 06:22:36 +09:00
|
|
|
use crate::proto::LastControlMessage;
|
2025-09-04 08:25:22 +09:00
|
|
|
|
|
|
|
|
impl TryFrom<(Duration, ControlMsg)> for LastControlMessage {
|
|
|
|
|
type Error = DurationError;
|
|
|
|
|
fn try_from(value: (Duration, ControlMsg)) -> Result<Self, Self::Error> {
|
|
|
|
|
Ok(LastControlMessage {
|
|
|
|
|
duration: Some(value.0.try_into()?),
|
|
|
|
|
control_msg: value.1.to_string()
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|