@@ -19,12 +19,11 @@ use crate::{
1919 } ,
2020} ;
2121use glam:: Mat4 ;
22- use lazy_static:: lazy_static;
2322use mint:: Vector2 ;
2423use parking_lot:: Mutex ;
2524use slotmap:: { DefaultKey , Key , KeyData , SlotMap } ;
2625use stardust_xr_server_foundation:: bail;
27- use std:: sync:: { Arc , Weak } ;
26+ use std:: sync:: { Arc , LazyLock , Weak } ;
2827use tracing:: debug;
2928
3029stardust_xr_server_codegen:: codegen_item_panel_protocol!( ) ;
@@ -38,26 +37,25 @@ impl Default for Geometry {
3837}
3938impl Copy for Geometry { }
4039
41- lazy_static ! {
42- pub static ref KEYMAPS : Mutex <SlotMap <DefaultKey , String >> = Mutex :: new( SlotMap :: default ( ) ) ;
43- pub static ref ITEM_TYPE_INFO_PANEL : TypeInfo = TypeInfo {
44- type_name: "panel" ,
45- alias_info: PANEL_ITEM_ASPECT_ALIAS_INFO . clone( ) ,
46- ui_node_id: INTERFACE_NODE_ID ,
47- ui: Default :: default ( ) ,
48- items: Registry :: new( ) ,
49- acceptors: Registry :: new( ) ,
50- add_acceptor_aspect: |node| {
51- node. add_aspect( PanelItemUi ) ;
52- } ,
53- add_ui_aspect: |node| {
54- node. add_aspect( PanelItemAcceptor ) ;
55- } ,
56- new_acceptor_fn: |node, acceptor, acceptor_field| {
57- let _ = panel_item_ui_client:: create_acceptor( node, acceptor, acceptor_field) ;
58- }
59- } ;
60- }
40+ pub static KEYMAPS : LazyLock < Mutex < SlotMap < DefaultKey , String > > > =
41+ LazyLock :: new ( || Mutex :: new ( SlotMap :: default ( ) ) ) ;
42+ pub static ITEM_TYPE_INFO_PANEL : LazyLock < TypeInfo > = LazyLock :: new ( || TypeInfo {
43+ type_name : "panel" ,
44+ alias_info : PANEL_ITEM_ASPECT_ALIAS_INFO . clone ( ) ,
45+ ui_node_id : INTERFACE_NODE_ID ,
46+ ui : Default :: default ( ) ,
47+ items : Registry :: new ( ) ,
48+ acceptors : Registry :: new ( ) ,
49+ add_acceptor_aspect : |node| {
50+ node. add_aspect ( PanelItemUi ) ;
51+ } ,
52+ add_ui_aspect : |node| {
53+ node. add_aspect ( PanelItemAcceptor ) ;
54+ } ,
55+ new_acceptor_fn : |node, acceptor, acceptor_field| {
56+ let _ = panel_item_ui_client:: create_acceptor ( node, acceptor, acceptor_field) ;
57+ } ,
58+ } ) ;
6159
6260pub trait Backend : Send + Sync + ' static {
6361 fn start_data ( & self ) -> Result < PanelItemInitData > ;
0 commit comments