MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / write_impl_from_world

Method write_impl_from_world

crates/wit-bindgen/src/lib.rs:3582–3618  ·  view source on GitHub ↗
(&self, src: &mut Source, path: &str)

Source from the content-addressed store, hash-verified

3580 uwriteln!(src, "}}");
3581 }
3582 fn write_impl_from_world(&self, src: &mut Source, path: &str) {
3583 if !self.has_any() {
3584 return;
3585 }
3586
3587 let mut unstable_features = self.unstable_features.iter().cloned().collect::<Vec<_>>();
3588 unstable_features.sort();
3589
3590 uwriteln!(
3591 src,
3592 "
3593 impl core::convert::From<LinkOptions> for {path}::LinkOptions {{
3594 fn from(src: LinkOptions) -> Self {{
3595 (&src).into()
3596 }}
3597 }}
3598
3599 impl core::convert::From<&LinkOptions> for {path}::LinkOptions {{
3600 fn from(src: &LinkOptions) -> Self {{
3601 let mut dest = Self::default();
3602 "
3603 );
3604
3605 for feature in unstable_features.iter() {
3606 let feature_rust_name = feature.to_snake_case();
3607 uwriteln!(src, "dest.{feature_rust_name}(src.{feature_rust_name});");
3608 }
3609
3610 uwriteln!(
3611 src,
3612 "
3613 dest
3614 }}
3615 }}
3616 "
3617 );
3618 }
3619}
3620
3621struct FeatureGate {

Callers 1

import_interfaceMethod · 0.80

Calls 3

has_anyMethod · 0.80
sortMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected