1use core::fmt::{self, Display};
6use serde::{Deserialize, Serialize};
7use zerocopy_derive::{FromBytes, Immutable, IntoBytes};
8
9#[derive(Immutable, IntoBytes, FromBytes, Serialize, Deserialize, Clone, Copy, Debug)]
10#[repr(C)]
11pub struct Version {
12 pub major: u16,
13 pub minor: u16,
14 pub patch: u16,
15 pub build: u16,
16}
17
18impl Display for Version {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 let Version {
21 major,
22 minor,
23 patch,
24 build,
25 } = self;
26 write!(f, "{major}.{minor}.{patch}.{build}")
27 }
28}