Coverage Report

Created: 2025-07-18 06:04

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