Skip to main content

unsafe_libyaml/
yaml.rs

1pub use core::primitive::{i64 as ptrdiff_t, u8 as yaml_char_t, u64 as size_t};
2use core::{
3    ops::Deref,
4    ptr::{self, addr_of},
5};
6
7pub use self::{yaml_encoding_t::*, yaml_event_type_t::*, yaml_node_type_t::*};
8use crate::libc;
9
10/// The version directive data.
11#[derive(Copy, Clone)]
12#[repr(C)]
13#[non_exhaustive]
14pub struct yaml_version_directive_t {
15    /// The major version number.
16    pub major: libc::c_int,
17    /// The minor version number.
18    pub minor: libc::c_int,
19}
20
21/// The tag directive data.
22#[derive(Copy, Clone)]
23#[repr(C)]
24#[non_exhaustive]
25pub struct yaml_tag_directive_t {
26    /// The tag handle.
27    pub handle: *mut yaml_char_t,
28    /// The tag prefix.
29    pub prefix: *mut yaml_char_t,
30}
31
32/// The stream encoding.
33#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
34#[repr(u32)]
35#[non_exhaustive]
36pub enum yaml_encoding_t {
37    /// Let the parser choose the encoding.
38    YAML_ANY_ENCODING = 0,
39    /// The default UTF-8 encoding.
40    YAML_UTF8_ENCODING = 1,
41    /// The UTF-16-LE encoding with BOM.
42    YAML_UTF16LE_ENCODING = 2,
43    /// The UTF-16-BE encoding with BOM.
44    YAML_UTF16BE_ENCODING = 3,
45}
46
47/// Line break type.
48#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
49#[repr(u32)]
50#[non_exhaustive]
51pub enum yaml_break_t {
52    /// Let the parser choose the break type.
53    YAML_ANY_BREAK = 0,
54    /// Use CR for line breaks (Mac style).
55    YAML_CR_BREAK = 1,
56    /// Use LN for line breaks (Unix style).
57    YAML_LN_BREAK = 2,
58    /// Use CR LN for line breaks (DOS style).
59    YAML_CRLN_BREAK = 3,
60}
61
62/// Many bad things could happen with the parser and emitter.
63#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
64#[repr(u32)]
65#[non_exhaustive]
66pub enum yaml_error_type_t {
67    /// No error is produced.
68    YAML_NO_ERROR = 0,
69    /// Cannot allocate or reallocate a block of memory.
70    YAML_MEMORY_ERROR = 1,
71    /// Cannot read or decode the input stream.
72    YAML_READER_ERROR = 2,
73    /// Cannot scan the input stream.
74    YAML_SCANNER_ERROR = 3,
75    /// Cannot parse the input stream.
76    YAML_PARSER_ERROR = 4,
77    /// Cannot compose a YAML document.
78    YAML_COMPOSER_ERROR = 5,
79    /// Cannot write to the output stream.
80    YAML_WRITER_ERROR = 6,
81    /// Cannot emit a YAML stream.
82    YAML_EMITTER_ERROR = 7,
83}
84
85/// The pointer position.
86#[derive(Copy, Clone)]
87#[repr(C)]
88#[non_exhaustive]
89pub struct yaml_mark_t {
90    /// The position index.
91    pub index: size_t,
92    /// The position line.
93    pub line: size_t,
94    /// The position column.
95    pub column: size_t,
96}
97
98/// Scalar styles.
99#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
100#[repr(u32)]
101#[non_exhaustive]
102pub enum yaml_scalar_style_t {
103    /// Let the emitter choose the style.
104    YAML_ANY_SCALAR_STYLE = 0,
105    /// The plain scalar style.
106    YAML_PLAIN_SCALAR_STYLE = 1,
107    /// The single-quoted scalar style.
108    YAML_SINGLE_QUOTED_SCALAR_STYLE = 2,
109    /// The double-quoted scalar style.
110    YAML_DOUBLE_QUOTED_SCALAR_STYLE = 3,
111    /// The literal scalar style.
112    YAML_LITERAL_SCALAR_STYLE = 4,
113    /// The folded scalar style.
114    YAML_FOLDED_SCALAR_STYLE = 5,
115}
116
117/// Sequence styles.
118#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
119#[repr(u32)]
120#[non_exhaustive]
121pub enum yaml_sequence_style_t {
122    /// Let the emitter choose the style.
123    YAML_ANY_SEQUENCE_STYLE = 0,
124    /// The block sequence style.
125    YAML_BLOCK_SEQUENCE_STYLE = 1,
126    /// The flow sequence style.
127    YAML_FLOW_SEQUENCE_STYLE = 2,
128}
129
130/// Mapping styles.
131#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
132#[repr(u32)]
133#[non_exhaustive]
134pub enum yaml_mapping_style_t {
135    /// Let the emitter choose the style.
136    YAML_ANY_MAPPING_STYLE = 0,
137    /// The block mapping style.
138    YAML_BLOCK_MAPPING_STYLE = 1,
139    /// The flow mapping style.
140    YAML_FLOW_MAPPING_STYLE = 2,
141}
142
143/// Token types.
144#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
145#[repr(u32)]
146#[non_exhaustive]
147pub enum yaml_token_type_t {
148    /// An empty token.
149    YAML_NO_TOKEN = 0,
150    /// A STREAM-START token.
151    YAML_STREAM_START_TOKEN = 1,
152    /// A STREAM-END token.
153    YAML_STREAM_END_TOKEN = 2,
154    /// A VERSION-DIRECTIVE token.
155    YAML_VERSION_DIRECTIVE_TOKEN = 3,
156    /// A TAG-DIRECTIVE token.
157    YAML_TAG_DIRECTIVE_TOKEN = 4,
158    /// A DOCUMENT-START token.
159    YAML_DOCUMENT_START_TOKEN = 5,
160    /// A DOCUMENT-END token.
161    YAML_DOCUMENT_END_TOKEN = 6,
162    /// A BLOCK-SEQUENCE-START token.
163    YAML_BLOCK_SEQUENCE_START_TOKEN = 7,
164    /// A BLOCK-MAPPING-START token.
165    YAML_BLOCK_MAPPING_START_TOKEN = 8,
166    /// A BLOCK-END token.
167    YAML_BLOCK_END_TOKEN = 9,
168    /// A FLOW-SEQUENCE-START token.
169    YAML_FLOW_SEQUENCE_START_TOKEN = 10,
170    /// A FLOW-SEQUENCE-END token.
171    YAML_FLOW_SEQUENCE_END_TOKEN = 11,
172    /// A FLOW-MAPPING-START token.
173    YAML_FLOW_MAPPING_START_TOKEN = 12,
174    /// A FLOW-MAPPING-END token.
175    YAML_FLOW_MAPPING_END_TOKEN = 13,
176    /// A BLOCK-ENTRY token.
177    YAML_BLOCK_ENTRY_TOKEN = 14,
178    /// A FLOW-ENTRY token.
179    YAML_FLOW_ENTRY_TOKEN = 15,
180    /// A KEY token.
181    YAML_KEY_TOKEN = 16,
182    /// A VALUE token.
183    YAML_VALUE_TOKEN = 17,
184    /// An ALIAS token.
185    YAML_ALIAS_TOKEN = 18,
186    /// An ANCHOR token.
187    YAML_ANCHOR_TOKEN = 19,
188    /// A TAG token.
189    YAML_TAG_TOKEN = 20,
190    /// A SCALAR token.
191    YAML_SCALAR_TOKEN = 21,
192}
193
194/// The token structure.
195#[derive(Copy, Clone)]
196#[repr(C)]
197#[non_exhaustive]
198pub struct yaml_token_t {
199    /// The token type.
200    pub type_: yaml_token_type_t,
201    /// The token data.
202    ///
203    /// ```
204    /// # const _: &str = stringify! {
205    /// union {
206    ///     /// The stream start (for YAML_STREAM_START_TOKEN).
207    ///     stream_start: struct {
208    ///         /// The stream encoding.
209    ///         encoding: yaml_encoding_t,
210    ///     },
211    ///     /// The alias (for YAML_ALIAS_TOKEN).
212    ///     alias: struct {
213    ///         /// The alias value.
214    ///         value: *mut u8,
215    ///     },
216    ///     /// The anchor (for YAML_ANCHOR_TOKEN).
217    ///     anchor: struct {
218    ///         /// The anchor value.
219    ///         value: *mut u8,
220    ///     },
221    ///     /// The tag (for YAML_TAG_TOKEN).
222    ///     tag: struct {
223    ///         /// The tag handle.
224    ///         handle: *mut u8,
225    ///         /// The tag suffix.
226    ///         suffix: *mut u8,
227    ///     },
228    ///     /// The scalar value (for YAML_SCALAR_TOKEN).
229    ///     scalar: struct {
230    ///         /// The scalar value.
231    ///         value: *mut u8,
232    ///         /// The length of the scalar value.
233    ///         length: u64,
234    ///         /// The scalar style.
235    ///         style: yaml_scalar_style_t,
236    ///     },
237    ///     /// The version directive (for YAML_VERSION_DIRECTIVE_TOKEN).
238    ///     version_directive: struct {
239    ///         /// The major version number.
240    ///         major: i32,
241    ///         /// The minor version number.
242    ///         minor: i32,
243    ///     },
244    ///     /// The tag directive (for YAML_TAG_DIRECTIVE_TOKEN).
245    ///     tag_directive: struct {
246    ///         /// The tag handle.
247    ///         handle: *mut u8,
248    ///         /// The tag prefix.
249    ///         prefix: *mut u8,
250    ///     },
251    /// }
252    /// # };
253    /// ```
254    pub data: unnamed_yaml_token_t_data,
255    /// The beginning of the token.
256    pub start_mark: yaml_mark_t,
257    /// The end of the token.
258    pub end_mark: yaml_mark_t,
259}
260
261#[derive(Copy, Clone)]
262#[repr(C)]
263pub union unnamed_yaml_token_t_data {
264    /// The stream start (for YAML_STREAM_START_TOKEN).
265    pub stream_start: unnamed_yaml_token_t_data_stream_start,
266    /// The alias (for YAML_ALIAS_TOKEN).
267    pub alias: unnamed_yaml_token_t_data_alias,
268    /// The anchor (for YAML_ANCHOR_TOKEN).
269    pub anchor: unnamed_yaml_token_t_data_anchor,
270    /// The tag (for YAML_TAG_TOKEN).
271    pub tag: unnamed_yaml_token_t_data_tag,
272    /// The scalar value (for YAML_SCALAR_TOKEN).
273    pub scalar: unnamed_yaml_token_t_data_scalar,
274    /// The version directive (for YAML_VERSION_DIRECTIVE_TOKEN).
275    pub version_directive: unnamed_yaml_token_t_data_version_directive,
276    /// The tag directive (for YAML_TAG_DIRECTIVE_TOKEN).
277    pub tag_directive: unnamed_yaml_token_t_data_tag_directive,
278}
279
280#[derive(Copy, Clone)]
281#[repr(C)]
282#[non_exhaustive]
283pub struct unnamed_yaml_token_t_data_stream_start {
284    /// The stream encoding.
285    pub encoding: yaml_encoding_t,
286}
287
288#[derive(Copy, Clone)]
289#[repr(C)]
290#[non_exhaustive]
291pub struct unnamed_yaml_token_t_data_alias {
292    /// The alias value.
293    pub value: *mut yaml_char_t,
294}
295
296#[derive(Copy, Clone)]
297#[repr(C)]
298#[non_exhaustive]
299pub struct unnamed_yaml_token_t_data_anchor {
300    /// The anchor value.
301    pub value: *mut yaml_char_t,
302}
303
304#[derive(Copy, Clone)]
305#[repr(C)]
306#[non_exhaustive]
307pub struct unnamed_yaml_token_t_data_tag {
308    /// The tag handle.
309    pub handle: *mut yaml_char_t,
310    /// The tag suffix.
311    pub suffix: *mut yaml_char_t,
312}
313
314#[derive(Copy, Clone)]
315#[repr(C)]
316#[non_exhaustive]
317pub struct unnamed_yaml_token_t_data_scalar {
318    /// The scalar value.
319    pub value: *mut yaml_char_t,
320    /// The length of the scalar value.
321    pub length: size_t,
322    /// The scalar style.
323    pub style: yaml_scalar_style_t,
324}
325
326#[derive(Copy, Clone)]
327#[repr(C)]
328#[non_exhaustive]
329pub struct unnamed_yaml_token_t_data_version_directive {
330    /// The major version number.
331    pub major: libc::c_int,
332    /// The minor version number.
333    pub minor: libc::c_int,
334}
335
336#[derive(Copy, Clone)]
337#[repr(C)]
338#[non_exhaustive]
339pub struct unnamed_yaml_token_t_data_tag_directive {
340    /// The tag handle.
341    pub handle: *mut yaml_char_t,
342    /// The tag prefix.
343    pub prefix: *mut yaml_char_t,
344}
345
346/// Event types.
347#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
348#[repr(u32)]
349#[non_exhaustive]
350pub enum yaml_event_type_t {
351    /// An empty event.
352    YAML_NO_EVENT = 0,
353    /// A STREAM-START event.
354    YAML_STREAM_START_EVENT = 1,
355    /// A STREAM-END event.
356    YAML_STREAM_END_EVENT = 2,
357    /// A DOCUMENT-START event.
358    YAML_DOCUMENT_START_EVENT = 3,
359    /// A DOCUMENT-END event.
360    YAML_DOCUMENT_END_EVENT = 4,
361    /// An ALIAS event.
362    YAML_ALIAS_EVENT = 5,
363    /// A SCALAR event.
364    YAML_SCALAR_EVENT = 6,
365    /// A SEQUENCE-START event.
366    YAML_SEQUENCE_START_EVENT = 7,
367    /// A SEQUENCE-END event.
368    YAML_SEQUENCE_END_EVENT = 8,
369    /// A MAPPING-START event.
370    YAML_MAPPING_START_EVENT = 9,
371    /// A MAPPING-END event.
372    YAML_MAPPING_END_EVENT = 10,
373}
374
375/// The event structure.
376#[derive(Copy, Clone)]
377#[repr(C)]
378#[non_exhaustive]
379pub struct yaml_event_t {
380    /// The event type.
381    pub type_: yaml_event_type_t,
382    /// The event data.
383    ///
384    /// ```
385    /// # const _: &str = stringify! {
386    /// union {
387    ///     /// The stream parameters (for YAML_STREAM_START_EVENT).
388    ///     stream_start: struct {
389    ///         /// The document encoding.
390    ///         encoding: yaml_encoding_t,
391    ///     },
392    ///     /// The document parameters (for YAML_DOCUMENT_START_EVENT).
393    ///     document_start: struct {
394    ///         /// The version directive.
395    ///         version_directive: *mut yaml_version_directive_t,
396    ///         /// The list of tag directives.
397    ///         tag_directives: struct {
398    ///             /// The beginning of the tag directives list.
399    ///             start: *mut yaml_tag_directive_t,
400    ///             /// The end of the tag directives list.
401    ///             end: *mut yaml_tag_directive_t,
402    ///         },
403    ///         /// Is the document indicator implicit?
404    ///         implicit: i32,
405    ///     },
406    ///     /// The document end parameters (for YAML_DOCUMENT_END_EVENT).
407    ///     document_end: struct {
408    ///         /// Is the document end indicator implicit?
409    ///         implicit: i32,
410    ///     },
411    ///     /// The alias parameters (for YAML_ALIAS_EVENT).
412    ///     alias: struct {
413    ///         /// The anchor.
414    ///         anchor: *mut u8,
415    ///     },
416    ///     /// The scalar parameters (for YAML_SCALAR_EVENT).
417    ///     scalar: struct {
418    ///         /// The anchor.
419    ///         anchor: *mut u8,
420    ///         /// The tag.
421    ///         tag: *mut u8,
422    ///         /// The scalar value.
423    ///         value: *mut u8,
424    ///         /// The length of the scalar value.
425    ///         length: u64,
426    ///         /// Is the tag optional for the plain style?
427    ///         plain_implicit: i32,
428    ///         /// Is the tag optional for any non-plain style?
429    ///         quoted_implicit: i32,
430    ///         /// The scalar style.
431    ///         style: yaml_scalar_style_t,
432    ///     },
433    ///     /// The sequence parameters (for YAML_SEQUENCE_START_EVENT).
434    ///     sequence_start: struct {
435    ///         /// The anchor.
436    ///         anchor: *mut u8,
437    ///         /// The tag.
438    ///         tag: *mut u8,
439    ///         /// Is the tag optional?
440    ///         implicit: i32,
441    ///         /// The sequence style.
442    ///         style: yaml_sequence_style_t,
443    ///     },
444    ///     /// The mapping parameters (for YAML_MAPPING_START_EVENT).
445    ///     mapping_start: struct {
446    ///         /// The anchor.
447    ///         anchor: *mut u8,
448    ///         /// The tag.
449    ///         tag: *mut u8,
450    ///         /// Is the tag optional?
451    ///         implicit: i32,
452    ///         /// The mapping style.
453    ///         style: yaml_mapping_style_t,
454    ///     },
455    /// }
456    /// # };
457    /// ```
458    pub data: unnamed_yaml_event_t_data,
459    /// The beginning of the event.
460    pub start_mark: yaml_mark_t,
461    /// The end of the event.
462    pub end_mark: yaml_mark_t,
463}
464
465#[derive(Copy, Clone)]
466#[repr(C)]
467pub union unnamed_yaml_event_t_data {
468    /// The stream parameters (for YAML_STREAM_START_EVENT).
469    pub stream_start: unnamed_yaml_event_t_data_stream_start,
470    /// The document parameters (for YAML_DOCUMENT_START_EVENT).
471    pub document_start: unnamed_yaml_event_t_data_document_start,
472    /// The document end parameters (for YAML_DOCUMENT_END_EVENT).
473    pub document_end: unnamed_yaml_event_t_data_document_end,
474    /// The alias parameters (for YAML_ALIAS_EVENT).
475    pub alias: unnamed_yaml_event_t_data_alias,
476    /// The scalar parameters (for YAML_SCALAR_EVENT).
477    pub scalar: unnamed_yaml_event_t_data_scalar,
478    /// The sequence parameters (for YAML_SEQUENCE_START_EVENT).
479    pub sequence_start: unnamed_yaml_event_t_data_sequence_start,
480    /// The mapping parameters (for YAML_MAPPING_START_EVENT).
481    pub mapping_start: unnamed_yaml_event_t_data_mapping_start,
482}
483
484#[derive(Copy, Clone)]
485#[repr(C)]
486#[non_exhaustive]
487pub struct unnamed_yaml_event_t_data_stream_start {
488    /// The document encoding.
489    pub encoding: yaml_encoding_t,
490}
491
492#[derive(Copy, Clone)]
493#[repr(C)]
494#[non_exhaustive]
495pub struct unnamed_yaml_event_t_data_document_start {
496    /// The version directive.
497    pub version_directive: *mut yaml_version_directive_t,
498    /// The list of tag directives.
499    pub tag_directives: unnamed_yaml_event_t_data_document_start_tag_directives,
500    /// Is the document indicator implicit?
501    pub implicit: bool,
502}
503
504#[derive(Copy, Clone)]
505#[repr(C)]
506#[non_exhaustive]
507pub struct unnamed_yaml_event_t_data_document_start_tag_directives {
508    /// The beginning of the tag directives list.
509    pub start: *mut yaml_tag_directive_t,
510    /// The end of the tag directives list.
511    pub end: *mut yaml_tag_directive_t,
512}
513
514#[derive(Copy, Clone)]
515#[repr(C)]
516#[non_exhaustive]
517pub struct unnamed_yaml_event_t_data_document_end {
518    /// Is the document end indicator implicit?
519    pub implicit: bool,
520}
521
522#[derive(Copy, Clone)]
523#[repr(C)]
524#[non_exhaustive]
525pub struct unnamed_yaml_event_t_data_alias {
526    /// The anchor.
527    pub anchor: *mut yaml_char_t,
528}
529
530#[derive(Copy, Clone)]
531#[repr(C)]
532#[non_exhaustive]
533pub struct unnamed_yaml_event_t_data_scalar {
534    /// The anchor.
535    pub anchor: *mut yaml_char_t,
536    /// The tag.
537    pub tag: *mut yaml_char_t,
538    /// The scalar value.
539    pub value: *mut yaml_char_t,
540    /// The length of the scalar value.
541    pub length: size_t,
542    /// Is the tag optional for the plain style?
543    pub plain_implicit: bool,
544    /// Is the tag optional for any non-plain style?
545    pub quoted_implicit: bool,
546    /// The scalar style.
547    pub style: yaml_scalar_style_t,
548}
549
550#[derive(Copy, Clone)]
551#[repr(C)]
552#[non_exhaustive]
553pub struct unnamed_yaml_event_t_data_sequence_start {
554    /// The anchor.
555    pub anchor: *mut yaml_char_t,
556    /// The tag.
557    pub tag: *mut yaml_char_t,
558    /// Is the tag optional?
559    pub implicit: bool,
560    /// The sequence style.
561    pub style: yaml_sequence_style_t,
562}
563
564#[derive(Copy, Clone)]
565#[repr(C)]
566#[non_exhaustive]
567pub struct unnamed_yaml_event_t_data_mapping_start {
568    /// The anchor.
569    pub anchor: *mut yaml_char_t,
570    /// The tag.
571    pub tag: *mut yaml_char_t,
572    /// Is the tag optional?
573    pub implicit: bool,
574    /// The mapping style.
575    pub style: yaml_mapping_style_t,
576}
577
578/// Node types.
579#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
580#[repr(u32)]
581#[non_exhaustive]
582pub enum yaml_node_type_t {
583    /// An empty node.
584    YAML_NO_NODE = 0,
585    /// A scalar node.
586    YAML_SCALAR_NODE = 1,
587    /// A sequence node.
588    YAML_SEQUENCE_NODE = 2,
589    /// A mapping node.
590    YAML_MAPPING_NODE = 3,
591}
592
593/// The node structure.
594#[derive(Copy, Clone)]
595#[repr(C)]
596#[non_exhaustive]
597pub struct yaml_node_t {
598    /// The node type.
599    pub type_: yaml_node_type_t,
600    /// The node tag.
601    pub tag: *mut yaml_char_t,
602    /// The node data.
603    ///
604    /// ```
605    /// # const _: &str = stringify! {
606    /// union {
607    ///     /// The scalar parameters (for YAML_SCALAR_NODE).
608    ///     scalar: struct {
609    ///         /// The scalar value.
610    ///         value: *mut u8,
611    ///         /// The length of the scalar value.
612    ///         length: u64,
613    ///         /// The scalar style.
614    ///         style: yaml_scalar_style_t,
615    ///     },
616    ///     /// The sequence parameters (for YAML_SEQUENCE_NODE).
617    ///     sequence: struct {
618    ///         /// The stack of sequence items.
619    ///         items: yaml_stack_t<yaml_node_item_t>,
620    ///         /// The sequence style.
621    ///         style: yaml_sequence_style_t,
622    ///     },
623    ///     /// The mapping parameters (for YAML_MAPPING_NODE).
624    ///     mapping: struct {
625    ///         /// The stack of mapping pairs (key, value).
626    ///         pairs: yaml_stack_t<yaml_node_pair_t>,
627    ///         /// The mapping style.
628    ///         style: yaml_mapping_style_t,
629    ///     },
630    /// }
631    /// # };
632    /// ```
633    pub data: unnamed_yaml_node_t_data,
634    /// The beginning of the node.
635    pub start_mark: yaml_mark_t,
636    /// The end of the node.
637    pub end_mark: yaml_mark_t,
638}
639
640#[derive(Copy, Clone)]
641#[repr(C)]
642pub union unnamed_yaml_node_t_data {
643    /// The scalar parameters (for YAML_SCALAR_NODE).
644    pub scalar: unnamed_yaml_node_t_data_scalar,
645    /// The sequence parameters (for YAML_SEQUENCE_NODE).
646    pub sequence: unnamed_yaml_node_t_data_sequence,
647    /// The mapping parameters (for YAML_MAPPING_NODE).
648    pub mapping: unnamed_yaml_node_t_data_mapping,
649}
650
651#[derive(Copy, Clone)]
652#[repr(C)]
653#[non_exhaustive]
654pub struct unnamed_yaml_node_t_data_scalar {
655    /// The scalar value.
656    pub value: *mut yaml_char_t,
657    /// The length of the scalar value.
658    pub length: size_t,
659    /// The scalar style.
660    pub style: yaml_scalar_style_t,
661}
662
663/// An element of a sequence node.
664pub type yaml_node_item_t = libc::c_int;
665
666#[derive(Copy, Clone)]
667#[repr(C)]
668#[non_exhaustive]
669pub struct unnamed_yaml_node_t_data_sequence {
670    /// The stack of sequence items.
671    pub items: yaml_stack_t<yaml_node_item_t>,
672    /// The sequence style.
673    pub style: yaml_sequence_style_t,
674}
675
676#[derive(Copy, Clone)]
677#[repr(C)]
678#[non_exhaustive]
679pub struct unnamed_yaml_node_t_data_mapping {
680    /// The stack of mapping pairs (key, value).
681    pub pairs: yaml_stack_t<yaml_node_pair_t>,
682    /// The mapping style.
683    pub style: yaml_mapping_style_t,
684}
685
686/// An element of a mapping node.
687#[derive(Copy, Clone)]
688#[repr(C)]
689#[non_exhaustive]
690pub struct yaml_node_pair_t {
691    /// The key of the element.
692    pub key: libc::c_int,
693    /// The value of the element.
694    pub value: libc::c_int,
695}
696
697/// The document structure.
698#[derive(Copy, Clone)]
699#[repr(C)]
700#[non_exhaustive]
701pub struct yaml_document_t {
702    /// The document nodes.
703    pub nodes: yaml_stack_t<yaml_node_t>,
704    /// The version directive.
705    pub version_directive: *mut yaml_version_directive_t,
706    /// The list of tag directives.
707    ///
708    /// ```
709    /// # const _: &str = stringify! {
710    /// struct {
711    ///     /// The beginning of the tag directives list.
712    ///     start: *mut yaml_tag_directive_t,
713    ///     /// The end of the tag directives list.
714    ///     end: *mut yaml_tag_directive_t,
715    /// }
716    /// # };
717    /// ```
718    pub tag_directives: unnamed_yaml_document_t_tag_directives,
719    /// Is the document start indicator implicit?
720    pub start_implicit: bool,
721    /// Is the document end indicator implicit?
722    pub end_implicit: bool,
723    /// The beginning of the document.
724    pub start_mark: yaml_mark_t,
725    /// The end of the document.
726    pub end_mark: yaml_mark_t,
727}
728
729#[derive(Copy, Clone)]
730#[repr(C)]
731#[non_exhaustive]
732pub struct unnamed_yaml_document_t_tag_directives {
733    /// The beginning of the tag directives list.
734    pub start: *mut yaml_tag_directive_t,
735    /// The end of the tag directives list.
736    pub end: *mut yaml_tag_directive_t,
737}
738
739/// The prototype of a read handler.
740///
741/// The read handler is called when the parser needs to read more bytes from the
742/// source. The handler should write not more than `size` bytes to the `buffer`.
743/// The number of written bytes should be set to the `length` variable.
744///
745/// On success, the handler should return 1. If the handler failed, the returned
746/// value should be 0. On EOF, the handler should set the `size_read` to 0 and
747/// return 1.
748pub type yaml_read_handler_t =
749    unsafe fn(data: *mut libc::c_void, buffer: *mut libc::c_uchar, size: size_t, size_read: *mut size_t) -> libc::c_int;
750
751/// This structure holds information about a potential simple key.
752#[derive(Copy, Clone)]
753#[repr(C)]
754#[non_exhaustive]
755pub struct yaml_simple_key_t {
756    /// Is a simple key possible?
757    pub possible: bool,
758    /// Is a simple key required?
759    pub required: bool,
760    /// The number of the token.
761    pub token_number: size_t,
762    /// The position mark.
763    pub mark: yaml_mark_t,
764}
765
766/// The states of the parser.
767#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
768#[repr(u32)]
769#[non_exhaustive]
770pub enum yaml_parser_state_t {
771    /// Expect STREAM-START.
772    YAML_PARSE_STREAM_START_STATE = 0,
773    /// Expect the beginning of an implicit document.
774    YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE = 1,
775    /// Expect DOCUMENT-START.
776    YAML_PARSE_DOCUMENT_START_STATE = 2,
777    /// Expect the content of a document.
778    YAML_PARSE_DOCUMENT_CONTENT_STATE = 3,
779    /// Expect DOCUMENT-END.
780    YAML_PARSE_DOCUMENT_END_STATE = 4,
781    /// Expect a block node.
782    YAML_PARSE_BLOCK_NODE_STATE = 5,
783    /// Expect a block node or indentless sequence.
784    YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE = 6,
785    /// Expect a flow node.
786    YAML_PARSE_FLOW_NODE_STATE = 7,
787    /// Expect the first entry of a block sequence.
788    YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE = 8,
789    /// Expect an entry of a block sequence.
790    YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE = 9,
791    /// Expect an entry of an indentless sequence.
792    YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE = 10,
793    /// Expect the first key of a block mapping.
794    YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE = 11,
795    /// Expect a block mapping key.
796    YAML_PARSE_BLOCK_MAPPING_KEY_STATE = 12,
797    /// Expect a block mapping value.
798    YAML_PARSE_BLOCK_MAPPING_VALUE_STATE = 13,
799    /// Expect the first entry of a flow sequence.
800    YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE = 14,
801    /// Expect an entry of a flow sequence.
802    YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE = 15,
803    /// Expect a key of an ordered mapping.
804    YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE = 16,
805    /// Expect a value of an ordered mapping.
806    YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE = 17,
807    /// Expect the and of an ordered mapping entry.
808    YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE = 18,
809    /// Expect the first key of a flow mapping.
810    YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE = 19,
811    /// Expect a key of a flow mapping.
812    YAML_PARSE_FLOW_MAPPING_KEY_STATE = 20,
813    /// Expect a value of a flow mapping.
814    YAML_PARSE_FLOW_MAPPING_VALUE_STATE = 21,
815    /// Expect an empty value of a flow mapping.
816    YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE = 22,
817    /// Expect nothing.
818    YAML_PARSE_END_STATE = 23,
819}
820
821/// This structure holds aliases data.
822#[derive(Copy, Clone)]
823#[repr(C)]
824#[non_exhaustive]
825pub struct yaml_alias_data_t {
826    /// The anchor.
827    pub anchor: *mut yaml_char_t,
828    /// The node id.
829    pub index: libc::c_int,
830    /// The anchor mark.
831    pub mark: yaml_mark_t,
832}
833
834/// The parser structure.
835///
836/// All members are internal. Manage the structure using the `yaml_parser_`
837/// family of functions.
838#[derive(Copy, Clone)]
839#[repr(C)]
840#[non_exhaustive]
841pub struct yaml_parser_t {
842    /// Error type.
843    #[cfg(doc)]
844    pub error: yaml_error_type_t,
845    #[cfg(not(doc))]
846    pub(crate) error: yaml_error_type_t,
847    /// Error description.
848    #[cfg(doc)]
849    pub problem: *const libc::c_char,
850    #[cfg(not(doc))]
851    pub(crate) problem: *const libc::c_char,
852    /// The byte about which the problem occurred.
853    #[cfg(doc)]
854    pub problem_offset: size_t,
855    #[cfg(not(doc))]
856    pub(crate) problem_offset: size_t,
857    /// The problematic value (-1 is none).
858    #[cfg(doc)]
859    pub problem_value: libc::c_int,
860    #[cfg(not(doc))]
861    pub(crate) problem_value: libc::c_int,
862    /// The problem position.
863    #[cfg(doc)]
864    pub problem_mark: yaml_mark_t,
865    #[cfg(not(doc))]
866    pub(crate) problem_mark: yaml_mark_t,
867    /// The error context.
868    #[cfg(doc)]
869    pub context: *const libc::c_char,
870    #[cfg(not(doc))]
871    pub(crate) context: *const libc::c_char,
872    /// The context position.
873    #[cfg(doc)]
874    pub context_mark: yaml_mark_t,
875    #[cfg(not(doc))]
876    pub(crate) context_mark: yaml_mark_t,
877    /// Read handler.
878    pub(crate) read_handler: Option<yaml_read_handler_t>,
879    /// A pointer for passing to the read handler.
880    pub(crate) read_handler_data: *mut libc::c_void,
881    /// Standard (string or file) input data.
882    pub(crate) input: unnamed_yaml_parser_t_input,
883    /// EOF flag
884    pub(crate) eof: bool,
885    /// The working buffer.
886    pub(crate) buffer: yaml_buffer_t<yaml_char_t>,
887    /// The number of unread characters in the buffer.
888    pub(crate) unread: size_t,
889    /// The raw buffer.
890    pub(crate) raw_buffer: yaml_buffer_t<libc::c_uchar>,
891    /// The input encoding.
892    pub(crate) encoding: yaml_encoding_t,
893    /// The offset of the current position (in bytes).
894    pub(crate) offset: size_t,
895    /// The mark of the current position.
896    pub(crate) mark: yaml_mark_t,
897    /// Have we started to scan the input stream?
898    pub(crate) stream_start_produced: bool,
899    /// Have we reached the end of the input stream?
900    pub(crate) stream_end_produced: bool,
901    /// The number of unclosed '[' and '{' indicators.
902    pub(crate) flow_level: libc::c_int,
903    /// The tokens queue.
904    pub(crate) tokens: yaml_queue_t<yaml_token_t>,
905    /// The number of tokens fetched from the queue.
906    pub(crate) tokens_parsed: size_t,
907    /// Does the tokens queue contain a token ready for dequeueing.
908    pub(crate) token_available: bool,
909    /// The indentation levels stack.
910    pub(crate) indents: yaml_stack_t<libc::c_int>,
911    /// The current indentation level.
912    pub(crate) indent: libc::c_int,
913    /// May a simple key occur at the current position?
914    pub(crate) simple_key_allowed: bool,
915    /// The stack of simple keys.
916    pub(crate) simple_keys: yaml_stack_t<yaml_simple_key_t>,
917    /// At least this many leading elements of simple_keys have possible=0.
918    pub(crate) not_simple_keys: libc::c_int,
919    /// The parser states stack.
920    pub(crate) states: yaml_stack_t<yaml_parser_state_t>,
921    /// The current parser state.
922    pub(crate) state: yaml_parser_state_t,
923    /// The stack of marks.
924    pub(crate) marks: yaml_stack_t<yaml_mark_t>,
925    /// The list of TAG directives.
926    pub(crate) tag_directives: yaml_stack_t<yaml_tag_directive_t>,
927    /// The alias data.
928    pub(crate) aliases: yaml_stack_t<yaml_alias_data_t>,
929    /// The currently parsed document.
930    pub(crate) document: *mut yaml_document_t,
931}
932
933#[repr(C)]
934#[non_exhaustive]
935pub struct yaml_parser_t_prefix {
936    /// Error type.
937    pub error: yaml_error_type_t,
938    /// Error description.
939    pub problem: *const libc::c_char,
940    /// The byte about which the problem occurred.
941    pub problem_offset: size_t,
942    /// The problematic value (-1 is none).
943    pub problem_value: libc::c_int,
944    /// The problem position.
945    pub problem_mark: yaml_mark_t,
946    /// The error context.
947    pub context: *const libc::c_char,
948    /// The context position.
949    pub context_mark: yaml_mark_t,
950}
951
952#[doc(hidden)]
953impl Deref for yaml_parser_t {
954    type Target = yaml_parser_t_prefix;
955    fn deref(&self) -> &Self::Target {
956        unsafe { &*addr_of!(*self).cast() }
957    }
958}
959
960#[derive(Copy, Clone)]
961#[repr(C)]
962pub(crate) union unnamed_yaml_parser_t_input {
963    /// String input data.
964    pub string: unnamed_yaml_parser_t_input_string,
965}
966
967#[derive(Copy, Clone)]
968#[repr(C)]
969pub(crate) struct unnamed_yaml_parser_t_input_string {
970    /// The string start pointer.
971    pub start: *const libc::c_uchar,
972    /// The string end pointer.
973    pub end: *const libc::c_uchar,
974    /// The string current position.
975    pub current: *const libc::c_uchar,
976}
977
978/// The prototype of a write handler.
979///
980/// The write handler is called when the emitter needs to flush the accumulated
981/// characters to the output. The handler should write `size` bytes of the
982/// `buffer` to the output.
983///
984/// On success, the handler should return 1. If the handler failed, the returned
985/// value should be 0.
986pub type yaml_write_handler_t =
987    unsafe fn(data: *mut libc::c_void, buffer: *mut libc::c_uchar, size: size_t) -> libc::c_int;
988
989/// The emitter states.
990#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
991#[repr(u32)]
992#[non_exhaustive]
993pub enum yaml_emitter_state_t {
994    /// Expect STREAM-START.
995    YAML_EMIT_STREAM_START_STATE = 0,
996    /// Expect the first DOCUMENT-START or STREAM-END.
997    YAML_EMIT_FIRST_DOCUMENT_START_STATE = 1,
998    /// Expect DOCUMENT-START or STREAM-END.
999    YAML_EMIT_DOCUMENT_START_STATE = 2,
1000    /// Expect the content of a document.
1001    YAML_EMIT_DOCUMENT_CONTENT_STATE = 3,
1002    /// Expect DOCUMENT-END.
1003    YAML_EMIT_DOCUMENT_END_STATE = 4,
1004    /// Expect the first item of a flow sequence.
1005    YAML_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE = 5,
1006    /// Expect an item of a flow sequence.
1007    YAML_EMIT_FLOW_SEQUENCE_ITEM_STATE = 6,
1008    /// Expect the first key of a flow mapping.
1009    YAML_EMIT_FLOW_MAPPING_FIRST_KEY_STATE = 7,
1010    /// Expect a key of a flow mapping.
1011    YAML_EMIT_FLOW_MAPPING_KEY_STATE = 8,
1012    /// Expect a value for a simple key of a flow mapping.
1013    YAML_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE = 9,
1014    /// Expect a value of a flow mapping.
1015    YAML_EMIT_FLOW_MAPPING_VALUE_STATE = 10,
1016    /// Expect the first item of a block sequence.
1017    YAML_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE = 11,
1018    /// Expect an item of a block sequence.
1019    YAML_EMIT_BLOCK_SEQUENCE_ITEM_STATE = 12,
1020    /// Expect the first key of a block mapping.
1021    YAML_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE = 13,
1022    /// Expect the key of a block mapping.
1023    YAML_EMIT_BLOCK_MAPPING_KEY_STATE = 14,
1024    /// Expect a value for a simple key of a block mapping.
1025    YAML_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE = 15,
1026    /// Expect a value of a block mapping.
1027    YAML_EMIT_BLOCK_MAPPING_VALUE_STATE = 16,
1028    /// Expect nothing.
1029    YAML_EMIT_END_STATE = 17,
1030}
1031
1032#[derive(Copy, Clone)]
1033#[repr(C)]
1034pub(crate) struct yaml_anchors_t {
1035    /// The number of references.
1036    pub references: libc::c_int,
1037    /// The anchor id.
1038    pub anchor: libc::c_int,
1039    /// If the node has been emitted?
1040    pub serialized: bool,
1041}
1042
1043/// The emitter structure.
1044///
1045/// All members are internal. Manage the structure using the `yaml_emitter_`
1046/// family of functions.
1047#[derive(Copy, Clone)]
1048#[repr(C)]
1049#[non_exhaustive]
1050pub struct yaml_emitter_t {
1051    /// Error type.
1052    #[cfg(doc)]
1053    pub error: yaml_error_type_t,
1054    #[cfg(not(doc))]
1055    pub(crate) error: yaml_error_type_t,
1056    /// Error description.
1057    #[cfg(doc)]
1058    pub problem: *const libc::c_char,
1059    #[cfg(not(doc))]
1060    pub(crate) problem: *const libc::c_char,
1061    /// Write handler.
1062    pub(crate) write_handler: Option<yaml_write_handler_t>,
1063    /// A pointer for passing to the write handler.
1064    pub(crate) write_handler_data: *mut libc::c_void,
1065    /// Standard (string or file) output data.
1066    pub(crate) output: unnamed_yaml_emitter_t_output,
1067    /// The working buffer.
1068    pub(crate) buffer: yaml_buffer_t<yaml_char_t>,
1069    /// The raw buffer.
1070    pub(crate) raw_buffer: yaml_buffer_t<libc::c_uchar>,
1071    /// The stream encoding.
1072    pub(crate) encoding: yaml_encoding_t,
1073    /// If the output is in the canonical style?
1074    pub(crate) canonical: bool,
1075    /// The number of indentation spaces.
1076    pub(crate) best_indent: libc::c_int,
1077    /// The preferred width of the output lines.
1078    pub(crate) best_width: libc::c_int,
1079    /// Allow unescaped non-ASCII characters?
1080    pub(crate) unicode: bool,
1081    /// The preferred line break.
1082    pub(crate) line_break: yaml_break_t,
1083    /// The stack of states.
1084    pub(crate) states: yaml_stack_t<yaml_emitter_state_t>,
1085    /// The current emitter state.
1086    pub(crate) state: yaml_emitter_state_t,
1087    /// The event queue.
1088    pub(crate) events: yaml_queue_t<yaml_event_t>,
1089    /// The stack of indentation levels.
1090    pub(crate) indents: yaml_stack_t<libc::c_int>,
1091    /// The list of tag directives.
1092    pub(crate) tag_directives: yaml_stack_t<yaml_tag_directive_t>,
1093    /// The current indentation level.
1094    pub(crate) indent: libc::c_int,
1095    /// The current flow level.
1096    pub(crate) flow_level: libc::c_int,
1097    /// Is it the document root context?
1098    pub(crate) root_context: bool,
1099    /// Is it a sequence context?
1100    pub(crate) sequence_context: bool,
1101    /// Is it a mapping context?
1102    pub(crate) mapping_context: bool,
1103    /// Is it a simple mapping key context?
1104    pub(crate) simple_key_context: bool,
1105    /// The current line.
1106    pub(crate) line: libc::c_int,
1107    /// The current column.
1108    pub(crate) column: libc::c_int,
1109    /// If the last character was a whitespace?
1110    pub(crate) whitespace: bool,
1111    /// If the last character was an indentation character (' ', '-', '?', ':')?
1112    pub(crate) indention: bool,
1113    /// If an explicit document end is required?
1114    pub(crate) open_ended: libc::c_int,
1115    /// Anchor analysis.
1116    pub(crate) anchor_data: unnamed_yaml_emitter_t_anchor_data,
1117    /// Tag analysis.
1118    pub(crate) tag_data: unnamed_yaml_emitter_t_tag_data,
1119    /// Scalar analysis.
1120    pub(crate) scalar_data: unnamed_yaml_emitter_t_scalar_data,
1121    /// If the stream was already opened?
1122    pub(crate) opened: bool,
1123    /// If the stream was already closed?
1124    pub(crate) closed: bool,
1125    /// The information associated with the document nodes.
1126    pub(crate) anchors: *mut yaml_anchors_t,
1127    /// The last assigned anchor id.
1128    pub(crate) last_anchor_id: libc::c_int,
1129    /// The currently emitted document.
1130    pub(crate) document: *mut yaml_document_t,
1131}
1132
1133#[repr(C)]
1134#[non_exhaustive]
1135pub struct yaml_emitter_t_prefix {
1136    /// Error type.
1137    pub error: yaml_error_type_t,
1138    /// Error description.
1139    pub problem: *const libc::c_char,
1140}
1141
1142#[doc(hidden)]
1143impl Deref for yaml_emitter_t {
1144    type Target = yaml_emitter_t_prefix;
1145    fn deref(&self) -> &Self::Target {
1146        unsafe { &*addr_of!(*self).cast() }
1147    }
1148}
1149
1150#[derive(Copy, Clone)]
1151#[repr(C)]
1152pub(crate) union unnamed_yaml_emitter_t_output {
1153    /// String output data.
1154    pub string: unnamed_yaml_emitter_t_output_string,
1155}
1156
1157#[derive(Copy, Clone)]
1158#[repr(C)]
1159pub(crate) struct unnamed_yaml_emitter_t_output_string {
1160    /// The buffer pointer.
1161    pub buffer: *mut libc::c_uchar,
1162    /// The buffer size.
1163    pub size: size_t,
1164    /// The number of written bytes.
1165    pub size_written: *mut size_t,
1166}
1167
1168#[derive(Copy, Clone)]
1169#[repr(C)]
1170pub(crate) struct unnamed_yaml_emitter_t_anchor_data {
1171    /// The anchor value.
1172    pub anchor: *mut yaml_char_t,
1173    /// The anchor length.
1174    pub anchor_length: size_t,
1175    /// Is it an alias?
1176    pub alias: bool,
1177}
1178
1179#[derive(Copy, Clone)]
1180#[repr(C)]
1181pub(crate) struct unnamed_yaml_emitter_t_tag_data {
1182    /// The tag handle.
1183    pub handle: *mut yaml_char_t,
1184    /// The tag handle length.
1185    pub handle_length: size_t,
1186    /// The tag suffix.
1187    pub suffix: *mut yaml_char_t,
1188    /// The tag suffix length.
1189    pub suffix_length: size_t,
1190}
1191
1192#[derive(Copy, Clone)]
1193#[repr(C)]
1194pub(crate) struct unnamed_yaml_emitter_t_scalar_data {
1195    /// The scalar value.
1196    pub value: *mut yaml_char_t,
1197    /// The scalar length.
1198    pub length: size_t,
1199    /// Does the scalar contain line breaks?
1200    pub multiline: bool,
1201    /// Can the scalar be expressed in the flow plain style?
1202    pub flow_plain_allowed: bool,
1203    /// Can the scalar be expressed in the block plain style?
1204    pub block_plain_allowed: bool,
1205    /// Can the scalar be expressed in the single quoted style?
1206    pub single_quoted_allowed: bool,
1207    /// Can the scalar be expressed in the literal or folded styles?
1208    pub block_allowed: bool,
1209    /// The output style.
1210    pub style: yaml_scalar_style_t,
1211}
1212
1213#[derive(Copy, Clone)]
1214#[repr(C)]
1215pub(crate) struct yaml_string_t {
1216    pub start: *mut yaml_char_t,
1217    pub end: *mut yaml_char_t,
1218    pub pointer: *mut yaml_char_t,
1219}
1220
1221pub(crate) const NULL_STRING: yaml_string_t = yaml_string_t {
1222    start: ptr::null_mut::<yaml_char_t>(),
1223    end: ptr::null_mut::<yaml_char_t>(),
1224    pointer: ptr::null_mut::<yaml_char_t>(),
1225};
1226
1227#[repr(C)]
1228pub(crate) struct yaml_buffer_t<T> {
1229    /// The beginning of the buffer.
1230    pub start: *mut T,
1231    /// The end of the buffer.
1232    pub end: *mut T,
1233    /// The current position of the buffer.
1234    pub pointer: *mut T,
1235    /// The last filled position of the buffer.
1236    pub last: *mut T,
1237}
1238
1239impl<T> Copy for yaml_buffer_t<T> {}
1240impl<T> Clone for yaml_buffer_t<T> {
1241    fn clone(&self) -> Self {
1242        *self
1243    }
1244}
1245
1246#[repr(C)]
1247pub struct yaml_stack_t<T> {
1248    /// The beginning of the stack.
1249    pub start: *mut T,
1250    /// The end of the stack.
1251    pub end: *mut T,
1252    /// The top of the stack.
1253    pub top: *mut T,
1254}
1255
1256impl<T> Copy for yaml_stack_t<T> {}
1257impl<T> Clone for yaml_stack_t<T> {
1258    fn clone(&self) -> Self {
1259        *self
1260    }
1261}
1262
1263#[repr(C)]
1264pub(crate) struct yaml_queue_t<T> {
1265    /// The beginning of the queue.
1266    pub start: *mut T,
1267    /// The end of the queue.
1268    pub end: *mut T,
1269    /// The head of the queue.
1270    pub head: *mut T,
1271    /// The tail of the queue.
1272    pub tail: *mut T,
1273}
1274
1275impl<T> Copy for yaml_queue_t<T> {}
1276impl<T> Clone for yaml_queue_t<T> {
1277    fn clone(&self) -> Self {
1278        *self
1279    }
1280}