@@ -119,6 +119,76 @@ pub trait HasDisplayHandle {
119119 ' active : ' this ;
120120}
121121
122+ impl < T : HasDisplayHandle + ?Sized > HasDisplayHandle for & T {
123+ fn active ( & self ) -> Option < Active < ' _ > > {
124+ ( * * self ) . active ( )
125+ }
126+
127+ fn display_handle < ' this , ' active > (
128+ & ' this self ,
129+ active : & ' active Active < ' _ > ,
130+ ) -> DisplayHandle < ' this >
131+ where
132+ ' active : ' this ,
133+ {
134+ ( * * self ) . display_handle ( active)
135+ }
136+ }
137+
138+ #[ cfg( feature = "alloc" ) ]
139+ #[ cfg_attr( docsrs, doc( cfg( feature = "alloc" ) ) ) ]
140+ impl < T : HasDisplayHandle + ?Sized > HasDisplayHandle for alloc:: boxed:: Box < T > {
141+ fn active ( & self ) -> Option < Active < ' _ > > {
142+ ( * * self ) . active ( )
143+ }
144+
145+ fn display_handle < ' this , ' active > (
146+ & ' this self ,
147+ active : & ' active Active < ' _ > ,
148+ ) -> DisplayHandle < ' this >
149+ where
150+ ' active : ' this ,
151+ {
152+ ( * * self ) . display_handle ( active)
153+ }
154+ }
155+
156+ #[ cfg( feature = "alloc" ) ]
157+ #[ cfg_attr( docsrs, doc( cfg( feature = "alloc" ) ) ) ]
158+ impl < T : HasDisplayHandle + ?Sized > HasDisplayHandle for alloc:: rc:: Rc < T > {
159+ fn active ( & self ) -> Option < Active < ' _ > > {
160+ ( * * self ) . active ( )
161+ }
162+
163+ fn display_handle < ' this , ' active > (
164+ & ' this self ,
165+ active : & ' active Active < ' _ > ,
166+ ) -> DisplayHandle < ' this >
167+ where
168+ ' active : ' this ,
169+ {
170+ ( * * self ) . display_handle ( active)
171+ }
172+ }
173+
174+ #[ cfg( feature = "alloc" ) ]
175+ #[ cfg_attr( docsrs, doc( cfg( feature = "alloc" ) ) ) ]
176+ impl < T : HasDisplayHandle + ?Sized > HasDisplayHandle for alloc:: sync:: Arc < T > {
177+ fn active ( & self ) -> Option < Active < ' _ > > {
178+ ( * * self ) . active ( )
179+ }
180+
181+ fn display_handle < ' this , ' active > (
182+ & ' this self ,
183+ active : & ' active Active < ' _ > ,
184+ ) -> DisplayHandle < ' this >
185+ where
186+ ' active : ' this ,
187+ {
188+ ( * * self ) . display_handle ( active)
189+ }
190+ }
191+
122192/// The handle to the display controller of the windowing system.
123193///
124194/// Get the underlying raw display handle with the `HasRawDisplayHandle` trait.
@@ -206,6 +276,60 @@ pub trait HasWindowHandle {
206276 ' active : ' this ;
207277}
208278
279+ impl < T : HasWindowHandle + ?Sized > HasWindowHandle for & T {
280+ fn window_handle < ' this , ' active > (
281+ & ' this self ,
282+ active : & ' active Active < ' _ > ,
283+ ) -> WindowHandle < ' this >
284+ where
285+ ' active : ' this ,
286+ {
287+ ( * * self ) . window_handle ( active)
288+ }
289+ }
290+
291+ #[ cfg( feature = "alloc" ) ]
292+ #[ cfg_attr( docsrs, doc( cfg( feature = "alloc" ) ) ) ]
293+ impl < T : HasWindowHandle + ?Sized > HasWindowHandle for alloc:: boxed:: Box < T > {
294+ fn window_handle < ' this , ' active > (
295+ & ' this self ,
296+ active : & ' active Active < ' _ > ,
297+ ) -> WindowHandle < ' this >
298+ where
299+ ' active : ' this ,
300+ {
301+ ( * * self ) . window_handle ( active)
302+ }
303+ }
304+
305+ #[ cfg( feature = "alloc" ) ]
306+ #[ cfg_attr( docsrs, doc( cfg( feature = "alloc" ) ) ) ]
307+ impl < T : HasWindowHandle + ?Sized > HasWindowHandle for alloc:: rc:: Rc < T > {
308+ fn window_handle < ' this , ' active > (
309+ & ' this self ,
310+ active : & ' active Active < ' _ > ,
311+ ) -> WindowHandle < ' this >
312+ where
313+ ' active : ' this ,
314+ {
315+ ( * * self ) . window_handle ( active)
316+ }
317+ }
318+
319+ #[ cfg( feature = "alloc" ) ]
320+ #[ cfg_attr( docsrs, doc( cfg( feature = "alloc" ) ) ) ]
321+ impl < T : HasWindowHandle + ?Sized > HasWindowHandle for alloc:: sync:: Arc < T > {
322+ fn window_handle < ' this , ' active > (
323+ & ' this self ,
324+ active : & ' active Active < ' _ > ,
325+ ) -> WindowHandle < ' this >
326+ where
327+ ' active : ' this ,
328+ {
329+ ( * * self ) . window_handle ( active)
330+ }
331+ }
332+
209333/// The handle to a window.
210334///
211335/// This handle is guaranteed to be safe and valid. Get the underlying
0 commit comments