Skip to main content

ExternalInputStreamStructInterop

Struct ExternalInputStreamStructInterop 

Source
#[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_ulong

A user parameter which is passed to the callback function.

§opaque_handle2: c_ulong

A 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

Source§

fn clone(&self) -> ExternalInputStreamStructInterop

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ExternalInputStreamStructInterop

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for ExternalInputStreamStructInterop

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.