libyaml/
version_directive.rs1use std::mem;
2
3use crate::sys;
4
5#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
7pub struct VersionDirective(pub u8, pub u8);
8
9impl VersionDirective {
10 pub fn from_raw(raw: sys::yaml_version_directive_t) -> Self {
12 Self(raw.major as _, raw.minor as _)
13 }
14
15 pub fn into_raw(self) -> sys::yaml_version_directive_t {
17 let mut ret: sys::yaml_version_directive_t = unsafe { mem::MaybeUninit::zeroed().assume_init() };
18 ret.major = self.0 as _;
19 ret.minor = self.1 as _;
20 ret
21 }
22}