bee_block/payload/milestone/
milestone_id.rs1impl_id!(
5 pub MilestoneId,
6 32,
7 "A milestone identifier, the BLAKE2b-256 hash of the milestone bytes. See <https://www.blake2.net/> for more information."
8);
9
10#[cfg(feature = "serde")]
11string_serde_impl!(MilestoneId);
12
13#[cfg(feature = "inx")]
14mod inx {
15 use super::*;
16
17 impl From<MilestoneId> for ::inx::proto::MilestoneId {
18 fn from(value: MilestoneId) -> Self {
19 Self { id: value.0.to_vec() }
20 }
21 }
22
23 impl TryFrom<::inx::proto::MilestoneId> for MilestoneId {
24 type Error = crate::error::inx::InxError;
25
26 fn try_from(value: ::inx::proto::MilestoneId) -> Result<Self, Self::Error> {
27 let bytes: [u8; MilestoneId::LENGTH] = value
28 .id
29 .try_into()
30 .map_err(|e| Self::Error::InvalidId("MilestoneId", e))?;
31 Ok(MilestoneId::from(bytes))
32 }
33 }
34}