response.rs
1 #[derive( 2 Clone, Debug, serde::Deserialize, serde::Serialize, derive_more::TryInto, derive_more::From, 3 )] 4 #[try_into(owned, ref)] 5 #[cfg_attr(test, derive(PartialEq))] 6 #[non_exhaustive] 7 pub enum Response { 8 GetHeadResponse(crate::protocol::message::get::node::GetHeadResponse), 9 NodeGetResponse(crate::protocol::message::get::node::NodeGetResponse), 10 ContentGetResponse(crate::protocol::message::get::content::ContentGetResponse), 11 PayloadGetResponse(crate::protocol::message::get::payload::PayloadGetResponse), 12 } 13 14 impl Response { 15 #[rustfmt::skip] 16 pub const fn name(&self) -> &'static str { 17 use crate::protocol::message::Message; 18 match self { 19 Response::GetHeadResponse(_) => crate::protocol::message::get::node::GetHeadResponse::MESSAGE_NAME, 20 Response::NodeGetResponse(_) => crate::protocol::message::get::node::NodeGetResponse::MESSAGE_NAME, 21 Response::ContentGetResponse(_) => crate::protocol::message::get::content::ContentGetResponse::MESSAGE_NAME, 22 Response::PayloadGetResponse(_) => crate::protocol::message::get::payload::PayloadGetResponse::MESSAGE_NAME, 23 } 24 } 25 }