File tree Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Expand file tree Collapse file tree 1 file changed +15
-15
lines changed Original file line number Diff line number Diff line change @@ -29,8 +29,22 @@ r[type.fn-pointer.intro]
2929Function pointer types, written using the ` fn `  keyword, refer to a function
3030whose identity is not necessarily known at compile-time.
3131
32+ An example where ` Binop `  is defined as a function pointer type:
33+ 
34+ ``` rust 
35+ fn  add (x :  i32 , y :  i32 ) ->  i32  {
36+     x  +  y 
37+ }
38+ 
39+ let  mut  x  =  add (5 ,7 );
40+ 
41+ type  Binop  =  fn (i32 , i32 ) ->  i32 ;
42+ let  bo :  Binop  =  add ;
43+ x  =  bo (5 ,7 );
44+ ``` 
45+ 
3246r[ type.fn-pointer.coercion] 
33- They  can be created via a coercion from both [ function items]  and non-capturing, non-async [ closures] .
47+ Function pointers  can be created via a coercion from both [ function items]  and non-capturing, non-async [ closures] .
3448
3549r[ type.fn-pointer.qualifiers] 
3650The ` unsafe `  qualifier indicates that the type's value is an [ unsafe
@@ -47,20 +61,6 @@ these calling conventions:
4761*  ` win64 ` 
4862*  ` efiapi ` 
4963
50- An example where ` Binop `  is defined as a function pointer type:
51- 
52- ``` rust 
53- fn  add (x :  i32 , y :  i32 ) ->  i32  {
54-     x  +  y 
55- }
56- 
57- let  mut  x  =  add (5 ,7 );
58- 
59- type  Binop  =  fn (i32 , i32 ) ->  i32 ;
60- let  bo :  Binop  =  add ;
61- x  =  bo (5 ,7 );
62- ``` 
63- 
6464r[ type.fn-pointer.attributes] 
6565## Attributes on function pointer parameters  
6666
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments