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

Method execute

src/commands/settings.rs:108–134  ·  view source on GitHub ↗

Executes the command.

(self)

Source from the content-addressed store, hash-verified

106impl SettingsCommand {
107 /// Executes the command.
108 pub fn execute(self) -> Result<()> {
109 // Gather settings from the cranelift compiler builder
110 let mut builder = wasmtime_cranelift::builder(None)?;
111 let tunables = if let Some(target) = &self.target {
112 let target = target_lexicon::Triple::from_str(target).map_err(|e| format_err!(e))?;
113 let tunables = Tunables::default_for_target(&target)?;
114 builder.target(target)?;
115 tunables
116 } else {
117 Tunables::default_host()
118 };
119
120 builder.set_tunables(tunables)?;
121 let mut settings = Settings::from_builder(&builder);
122
123 // Add inferred settings if no target specified
124 if self.target.is_none() {
125 settings.infer(&builder)?;
126 }
127
128 // Print settings
129 if self.json {
130 self.print_json(settings)
131 } else {
132 self.print_human_readable(settings)
133 }
134 }
135
136 fn print_json(self, settings: Settings) -> Result<()> {
137 println!("{}", serde_json::to_string_pretty(&settings)?);

Callers

nothing calls this directly

Calls 7

inferMethod · 0.80
print_jsonMethod · 0.80
print_human_readableMethod · 0.80
builderFunction · 0.50
targetMethod · 0.45
set_tunablesMethod · 0.45
is_noneMethod · 0.45

Tested by

no test coverage detected