import template code

This commit is contained in:
2026-03-24 10:31:30 +02:00
commit b443292720
974 changed files with 487563 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
// Copyright 2006-2010 Kirill Simonov
// Copyright 2011-2019 Canonical Ltd
// Copyright 2025 The go-yaml Project Contributors
// SPDX-License-Identifier: Apache-2.0 AND MIT
// Output writer with buffering.
// Provides write buffering for the emitter stage.
package libyaml
import "fmt"
// Flush the output buffer.
func (emitter *Emitter) flush() error {
if emitter.write_handler == nil {
panic("write handler not set")
}
// Check if the buffer is empty.
if emitter.buffer_pos == 0 {
return nil
}
if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil {
return WriterError{
Err: fmt.Errorf("write error: %w", err),
}
}
emitter.buffer_pos = 0
return nil
}