gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 549 forks source link

Remove lazy_static dependency from Metal #3574

Closed kvark closed 3 years ago

kvark commented 3 years ago

Following #3572 we should remove it on Metal as well. It's only used in one place:

lazy_static! {
    static ref GFX_MANAGED_METAL_LAYER_DELEGATE_CLASS: &'static Class = unsafe {
        let mut decl = ClassDecl::new("GfxManagedMetalLayerDelegate", class!(NSObject)).unwrap();
        decl.add_method(
            sel!(layer:shouldInheritContentsScale:fromWindow:),
            layer_should_inherit_contents_scale_from_window
                as extern "C" fn(&Object, Sel, *mut Object, CGFloat, *mut Object) -> BOOL,
        );
        decl.register()
    };
}

Since it's a part of the Instance, we should be able to avoid the static, throwing the dependency out.