GhosttyMimeReaderFn typedef

Read one MIME-typed representation of some content, streaming its bytes to a writer.

The library calls this with the MIME type of the representation it needs. The callback writes all of that representation's data to @p writer, in as many calls to writer.write(writer.userdata, data, len) as is convenient (one call with everything or many small pieces both work), and returns true. Nothing written is retained beyond each write call, so the data may be borrowed from anywhere: a pasteboard item, a file being read, a stream.

Returning false reports that the data could not be read. If the writer refuses a write (returns false), stop and return false without writing more.

All pointer arguments, the mime, and the writer are borrowed and valid only for the duration of the callback. The callback is invoked synchronously on the calling thread. The API receiving the GhosttyMimeReader defines which MIME types are requested, how many times, and any consistency requirements across repeated reads.

@param userdata Opaque userdata from GhosttyMimeReader @param mime The MIME type of the representation to read @param writer Where to write the data; valid only during this call @return true once all the data was written, false if it could not be read or the writer refused a write

Implementation

typedef GhosttyMimeReaderFn =
    ffi.Pointer<ffi.NativeFunction<GhosttyMimeReaderFnFunction>>;