Struct ReloadApi

Source
#[repr(C)]
pub struct ReloadApi<Host> { pub size: fn() -> usize, pub init: fn(&mut Host, *mut ()), pub reload: fn(&mut Host, *mut ()), pub update: fn(&mut Host, *mut ()) -> ShouldQuit, pub unload: fn(&mut Host, *mut ()), pub deinit: fn(&mut Host, *mut ()), }
Expand description

Contains function pointers for all the parts of the reloadable object lifecycle.

Fields§

§size: fn() -> usize

Returns the size of the State struct so that the host can allocate space for it.

§init: fn(&mut Host, *mut ())

Initializes the State struct when the program is first started.

§reload: fn(&mut Host, *mut ())

Makes any necessary updates when the program is reloaded.

This will probably be normally empty. If you changed the State struct since the last compile, then it won’t necessarily be correctly initialized. For safety, you should make your State struct #[repr(C)] and only add members at the end.

§update: fn(&mut Host, *mut ()) -> ShouldQuit

Update the

§unload: fn(&mut Host, *mut ())

Prepare for the library to be unloaded before a new version loads.

This will probably normally be empty except for short periods in development when you’re making lots of live changes and need to do some kind of migration.

§deinit: fn(&mut Host, *mut ())

Do final shutdowns before the program completely quits.

Auto Trait Implementations§

§

impl<Host> Freeze for ReloadApi<Host>

§

impl<Host> RefUnwindSafe for ReloadApi<Host>

§

impl<Host> Send for ReloadApi<Host>

§

impl<Host> Sync for ReloadApi<Host>

§

impl<Host> Unpin for ReloadApi<Host>

§

impl<Host> UnwindSafe for ReloadApi<Host>

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> 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, 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.