File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -5,8 +5,25 @@ use futures_core::stream::{FusedStream, Stream};
55#[ cfg( feature = "sink" ) ]  
66use  futures_sink:: Sink ; 
77
8- /// Combines two different futures, streams, or sinks having the same associated types into a single 
9- /// type. 
8+ /// Combines two different futures, streams, or sinks having the same associated types into a single type. 
9+ /// 
10+ /// This is useful when conditionally choosing between two distinct future types: 
11+ /// 
12+ /// ```rust 
13+ /// use futures::future::Either; 
14+ /// 
15+ /// # futures::executor::block_on(async { 
16+ /// let cond = true; 
17+ /// 
18+ /// let fut = if cond { 
19+ ///     Either::Left(async move { 12 }) 
20+ /// } else { 
21+ ///     Either::Right(async move { 44 }) 
22+ /// }; 
23+ /// 
24+ /// assert_eq!(fut.await, 12); 
25+ /// # }) 
26+ /// ``` 
1027#[ derive( Debug ,  Clone ) ]  
1128pub  enum  Either < A ,  B >  { 
1229    /// First branch of the type 
Original file line number Diff line number Diff line change @@ -243,7 +243,7 @@ pub trait SinkExt<Item>: Sink<Item> {
243243/// This future will drive the stream to keep producing items until it is 
244244/// exhausted, sending each item to the sink. It will complete once both the 
245245/// stream is exhausted, the sink has received all items, and the sink has 
246- /// been flushed. Note that the sink is **not** closed. If the stream produces   
246+ /// been flushed. Note that the sink is **not** closed. If the stream produces 
247247/// an error, that error will be returned by this future without flushing the sink. 
248248/// 
249249/// Doing `sink.send_all(stream)` is roughly equivalent to 
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments