1 use super::PoolingAllocationConfig; 2 use arbitrary::Arbitrary; 3 4 /// Configuration for `wasmtime::InstanceAllocationStrategy`. 5 #[derive(Arbitrary, Clone, Debug, Eq, PartialEq, Hash)] 6 pub enum InstanceAllocationStrategy { 7 /// Use the on-demand instance allocation strategy. 8 OnDemand, 9 /// Use the pooling instance allocation strategy. 10 Pooling(PoolingAllocationConfig), 11 } 12 13 impl InstanceAllocationStrategy { 14 /// Convert this generated strategy a Wasmtime strategy. 15 pub fn configure(&self, cfg: &mut wasmtime_cli_flags::CommonOptions) { 16 match self { 17 InstanceAllocationStrategy::OnDemand => {} 18 InstanceAllocationStrategy::Pooling(pooling) => { 19 cfg.opts.pooling_allocator = Some(true); 20 pooling.configure(cfg); 21 } 22 } 23 } 24 } 25