2323//!
2424//! Roughly corresponds to capability.h in the C++ implementation.
2525
26- #[ cfg( feature = "alloc" ) ]
27- use alloc:: boxed:: Box ;
2826#[ cfg( feature = "alloc" ) ]
2927use core:: future:: Future ;
3028#[ cfg( feature = "alloc" ) ]
31- use core:: marker:: { PhantomData , Unpin } ;
29+ use core:: marker:: PhantomData ;
3230#[ cfg( feature = "rpc_try" ) ]
3331use core:: ops:: Try ;
3432#[ cfg( feature = "alloc" ) ]
@@ -55,7 +53,7 @@ pub struct Promise<T, E> {
5553#[ cfg( feature = "alloc" ) ]
5654enum PromiseInner < T , E > {
5755 Immediate ( Result < T , E > ) ,
58- Deferred ( Pin < Box < dyn Future < Output = core:: result:: Result < T , E > > + ' static > > ) ,
56+ Deferred ( Pin < alloc :: boxed :: Box < dyn Future < Output = core:: result:: Result < T , E > > + ' static > > ) ,
5957 Empty ,
6058}
6159
@@ -82,7 +80,7 @@ impl<T, E> Promise<T, E> {
8280 F : Future < Output = core:: result:: Result < T , E > > + ' static ,
8381 {
8482 Self {
85- inner : PromiseInner :: Deferred ( Box :: pin ( f) ) ,
83+ inner : PromiseInner :: Deferred ( alloc :: boxed :: Box :: pin ( f) ) ,
8684 }
8785 }
8886}
@@ -146,15 +144,15 @@ where
146144#[ cfg( feature = "alloc" ) ]
147145pub struct Response < Results > {
148146 pub marker : PhantomData < Results > ,
149- pub hook : Box < dyn ResponseHook > ,
147+ pub hook : alloc :: boxed :: Box < dyn ResponseHook > ,
150148}
151149
152150#[ cfg( feature = "alloc" ) ]
153151impl < Results > Response < Results >
154152where
155153 Results : Pipelined + Owned ,
156154{
157- pub fn new ( hook : Box < dyn ResponseHook > ) -> Self {
155+ pub fn new ( hook : alloc :: boxed :: Box < dyn ResponseHook > ) -> Self {
158156 Self {
159157 marker : PhantomData ,
160158 hook,
@@ -169,15 +167,15 @@ where
169167#[ cfg( feature = "alloc" ) ]
170168pub struct Request < Params , Results > {
171169 pub marker : PhantomData < ( Params , Results ) > ,
172- pub hook : Box < dyn RequestHook > ,
170+ pub hook : alloc :: boxed :: Box < dyn RequestHook > ,
173171}
174172
175173#[ cfg( feature = "alloc" ) ]
176174impl < Params , Results > Request < Params , Results >
177175where
178176 Params : Owned ,
179177{
180- pub fn new ( hook : Box < dyn RequestHook > ) -> Self {
178+ pub fn new ( hook : alloc :: boxed :: Box < dyn RequestHook > ) -> Self {
181179 Self {
182180 hook,
183181 marker : PhantomData ,
@@ -220,12 +218,12 @@ where
220218#[ cfg( feature = "alloc" ) ]
221219pub struct Params < T > {
222220 pub marker : PhantomData < T > ,
223- pub hook : Box < dyn ParamsHook > ,
221+ pub hook : alloc :: boxed :: Box < dyn ParamsHook > ,
224222}
225223
226224#[ cfg( feature = "alloc" ) ]
227225impl < T > Params < T > {
228- pub fn new ( hook : Box < dyn ParamsHook > ) -> Self {
226+ pub fn new ( hook : alloc :: boxed :: Box < dyn ParamsHook > ) -> Self {
229227 Self {
230228 marker : PhantomData ,
231229 hook,
@@ -243,15 +241,15 @@ impl<T> Params<T> {
243241#[ cfg( feature = "alloc" ) ]
244242pub struct Results < T > {
245243 pub marker : PhantomData < T > ,
246- pub hook : Box < dyn ResultsHook > ,
244+ pub hook : alloc :: boxed :: Box < dyn ResultsHook > ,
247245}
248246
249247#[ cfg( feature = "alloc" ) ]
250248impl < T > Results < T >
251249where
252250 T : Owned ,
253251{
254- pub fn new ( hook : Box < dyn ResultsHook > ) -> Self {
252+ pub fn new ( hook : alloc :: boxed :: Box < dyn ResultsHook > ) -> Self {
255253 Self {
256254 marker : PhantomData ,
257255 hook,
@@ -275,10 +273,10 @@ pub trait FromTypelessPipeline {
275273#[ cfg( feature = "alloc" ) ]
276274pub trait FromClientHook {
277275 /// Wraps a client hook to create a new client.
278- fn new ( hook : Box < dyn ClientHook > ) -> Self ;
276+ fn new ( hook : alloc :: boxed :: Box < dyn ClientHook > ) -> Self ;
279277
280278 /// Unwraps client to get the underlying client hook.
281- fn into_client_hook ( self ) -> Box < dyn ClientHook > ;
279+ fn into_client_hook ( self ) -> alloc :: boxed :: Box < dyn ClientHook > ;
282280
283281 /// Gets a reference to the underlying client hook.
284282 fn as_client_hook ( & self ) -> & dyn ClientHook ;
@@ -297,12 +295,12 @@ pub trait FromClientHook {
297295/// An untyped client.
298296#[ cfg( feature = "alloc" ) ]
299297pub struct Client {
300- pub hook : Box < dyn ClientHook > ,
298+ pub hook : alloc :: boxed :: Box < dyn ClientHook > ,
301299}
302300
303301#[ cfg( feature = "alloc" ) ]
304302impl Client {
305- pub fn new ( hook : Box < dyn ClientHook > ) -> Self {
303+ pub fn new ( hook : alloc :: boxed :: Box < dyn ClientHook > ) -> Self {
306304 Self { hook }
307305 }
308306
0 commit comments