SysBinding

Trait SysBinding 

Source
pub trait SysBinding {
    // Required methods
    unsafe fn shutdown(&mut self) -> !;
    unsafe fn panic(&self, error: Option<NonNullConst<u8>>) -> !;
    unsafe fn has_function(&self, id: FnId) -> Bool;
    unsafe fn get_function(&self, id: FnId) -> Optional<CBaseFn>;
    unsafe fn lock(&self);
    unsafe fn try_lock(&self) -> Bool;
    unsafe fn unlock(&self);
    unsafe fn get_sync_handler(&self) -> NonNullConst<SyncHandlerInterface>;
    unsafe fn set_sync_handler(
        &mut self,
        handler: Option<NonNullConst<SyncHandlerInterface>>,
    );
}
Expand description

Helper trait for using the sys api.

Required Methods§

Source

unsafe fn shutdown(&mut self) -> !

Sends a termination signal.

§Safety

The function is not thread-safe and crosses the ffi boundary.

Source

unsafe fn panic(&self, error: Option<NonNullConst<u8>>) -> !

Execution of the program is stopped abruptly. The error may be logged.

§Safety

The function crosses the ffi boundary.

Source

unsafe fn has_function(&self, id: FnId) -> Bool

Checks if a function is implemented.

§Return

Bool::True if the function exists, Bool::False otherwise.

§Safety

The function crosses the ffi boundary.

Source

unsafe fn get_function(&self, id: FnId) -> Optional<CBaseFn>

Fetches a function from the interface.

§Return

Function pointer to the requested function, if it exists.

§Safety

The function crosses the ffi boundary.

Source

unsafe fn lock(&self)

Locks the interface.

The calling thread is stalled until the lock can be acquired. Only one thread can hold the lock at a time.

§Safety

The function crosses the ffi boundary.

Source

unsafe fn try_lock(&self) -> Bool

Tries to lock the interface.

The function fails if another thread already holds the lock.

§Return

Bool::True on success and Bool::False otherwise.

§Safety

The function crosses the ffi boundary.

Source

unsafe fn unlock(&self)

Unlocks the interface.

§Safety

The function crosses the ffi boundary. Trying to call this function without prior locking is undefined behaviour.

Source

unsafe fn get_sync_handler(&self) -> NonNullConst<SyncHandlerInterface>

Fetches the active synchronization handler.

§Return

Pointer to the active synchronization handler.

§Safety

The function is not thread-safe and crosses the ffi boundary.

Source

unsafe fn set_sync_handler( &mut self, handler: Option<NonNullConst<SyncHandlerInterface>>, )

Sets a new synchronization handler.

The default synchronization handler is used, if handler is Option::None.

§Uses

This function can be used by modules, that want to provide a more complex synchronization mechanism than the one presented by the default handler.

§Swapping

The swapping occurs in three steps:

  1. The new synchronization handler is locked.
  2. The new synchronization handler is set as the active synchronization handler.
  3. The old synchronization handler is unlocked.
§Note

Changing the synchronization handler may break some modules, if they depend on a specific synchronization handler.

§Safety

The function is not thread-safe and crosses the ffi boundary.

Implementors§