@@ -36,7 +36,7 @@ wit_bindgen(
3636
3737# Enhanced wit-bindgen with advanced features
3838wit_bindgen(
39- name = " advanced_bindings" ,
39+ name = " advanced_bindings" ,
4040 language = " rust" ,
4141 wit = " :api_interfaces" ,
4242 ownership = " borrowing" , # Memory optimization
@@ -54,12 +54,12 @@ The example demonstrates different interface mapping strategies:
5454wit_bindgen(
5555 name = " wasi_mapped_bindings" ,
5656 language = " rust" ,
57- wit = " :wasi_demo_interfaces" ,
57+ wit = " :wasi_demo_interfaces" ,
5858 with_mappings = {
5959 # Map WASI interfaces to existing ecosystem crates
6060 " wasi:io/streams" : " wasi::io::streams" ,
6161 " wasi:io/poll" : " wasi::io::poll" ,
62-
62+
6363 # Generate custom interfaces fresh
6464 " example:wasi-demo/file-processor" : " generate" ,
6565 },
@@ -88,7 +88,7 @@ wit_bindgen(
8888** Development-Friendly Service:**
8989``` starlark
9090wit_bindgen(
91- name = " service_bindings" ,
91+ name = " service_bindings" ,
9292 ownership = " borrowing-duplicate-if-necessary" , # Balanced approach
9393 additional_derives = [" Clone" , " Debug" , " PartialEq" ], # Full debugging
9494 format_code = True ,
168168world wasi-demo {
169169170170171-
171+
172172 export file-processor;
173173}
174174
175175interface file-processor {
176176 use wasi:io/streams.{input-stream, output-stream};
177177 use wasi:io/poll.{pollable};
178-
178+
179179 process-stream: func(
180180 input: borrow<input-stream>,
181181 output: borrow<output-stream>
182182 ) -> result<u64, string>;
183-
183+
184184 wait-for-ready: func(pollable: borrow<pollable>) -> bool;
185185 get-processor-version: func() -> string;
186186}
@@ -256,10 +256,10 @@ fn test_custom_derives_available() {
256256
257257 // Test Clone derive
258258 let config2 = config1 . clone ();
259-
259+
260260 // Test PartialEq derive
261261 assert_eq! (config1 , config2 );
262-
262+
263263 // Test Debug derive
264264 let debug_output = format! (" {:?}" , config1 );
265265 assert! (debug_output . contains (" ApiConfig" ));
@@ -280,7 +280,7 @@ fn test_borrowing_ownership() {
280280
281281 // This should work with borrowing ownership model
282282 let _connection = Connection :: new (& config );
283-
283+
284284 // We can still use config after borrowing it
285285 assert_eq! (config . endpoint, " test" );
286286}
@@ -433,7 +433,7 @@ wit_bindgen(
433433 name = " existing_bindings" ,
434434 language = " rust" ,
435435 wit = " :existing_interfaces" ,
436-
436+
437437 # Add basic debugging support
438438 additional_derives = [" Debug" ],
439439 format_code = True ,
@@ -447,7 +447,7 @@ wit_bindgen(
447447 name = " optimized_bindings" ,
448448 language = " rust" ,
449449 wit = " :interfaces" ,
450-
450+
451451 # Add performance optimization
452452 ownership = " borrowing-duplicate-if-necessary" ,
453453 additional_derives = [" Debug" , " Clone" ],
@@ -462,7 +462,7 @@ wit_bindgen(
462462 name = " mapped_bindings" ,
463463 language = " rust" ,
464464 wit = " :interfaces" ,
465-
465+
466466 with_mappings = {
467467 " wasi:io/streams" : " wasi::io::streams" , # Start with one mapping
468468 " my:custom/api" : " generate" ,
@@ -480,4 +480,4 @@ This comprehensive example demonstrates how the enhanced `wit_bindgen` rule enab
480480
481481- ** [ WIT Bindgen Interface Mapping] ( /guides/wit-bindgen-interface-mapping ) ** : Detailed guide on interface mapping concepts and strategies
482482- ** [ WIT Bindgen Advanced Concepts] ( /guides/wit-bindgen-advanced-concepts ) ** : Language-specific implications and architectural patterns
483- - ** [ WIT Bindgen Troubleshooting] ( /guides/wit-bindgen-troubleshooting ) ** : Common issues and debugging techniques
483+ - ** [ WIT Bindgen Troubleshooting] ( /guides/wit-bindgen-troubleshooting ) ** : Common issues and debugging techniques
0 commit comments