pub unsafe fn yaml_emitter_open(emitter: *mut yaml_emitter_t) -> Success
Expand description

Start a YAML stream.

This function should be used before yaml_emitter_dump() is called.

Examples found in repository?
src/dumper.rs (line 99)
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
pub unsafe fn yaml_emitter_dump(
    emitter: *mut yaml_emitter_t,
    document: *mut yaml_document_t,
) -> Success {
    let current_block: u64;
    let mut event = MaybeUninit::<yaml_event_t>::uninit();
    let event = event.as_mut_ptr();
    let mark = yaml_mark_t {
        index: 0_u64,
        line: 0_u64,
        column: 0_u64,
    };
    __assert!(!emitter.is_null());
    __assert!(!document.is_null());
    let fresh0 = addr_of_mut!((*emitter).document);
    *fresh0 = document;
    if !(*emitter).opened {
        if yaml_emitter_open(emitter).fail {
            current_block = 5018439318894558507;
        } else {
            current_block = 15619007995458559411;
        }
    } else {
        current_block = 15619007995458559411;
    }
    match current_block {
        15619007995458559411 => {
            if STACK_EMPTY!((*document).nodes) {
                if yaml_emitter_close(emitter).ok {
                    yaml_emitter_delete_document_and_anchors(emitter);
                    return OK;
                }
            } else {
                __assert!((*emitter).opened);
                let fresh1 = addr_of_mut!((*emitter).anchors);
                *fresh1 = yaml_malloc(
                    (size_of::<yaml_anchors_t>() as libc::c_ulong)
                        .wrapping_mul((*document).nodes.top.c_offset_from((*document).nodes.start)
                            as libc::c_long as libc::c_ulong),
                ) as *mut yaml_anchors_t;
                memset(
                    (*emitter).anchors as *mut libc::c_void,
                    0,
                    (size_of::<yaml_anchors_t>() as libc::c_ulong)
                        .wrapping_mul((*document).nodes.top.c_offset_from((*document).nodes.start)
                            as libc::c_long as libc::c_ulong),
                );
                memset(
                    event as *mut libc::c_void,
                    0,
                    size_of::<yaml_event_t>() as libc::c_ulong,
                );
                (*event).type_ = YAML_DOCUMENT_START_EVENT;
                (*event).start_mark = mark;
                (*event).end_mark = mark;
                (*event).data.document_start.version_directive = (*document).version_directive;
                (*event).data.document_start.tag_directives.start =
                    (*document).tag_directives.start;
                (*event).data.document_start.tag_directives.end = (*document).tag_directives.end;
                (*event).data.document_start.implicit = (*document).start_implicit;
                if yaml_emitter_emit(emitter, event).ok {
                    yaml_emitter_anchor_node(emitter, 1);
                    if yaml_emitter_dump_node(emitter, 1).ok {
                        memset(
                            event as *mut libc::c_void,
                            0,
                            size_of::<yaml_event_t>() as libc::c_ulong,
                        );
                        (*event).type_ = YAML_DOCUMENT_END_EVENT;
                        (*event).start_mark = mark;
                        (*event).end_mark = mark;
                        (*event).data.document_end.implicit = (*document).end_implicit;
                        if yaml_emitter_emit(emitter, event).ok {
                            yaml_emitter_delete_document_and_anchors(emitter);
                            return OK;
                        }
                    }
                }
            }
        }
        _ => {}
    }
    yaml_emitter_delete_document_and_anchors(emitter);
    FAIL
}