| 1 | use ffirust-analyzer cargo yaml 0.3.0 ffi/; |
| 2 | use error::YamlError; |
| 3 | use event::{YamlVersionDirective, YamlTagDirective}; |
| 4 | |
| 5 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/; |
| 6 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/; |
| 7 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/; |
| 8 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/; |
| 9 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::{CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#, CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#}; |
| 10 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/; |
| 11 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#; |
| 12 | use libcrust-analyzer cargo libc 0.2.189 crate/; |
| 13 | |
| 14 | pub struct YamlBaseEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter# { |
| 15 | emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem.: ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_trust-analyzer cargo yaml 0.3.0 ffi/yaml_emitter_t# |
| 16 | } |
| 17 | |
| 18 | impl YamlBaseEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter# { |
| 19 | unsafe fn newrust-analyzer cargo yaml 0.3.0 emitter/impl#[YamlBaseEmitter]new().() -> YamlBaseEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter# { |
| 20 | YamlBaseEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter# { |
| 21 | emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem.: memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::uninitializedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/uninitialized().() |
| 22 | } |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | impl Droprust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/drop/Drop# for YamlBaseEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter# { |
| 27 | fn droprust-analyzer cargo yaml 0.3.0 emitter/impl#[YamlBaseEmitter][Drop]drop().(&mut self) { |
| 28 | unsafe { |
| 29 | ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_deleterust-analyzer cargo yaml 0.3.0 yaml_emitter_delete().(&mut self.emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem.); |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | pub struct YamlEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#<'r> { |
| 35 | base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter.: YamlBaseEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#, |
| 36 | writerrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#writer.: &'r mut (Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#+'r), |
| 37 | io_errorrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#io_error.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<iorust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/::Errorrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/error/Error#>, |
| 38 | } |
| 39 | |
| 40 | fn to_c_str_optrust-analyzer cargo yaml 0.3.0 emitter/to_c_str_opt().(s: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#>, YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> { |
| 41 | match s { |
| 42 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#), |
| 43 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) => match CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CString]new().(s.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()) { |
| 44 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(cstr) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(cstr)), |
| 45 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#::newrust-analyzer cargo yaml 0.3.0 error/impl#[YamlError]new().( |
| 46 | ffirust-analyzer cargo yaml 0.3.0 ffi/::YamlErrorTyperust-analyzer cargo yaml 0.3.0 ffi/YamlErrorType#::YAML_EMITTER_ERRORrust-analyzer cargo yaml 0.3.0 ffi/YamlErrorType#YAML_EMITTER_ERROR#, |
| 47 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("Nul bytes in string".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) |
| 48 | )) |
| 49 | } |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | fn to_c_strrust-analyzer cargo yaml 0.3.0 emitter/to_c_str().(s: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#, YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> { |
| 54 | match CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CString]new().(s.as_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_bytes().()) { |
| 55 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(cstr) => Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(cstr), |
| 56 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#::newrust-analyzer cargo yaml 0.3.0 error/impl#[YamlError]new().( |
| 57 | ffirust-analyzer cargo yaml 0.3.0 ffi/::YamlErrorTyperust-analyzer cargo yaml 0.3.0 ffi/YamlErrorType#::YAML_EMITTER_ERRORrust-analyzer cargo yaml 0.3.0 ffi/YamlErrorType#YAML_EMITTER_ERROR#, |
| 58 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("Nul bytes in string".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) |
| 59 | )) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | impl<'r> YamlEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#<'r> { |
| 64 | pub fn initrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]init().<'a>(writer: &'a mut Writerust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#) -> Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<YamlEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#<'a>> { |
| 65 | unsafe { |
| 66 | let mut emitter = Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T>`]new().(YamlEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter# { |
| 67 | base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter.: YamlBaseEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#::newrust-analyzer cargo yaml 0.3.0 emitter/impl#[YamlBaseEmitter]new().(), |
| 68 | writerrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#writer.: writer, |
| 69 | io_errorrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#io_error.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 70 | }); |
| 71 | |
| 72 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_initializerust-analyzer cargo yaml 0.3.0 yaml_emitter_initialize().(&mut emitter.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 { |
| 73 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("failed to initialize yaml_emitter_t"); |
| 74 | } |
| 75 | |
| 76 | ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_set_outputrust-analyzer cargo yaml 0.3.0 yaml_emitter_set_output().(&mut emitter.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem., handle_writer_cbrust-analyzer cargo yaml 0.3.0 emitter/handle_writer_cb()., memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::transmuterust-analyzer cargo core https://github.com/rust-lang/rust/library/core intrinsics/transmute().(&mut *rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/impl#[`Box<T, A>`][Deref]deref().emitter)); |
| 77 | |
| 78 | emitter |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | fn get_errorrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]get_error().(&mut self) -> YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError# { |
| 83 | let emitter_mem = &self.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem.; |
| 84 | unsafe { |
| 85 | let c_problem = CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#::from_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]from_ptr().(emitter_mem.problemrust-analyzer cargo yaml 0.3.0 ffi/yaml_emitter_t#problem.); |
| 86 | let mut error = YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError# { |
| 87 | kindrust-analyzer cargo yaml 0.3.0 error/YamlError#kind.: emitter_mem.errorrust-analyzer cargo yaml 0.3.0 ffi/yaml_emitter_t#error., |
| 88 | problemrust-analyzer cargo yaml 0.3.0 error/YamlError#problem.: strrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/::from_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/converts/from_utf8().(c_problem.to_bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]to_bytes().()).maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]map().(|s| s.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().(), |
| 89 | io_errorrust-analyzer cargo yaml 0.3.0 error/YamlError#io_error.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 90 | contextrust-analyzer cargo yaml 0.3.0 error/YamlError#context.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 91 | }; |
| 92 | |
| 93 | memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::swaprust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/swap().(&mut self.io_errorrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#io_error., &mut error.io_errorrust-analyzer cargo yaml 0.3.0 error/YamlError#io_error.); |
| 94 | |
| 95 | return error; |
| 96 | } |
| 97 | } |
| 98 | |
| 99 | pub fn emit_streamrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_stream().<F>(&mut self, encoding: ffirust-analyzer cargo yaml 0.3.0 ffi/::YamlEncodingrust-analyzer cargo yaml 0.3.0 ffi/YamlEncoding#, f: F) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> |
| 100 | where F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&mut YamlEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> |
| 101 | { |
| 102 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(self.emit_stream_start_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_stream_start_event().(encoding)); |
| 103 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(f(self)); |
| 104 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(self.emit_stream_end_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_stream_end_event().()); |
| 105 | self.flushrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]flush().() |
| 106 | } |
| 107 | |
| 108 | fn emit_stream_start_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_stream_start_event().(&mut self, encoding: ffirust-analyzer cargo yaml 0.3.0 ffi/::YamlEncodingrust-analyzer cargo yaml 0.3.0 ffi/YamlEncoding#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> { |
| 109 | unsafe { |
| 110 | let mut event = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::uninitializedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/uninitialized().(); |
| 111 | |
| 112 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_stream_start_event_initializerust-analyzer cargo yaml 0.3.0 yaml_stream_start_event_initialize().(&mut event, encoding) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 { |
| 113 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("yaml_stream_start_event_initialize failed!"); |
| 114 | } |
| 115 | |
| 116 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_emitrust-analyzer cargo yaml 0.3.0 yaml_emitter_emit().(&mut self.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem., &mut event) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 { |
| 117 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 118 | } else { |
| 119 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(self.get_errorrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]get_error().()) |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | fn emit_stream_end_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_stream_end_event().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> { |
| 125 | unsafe { |
| 126 | let mut event = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::uninitializedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/uninitialized().(); |
| 127 | |
| 128 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_stream_end_event_initializerust-analyzer cargo yaml 0.3.0 yaml_stream_end_event_initialize().(&mut event) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 { |
| 129 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("yaml_stream_end_event_initialize failed!"); |
| 130 | } |
| 131 | |
| 132 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_emitrust-analyzer cargo yaml 0.3.0 yaml_emitter_emit().(&mut self.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem., &mut event) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 { |
| 133 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 134 | } else { |
| 135 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(self.get_errorrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]get_error().()) |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | |
| 140 | pub fn emit_documentrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_document().<F>(&mut self, |
| 141 | version_directive: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<YamlVersionDirectiverust-analyzer cargo yaml 0.3.0 event/YamlVersionDirective#>, |
| 142 | tag_directives: &[YamlTagDirectiverust-analyzer cargo yaml 0.3.0 event/YamlTagDirective#], |
| 143 | implicit: bool, |
| 144 | f: F) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> where |
| 145 | F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&mut YamlEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> |
| 146 | { |
| 147 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(self.emit_document_start_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_document_start_event().(version_directive, tag_directives, implicit)); |
| 148 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(f(self)); |
| 149 | self.emit_document_end_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_document_end_event().(implicit) |
| 150 | } |
| 151 | |
| 152 | fn emit_document_start_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_document_start_event().(&mut self, |
| 153 | version_directive: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<YamlVersionDirectiverust-analyzer cargo yaml 0.3.0 event/YamlVersionDirective#>, |
| 154 | tag_directives: &[YamlTagDirectiverust-analyzer cargo yaml 0.3.0 event/YamlTagDirective#], |
| 155 | implicit: bool) |
| 156 | -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> |
| 157 | { |
| 158 | let mut vsn_dir = ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_version_directive_trust-analyzer cargo yaml 0.3.0 ffi/yaml_version_directive_t# { majorrust-analyzer cargo yaml 0.3.0 ffi/yaml_version_directive_t#major.: 0, minorrust-analyzer cargo yaml 0.3.0 ffi/yaml_version_directive_t#minor.: 0 }; |
| 159 | let c_vsn_dir = match version_directive { |
| 160 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(directive) => { |
| 161 | vsn_dir.majorrust-analyzer cargo yaml 0.3.0 ffi/yaml_version_directive_t#major. = directive.majorrust-analyzer cargo yaml 0.3.0 event/YamlVersionDirective#major. as libcrust-analyzer cargo libc 0.2.189 crate/::c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#; |
| 162 | vsn_dir.minorrust-analyzer cargo yaml 0.3.0 ffi/yaml_version_directive_t#minor. = directive.minorrust-analyzer cargo yaml 0.3.0 event/YamlVersionDirective#minor. as libcrust-analyzer cargo libc 0.2.189 crate/::c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#; |
| 163 | &vsn_dir as *const ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_version_directive_trust-analyzer cargo yaml 0.3.0 ffi/yaml_version_directive_t# |
| 164 | }, |
| 165 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null().() |
| 166 | }; |
| 167 | |
| 168 | let c_tag_dirs: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_tag_directive_trust-analyzer cargo yaml 0.3.0 ffi/yaml_tag_directive_t#> = |
| 169 | match tag_directives.iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|tag| tag.to_tag_directive_trust-analyzer cargo yaml 0.3.0 event/impl#[YamlTagDirective]to_tag_directive_t().()).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().() { |
| 170 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(dirs) => dirs, |
| 171 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(_) => return Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#::newrust-analyzer cargo yaml 0.3.0 error/impl#[YamlError]new().( |
| 172 | ffirust-analyzer cargo yaml 0.3.0 ffi/::YamlErrorTyperust-analyzer cargo yaml 0.3.0 ffi/YamlErrorType#::YAML_EMITTER_ERRORrust-analyzer cargo yaml 0.3.0 ffi/YamlErrorType#YAML_EMITTER_ERROR#, |
| 173 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#("Nul bytes in tag directives".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) |
| 174 | )) |
| 175 | }; |
| 176 | let tag_dir_start = c_tag_dirs.as_ptrrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]as_ptr().(); |
| 177 | unsafe { |
| 178 | let mut event = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::uninitializedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/uninitialized().(); |
| 179 | let tag_dir_end = tag_dir_start.offsetrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]offset().(c_tag_dirs.lenrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]len().() as isize); |
| 180 | let c_implicit = if implicit { 1 } else { 0 }; |
| 181 | |
| 182 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_document_start_event_initializerust-analyzer cargo yaml 0.3.0 yaml_document_start_event_initialize().(&mut event, c_vsn_dir, tag_dir_start, tag_dir_end, c_implicit) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 { |
| 183 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("yaml_document_start_event_initialize failed!"); |
| 184 | } |
| 185 | |
| 186 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_emitrust-analyzer cargo yaml 0.3.0 yaml_emitter_emit().(&mut self.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem., &mut event) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 { |
| 187 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 188 | } else { |
| 189 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(self.get_errorrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]get_error().()) |
| 190 | } |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | fn emit_document_end_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_document_end_event().(&mut self, implicit: bool) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> { |
| 195 | let c_implicit = if implicit { 1 } else { 0 }; |
| 196 | unsafe { |
| 197 | let mut event = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::uninitializedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/uninitialized().(); |
| 198 | |
| 199 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_document_end_event_initializerust-analyzer cargo yaml 0.3.0 yaml_document_end_event_initialize().(&mut event, c_implicit) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 { |
| 200 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("yaml_stream_end_event_initialize failed!"); |
| 201 | } |
| 202 | |
| 203 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_emitrust-analyzer cargo yaml 0.3.0 yaml_emitter_emit().(&mut self.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem., &mut event) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 { |
| 204 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 205 | } else { |
| 206 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(self.get_errorrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]get_error().()) |
| 207 | } |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | pub fn emit_alias_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_alias_event().(&mut self, anchor: &str) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> { |
| 212 | let c_anchor = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(to_c_strrust-analyzer cargo yaml 0.3.0 emitter/to_c_str().(anchor)); |
| 213 | |
| 214 | unsafe { |
| 215 | let mut event = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::uninitializedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/uninitialized().(); |
| 216 | |
| 217 | let ptr = c_anchor.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]as_ptr().(); |
| 218 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_alias_event_initializerust-analyzer cargo yaml 0.3.0 yaml_alias_event_initialize().(&mut event, ptr as *const ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_char_trust-analyzer cargo yaml 0.3.0 ffi/yaml_char_t#) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 { |
| 219 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("yaml_stream_end_event_initialize failed!") |
| 220 | } |
| 221 | |
| 222 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_emitrust-analyzer cargo yaml 0.3.0 yaml_emitter_emit().(&mut self.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem., &mut event) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 { |
| 223 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 224 | } else { |
| 225 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(self.get_errorrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]get_error().()) |
| 226 | } |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | pub fn emit_scalar_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_scalar_event().(&mut self, anchor: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>, tag: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>, |
| 231 | value: &str, plain_implicit: bool, quoted_implicit: bool, |
| 232 | style: ffirust-analyzer cargo yaml 0.3.0 ffi/::YamlScalarStylerust-analyzer cargo yaml 0.3.0 ffi/YamlScalarStyle#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> |
| 233 | { |
| 234 | let c_anchor = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(to_c_str_optrust-analyzer cargo yaml 0.3.0 emitter/to_c_str_opt().(anchor)); |
| 235 | let anchor_ptr = match c_anchor { |
| 236 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) => s.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]as_ptr().(), |
| 237 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null().() |
| 238 | }; |
| 239 | let c_tag = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(to_c_str_optrust-analyzer cargo yaml 0.3.0 emitter/to_c_str_opt().(tag)); |
| 240 | let tag_ptr = match c_tag { |
| 241 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) => s.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]as_ptr().(), |
| 242 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null().() |
| 243 | }; |
| 244 | let c_plain_implicit = if plain_implicit { 1 } else { 0 }; |
| 245 | let c_quoted_implicit = if quoted_implicit { 1 } else { 0 }; |
| 246 | |
| 247 | unsafe { |
| 248 | let mut event = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::uninitializedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/uninitialized().(); |
| 249 | |
| 250 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_scalar_event_initializerust-analyzer cargo yaml 0.3.0 yaml_scalar_event_initialize().(&mut event, |
| 251 | anchor_ptr as *const ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_char_trust-analyzer cargo yaml 0.3.0 ffi/yaml_char_t#, tag_ptr as *const ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_char_trust-analyzer cargo yaml 0.3.0 ffi/yaml_char_t#, |
| 252 | value.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]as_ptr().(), value.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]len().() as libcrust-analyzer cargo libc 0.2.189 crate/::c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int#, |
| 253 | c_plain_implicit, c_quoted_implicit, |
| 254 | style) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 |
| 255 | { |
| 256 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("yaml_scalar_event_initialize failed!"); |
| 257 | } |
| 258 | |
| 259 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_emitrust-analyzer cargo yaml 0.3.0 yaml_emitter_emit().(&mut self.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem., &mut event) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 { |
| 260 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 261 | } else { |
| 262 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(self.get_errorrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]get_error().()) |
| 263 | } |
| 264 | } |
| 265 | } |
| 266 | |
| 267 | pub fn emit_sequencerust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_sequence().<F>(&mut self, anchor: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>, tag: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>, implicit: bool, |
| 268 | style: ffirust-analyzer cargo yaml 0.3.0 ffi/::YamlSequenceStylerust-analyzer cargo yaml 0.3.0 ffi/YamlSequenceStyle#, |
| 269 | f: F) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> where |
| 270 | F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&mut YamlEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> |
| 271 | { |
| 272 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(self.emit_sequence_start_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_sequence_start_event().(anchor, tag, implicit, style)); |
| 273 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(f(self)); |
| 274 | self.emit_sequence_end_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_sequence_end_event().() |
| 275 | } |
| 276 | |
| 277 | fn emit_sequence_start_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_sequence_start_event().(&mut self, anchor: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>, tag: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>, implicit: bool, |
| 278 | style: ffirust-analyzer cargo yaml 0.3.0 ffi/::YamlSequenceStylerust-analyzer cargo yaml 0.3.0 ffi/YamlSequenceStyle#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> |
| 279 | { |
| 280 | let c_anchor = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(to_c_str_optrust-analyzer cargo yaml 0.3.0 emitter/to_c_str_opt().(anchor)); |
| 281 | let anchor_ptr = match c_anchor { |
| 282 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) => s.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]as_ptr().(), |
| 283 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null().() |
| 284 | }; |
| 285 | let c_tag = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(to_c_str_optrust-analyzer cargo yaml 0.3.0 emitter/to_c_str_opt().(tag)); |
| 286 | let tag_ptr = match c_tag { |
| 287 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) => s.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]as_ptr().(), |
| 288 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null().() |
| 289 | }; |
| 290 | let c_implicit = if implicit { 1 } else { 0 }; |
| 291 | |
| 292 | unsafe { |
| 293 | let mut event = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::uninitializedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/uninitialized().(); |
| 294 | |
| 295 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_sequence_start_event_initializerust-analyzer cargo yaml 0.3.0 yaml_sequence_start_event_initialize().(&mut event, |
| 296 | anchor_ptr as *const ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_char_trust-analyzer cargo yaml 0.3.0 ffi/yaml_char_t#, tag_ptr as *const ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_char_trust-analyzer cargo yaml 0.3.0 ffi/yaml_char_t#, |
| 297 | c_implicit, style) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 |
| 298 | { |
| 299 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("yaml_sequence_start_event_initialize failed!"); |
| 300 | } |
| 301 | |
| 302 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_emitrust-analyzer cargo yaml 0.3.0 yaml_emitter_emit().(&mut self.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem., &mut event) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 { |
| 303 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 304 | } else { |
| 305 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(self.get_errorrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]get_error().()) |
| 306 | } |
| 307 | } |
| 308 | } |
| 309 | |
| 310 | fn emit_sequence_end_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_sequence_end_event().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> { |
| 311 | unsafe { |
| 312 | let mut event = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::uninitializedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/uninitialized().(); |
| 313 | |
| 314 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_sequence_end_event_initializerust-analyzer cargo yaml 0.3.0 yaml_sequence_end_event_initialize().(&mut event) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 { |
| 315 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("yaml_sequence_end_event_initialize failed!"); |
| 316 | } |
| 317 | |
| 318 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_emitrust-analyzer cargo yaml 0.3.0 yaml_emitter_emit().(&mut self.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem., &mut event) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 { |
| 319 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 320 | } else { |
| 321 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(self.get_errorrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]get_error().()) |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | pub fn emit_mappingrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_mapping().<F>(&mut self, anchor: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>, tag: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>, implicit: bool, |
| 327 | style: ffirust-analyzer cargo yaml 0.3.0 ffi/::YamlSequenceStylerust-analyzer cargo yaml 0.3.0 ffi/YamlSequenceStyle#, |
| 328 | f: F) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> where |
| 329 | F: Fnrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/Fn#(&mut YamlEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> |
| 330 | { |
| 331 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(self.emit_mapping_start_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_mapping_start_event().(anchor, tag, implicit, style)); |
| 332 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(f(self)); |
| 333 | self.emit_mapping_end_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_mapping_end_event().() |
| 334 | } |
| 335 | |
| 336 | fn emit_mapping_start_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_mapping_start_event().(&mut self, anchor: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>, tag: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&str>, implicit: bool, |
| 337 | style: ffirust-analyzer cargo yaml 0.3.0 ffi/::YamlSequenceStylerust-analyzer cargo yaml 0.3.0 ffi/YamlSequenceStyle#) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> |
| 338 | { |
| 339 | let c_anchor = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(to_c_str_optrust-analyzer cargo yaml 0.3.0 emitter/to_c_str_opt().(anchor)); |
| 340 | let anchor_ptr = match c_anchor { |
| 341 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) => s.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]as_ptr().(), |
| 342 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null().() |
| 343 | }; |
| 344 | let c_tag = tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(to_c_str_optrust-analyzer cargo yaml 0.3.0 emitter/to_c_str_opt().(tag)); |
| 345 | let tag_ptr = match c_tag { |
| 346 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(s) => s.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/impl#[CStr]as_ptr().(), |
| 347 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::nullrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/null().() |
| 348 | }; |
| 349 | let c_implicit = if implicit { 1 } else { 0 }; |
| 350 | |
| 351 | unsafe { |
| 352 | let mut event = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::uninitializedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/uninitialized().(); |
| 353 | |
| 354 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_mapping_start_event_initializerust-analyzer cargo yaml 0.3.0 yaml_mapping_start_event_initialize().(&mut event, |
| 355 | anchor_ptr as *const ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_char_trust-analyzer cargo yaml 0.3.0 ffi/yaml_char_t#, tag_ptr as *const ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_char_trust-analyzer cargo yaml 0.3.0 ffi/yaml_char_t#, |
| 356 | c_implicit, style) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 |
| 357 | { |
| 358 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("yaml_mapping_start_event_initialize failed!"); |
| 359 | } |
| 360 | |
| 361 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_emitrust-analyzer cargo yaml 0.3.0 yaml_emitter_emit().(&mut self.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem., &mut event) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 { |
| 362 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 363 | } else { |
| 364 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(self.get_errorrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]get_error().()) |
| 365 | } |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | fn emit_mapping_end_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_mapping_end_event().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> { |
| 370 | unsafe { |
| 371 | let mut event = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::uninitializedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/uninitialized().(); |
| 372 | |
| 373 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_mapping_end_event_initializerust-analyzer cargo yaml 0.3.0 yaml_mapping_end_event_initialize().(&mut event) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 { |
| 374 | panicrust-analyzer cargo std https://github.com/rust-lang/rust/library/std macros/panic!!("yaml_mapping_end_event_initialize failed!"); |
| 375 | } |
| 376 | |
| 377 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_emitrust-analyzer cargo yaml 0.3.0 yaml_emitter_emit().(&mut self.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem., &mut event) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 { |
| 378 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 379 | } else { |
| 380 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(self.get_errorrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]get_error().()) |
| 381 | } |
| 382 | } |
| 383 | } |
| 384 | |
| 385 | pub fn flushrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]flush().(&mut self) -> Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<(), YamlErrorrust-analyzer cargo yaml 0.3.0 error/YamlError#> { |
| 386 | unsafe { |
| 387 | if ffirust-analyzer cargo yaml 0.3.0 ffi/::yaml_emitter_flushrust-analyzer cargo yaml 0.3.0 yaml_emitter_flush().(&mut self.base_emitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#base_emitter..emitter_memrust-analyzer cargo yaml 0.3.0 emitter/YamlBaseEmitter#emitter_mem.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().0 { |
| 388 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) |
| 389 | } else { |
| 390 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(self.get_errorrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]get_error().()) |
| 391 | } |
| 392 | } |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | extern fn handle_writer_cbrust-analyzer cargo yaml 0.3.0 emitter/handle_writer_cb().(data: *mut YamlEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#, buffer: *const u8, size: libcrust-analyzer cargo libc 0.2.189 crate/::size_trust-analyzer cargo libc 0.2.189 unix/size_t#) -> libcrust-analyzer cargo libc 0.2.189 crate/::c_intrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/primitives/c_int# { |
| 397 | unsafe { |
| 398 | let buf = slicerust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/::from_raw_partsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/raw/from_raw_parts().(buffer, size as usize); |
| 399 | let emitter = &mut *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/Deref#deref().data; |
| 400 | match emitter.writerrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#writer..write_allrust-analyzer cargo std https://github.com/rust-lang/rust/library/std io/Write#write_all().(buf) { |
| 401 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(()) => 1, |
| 402 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(err) => { |
| 403 | emitter.io_errorrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#io_error. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(err); |
| 404 | 0 |
| 405 | } |
| 406 | } |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | #[cfg(test)] |
| 411 | mod testrust-analyzer cargo yaml 0.3.0 emitter/test/ { |
| 412 | use emitter::YamlEmitter; |
| 413 | use ffi::YamlEncoding::YamlUtf8Encoding; |
| 414 | use ffi::YamlScalarStyle::*; |
| 415 | use ffi::YamlSequenceStyle::*; |
| 416 | |
| 417 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 418 | #[allow(unused_must_use)] |
| 419 | fn event_emitter_sequence_testrust-analyzer cargo yaml 0.3.0 emitter/test/event_emitter_sequence_test().() { |
| 420 | let mut writer = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 421 | { |
| 422 | let mut emitter = YamlEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#::initrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]init().(&mut writer); |
| 423 | emitter.emit_streamrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_stream().(YamlUtf8Encodingrust-analyzer cargo yaml 0.3.0 ffi/YamlEncoding#YamlUtf8Encoding#, |e| { |
| 424 | e.emit_documentrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_document().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, &[], true, |e| { |
| 425 | e.emit_sequencerust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_sequence().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, true, YamlFlowSequenceStylerust-analyzer cargo yaml 0.3.0 ffi/YamlSequenceStyle#YamlFlowSequenceStyle#, |e| { |
| 426 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(e.emit_scalar_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_scalar_event().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, "1", true, false, YamlPlainScalarStylerust-analyzer cargo yaml 0.3.0 ffi/YamlScalarStyle#YamlPlainScalarStyle#)); |
| 427 | e.emit_scalar_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_scalar_event().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, "2", true, false, YamlPlainScalarStylerust-analyzer cargo yaml 0.3.0 ffi/YamlScalarStyle#YamlPlainScalarStyle#) |
| 428 | }) |
| 429 | }) |
| 430 | }); |
| 431 | emitter.flushrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]flush().(); |
| 432 | } |
| 433 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&writer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., b"[1, 2]\n"); |
| 434 | } |
| 435 | |
| 436 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 437 | #[allow(unused_must_use)] |
| 438 | fn event_emitter_mapping_testrust-analyzer cargo yaml 0.3.0 emitter/test/event_emitter_mapping_test().() { |
| 439 | let mut writer = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 440 | { |
| 441 | let mut emitter = YamlEmitterrust-analyzer cargo yaml 0.3.0 emitter/YamlEmitter#::initrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]init().(&mut writer); |
| 442 | emitter.emit_streamrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_stream().(YamlUtf8Encodingrust-analyzer cargo yaml 0.3.0 ffi/YamlEncoding#YamlUtf8Encoding#, |e| { |
| 443 | e.emit_documentrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_document().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, &[], true, |e| { |
| 444 | e.emit_mappingrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_mapping().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, true, YamlFlowSequenceStylerust-analyzer cargo yaml 0.3.0 ffi/YamlSequenceStyle#YamlFlowSequenceStyle#, |e| { |
| 445 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(e.emit_scalar_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_scalar_event().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, "a", true, false, YamlPlainScalarStylerust-analyzer cargo yaml 0.3.0 ffi/YamlScalarStyle#YamlPlainScalarStyle#)); |
| 446 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(e.emit_scalar_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_scalar_event().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, "1", true, false, YamlPlainScalarStylerust-analyzer cargo yaml 0.3.0 ffi/YamlScalarStyle#YamlPlainScalarStyle#)); |
| 447 | tryrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/`r#try`!!(e.emit_scalar_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_scalar_event().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, "b", true, false, YamlPlainScalarStylerust-analyzer cargo yaml 0.3.0 ffi/YamlScalarStyle#YamlPlainScalarStyle#)); |
| 448 | e.emit_scalar_eventrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]emit_scalar_event().(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, "2", true, false, YamlPlainScalarStylerust-analyzer cargo yaml 0.3.0 ffi/YamlScalarStyle#YamlPlainScalarStyle#) |
| 449 | }) |
| 450 | }) |
| 451 | }); |
| 452 | emitter.flushrust-analyzer cargo yaml 0.3.0 emitter/impl#[`YamlEmitter<'r>`]flush().(); |
| 453 | } |
| 454 | assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&writer[rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()...]rust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`][`Index<I>`]index()., b"{a: 1, b: 2}\n"); |
| 455 | } |
| 456 | } |