Struct smithay::backend::egl::ffi::egl::LIB[][src]

pub struct LIB { /* fields omitted */ }

Methods from Deref<Target = Library>

Get a pointer to function or static variable by symbol name.

The symbol may not contain any null bytes, with an exception of last byte. Providing a null terminated symbol may help to avoid an allocation.

Symbol is interpreted as-is; no mangling is done. This means that symbols like x::y are most likely invalid.

Safety

Users of this API must specify the correct type of the function or variable loaded. Using a Symbol with a wrong type is undefined.

Platform-specific behaviour

Implementation of thread local variables is extremely platform specific and uses of such variables that work on e.g. Linux may have unintended behaviour on other targets.

On POSIX implementations where the dlerror function is not confirmed to be MT-safe (such as FreeBSD), this function will unconditionally return an error when the underlying dlsym call returns a null pointer. There are rare situations where dlsym returns a genuine null pointer without it being an error. If loading a null pointer is something you care about, consider using the os::unix::Library::get_singlethreaded call.

Examples

Given a loaded library:

let lib = unsafe {
    Library::new("/path/to/awesome.module").unwrap()
};

Loading and using a function looks like this:

unsafe {
    let awesome_function: Symbol<unsafe extern fn(f64) -> f64> =
        lib.get(b"awesome_function\0").unwrap();
    awesome_function(0.42);
}

A static variable may also be loaded and inspected:

unsafe {
    let awesome_variable: Symbol<*mut f64> = lib.get(b"awesome_variable\0").unwrap();
    **awesome_variable = 42.0;
};

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.