     private var parser = yaml_parser_t()
 
     private enum Buffer {
-        case utf8(ArraySlice<CChar>)
+        case utf8View(String.UTF8View)
+        case utf8Slice(ArraySlice<CChar>)
         case utf16(Data)
     }
-    private let buffer: Buffer
+    private var buffer: Buffer
 }
 
 // MARK: Implementation Details

    }
}
#endif

        switch encoding {
        case .utf8:
            yaml_parser_set_encoding(&parser, YAML_UTF8_ENCODING)
            buffer = .utf8View(yaml.utf8)
            if try yaml.utf8.withContiguousStorageIfAvailable(startParse(with:)) == nil {
            let utf8Slice = string.utf8CString.dropLast()
                buffer = .utf8Slice(utf8Slice)
            try utf8Slice.withUnsafeBytes(startParse(with:))
            }
        case .utf16:
            // use native endian
            let isLittleEndian = 1 == 1.littleEndian
