1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use libyaml_sys as sys;
#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(u8)]
pub enum SequenceStyle {
Block = sys::YAML_BLOCK_SEQUENCE_STYLE as _,
Flow = sys::YAML_FLOW_SEQUENCE_STYLE as _,
}
impl SequenceStyle {
pub fn from_raw(raw: sys::yaml_sequence_style_t) -> Option<Self> {
match raw {
sys::YAML_BLOCK_SEQUENCE_STYLE => Some(Self::Block),
sys::YAML_FLOW_SEQUENCE_STYLE => Some(Self::Flow),
_ => None,
}
}
pub fn into_raw(self) -> sys::yaml_sequence_style_t {
self as _
}
pub fn option_into_raw(value: Option<Self>) -> sys::yaml_sequence_style_t {
value.map_or(sys::YAML_ANY_SEQUENCE_STYLE, Self::into_raw)
}
}