[][src]Trait glsp::Lib

pub trait Lib: 'static {
    fn type_name() -> &'static str;

    fn borrow() -> LibRef<Self> { ... }
fn borrow_mut() -> LibRefMut<Self> { ... }
fn try_borrow() -> Result<LibRef<Self>, GError> { ... }
fn try_borrow_mut() -> Result<LibRefMut<Self>, GError> { ... } }

A type which can be passed to glsp::add_lib.

It's possible to implement this trait manually, but using the lib! macro is strongly encouraged. Among other things, that macro will automatically implement MakeArg for the library type.

Required methods

fn type_name() -> &'static str

Loading content...

Provided methods

fn borrow() -> LibRef<Self>

Returns a shared reference to the instance of this type owned by the active Runtime.

Panics if a library of this type has not been registered with the active Runtime, or if the library is currently mutably borrowed.

fn borrow_mut() -> LibRefMut<Self>

Returns a mutable reference to the instance of this type owned by the active Runtime.

Panics if a library of this type has not been registered with the active Runtime, or if the library is currently borrowed.

fn try_borrow() -> Result<LibRef<Self>, GError>

Returns a shared reference to the instance of this type owned by the active Runtime.

Returns an Err if a library of this type has not been registered with the active Runtime, or if the library is currently mutably borrowed.

fn try_borrow_mut() -> Result<LibRefMut<Self>, GError>

Returns a mutable reference to the instance of this type owned by the active Runtime.

Returns an Err if a library of this type has not been registered with the active Runtime, or if the library is currently borrowed.

Loading content...

Implementors

Loading content...