#[repr(C, packed(4))]pub struct ExternalInputStreamStructInterop {
pub opaque_handle1: c_ulong,
pub opaque_handle2: c_ulong,
pub read_function: Option<unsafe extern "C" fn(opaque_handle1: c_ulong, opaque_handle2: c_ulong, offset: c_ulong, pv: *mut c_void, size: c_ulong, ptrBytesRead: *mut c_ulong, error_info: *mut ExternalStreamErrorInfoInterop) -> c_int>,
pub close_function: Option<unsafe extern "C" fn(opaque_handle1: c_ulong, opaque_handle2: c_ulong)>,
}Expand description
This structure contains information about externally provided functions for reading data from an input stream, and it is used to construct a stream-object to be used with libCZI. Note on lifetime: The function pointers must remain valid until the function ‘close_function’ is called. The lifetime may extend beyond calling the ‘libCZI_ReleaseInputStream’ function for the corresponding stream-object.
Fields§
§opaque_handle1: c_ulongA user parameter which is passed to the callback function.
opaque_handle2: c_ulongA user parameter which is passed to the callback function.
read_function: Option<unsafe extern "C" fn(opaque_handle1: c_ulong, opaque_handle2: c_ulong, offset: c_ulong, pv: *mut c_void, size: c_ulong, ptrBytesRead: *mut c_ulong, error_info: *mut ExternalStreamErrorInfoInterop) -> c_int>Function pointer used to read data from the stream. This function might be called from an arbitrary thread, and it may be called concurrently from multiple threads. A 0 as return value indicates successful operation. A non-zero value indicates a non-recoverable error. In case of an error, the error_info parameter must be filled with the error information.
\param opaque_handle1 The value of the opaque_handle1 field of the ExternalInputStreamStructInterop. \param opaque_handle2 The value of the opaque_handle2 field of the ExternalInputStreamStructInterop. \param offset The offset in the stream where to start reading from. \param [out] pv Pointer to the buffer where the data is to be stored. \param size The size of the buffer (and the number of bytes to be read from the stream). \param [out] ptrBytesRead If non-null, the number of bytes that actually could be read is to be put here. \param [out] error_info If non-null, in case of an error (i.e. return value <>0), this parameter may be used to report additional error information.
close_function: Option<unsafe extern "C" fn(opaque_handle1: c_ulong, opaque_handle2: c_ulong)>Function pointer used to close the stream. This function is called only once, and up until this function is called, the read_function pointer must remain valid and operational. No assumptions should be made about when this function is called, so the implementation must be prepared to handle this function being called at any time (but not concurrently with calls to the read_function).
\param opaque_handle1 The value of the opaque_handle1 field of the ExternalInputStreamStructInterop. \param opaque_handle2 The value of the opaque_handle2 field of the ExternalInputStreamStructInterop.
Trait Implementations§
Source§impl Clone for ExternalInputStreamStructInterop
impl Clone for ExternalInputStreamStructInterop
Source§fn clone(&self) -> ExternalInputStreamStructInterop
fn clone(&self) -> ExternalInputStreamStructInterop
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more