         try parse() // Drop YAML_STREAM_START_EVENT
     }
 
+    func startParse(with buffer: UnsafeBufferPointer<UInt8>) throws {
+        yaml_parser_set_input_string(&parser, buffer.baseAddress, buffer.count)
+        try parse() // Drop YAML_STREAM_START_EVENT
+    }
+
     @discardableResult
     func parse() throws -> Event {
         let event = Event()

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

    private var parser = yaml_parser_t()

    private enum Buffer {
        case utf8View(String.UTF8View)
        case utf8Slice(ArraySlice<CChar>)
        case utf16(Data)
    }
    private var buffer: Buffer
}

// MARK: Implementation Details
