[][src]Function glsp::add_lib

pub fn add_lib<T>(lib: T) where
    T: Lib

Registers an instance of a library type.

Library types are singletons: if the active Runtime already contains a library of type T, this function will panic.

When the active Runtime is dropped, each of its libraries will be dropped in the reverse order that they were registered.

Once registered, it's possible to remove a library from the Runtime with glsp::take_lib, or borrow it with glsp::lib, glsp::lib_mut, glsp::try_lib and glsp::try_lib_mut.

It can be more convenient to borrow a library by calling T::borrow(), and other similar methods on the Lib trait.