pub fn new(
        strategy: PoolingAllocationStrategy,
        module_limits: ModuleLimits,
        instance_limits: InstanceLimits,
        stack_size: usize,
        tunables: &Tunables,
    ) -> Result<Self> {
        if instance_limits.count == 0 {
            bail!("the instance count limit cannot be zero");
        }

        let instances = InstancePool::new(strategy, &module_limits, &instance_limits, tunables)?;

        #[cfg(all(feature = "uffd", target_os = "linux"))]
        let _fault_handler = imp::PageFaultHandler::new(&instances)?;

        drop(stack_size); // suppress unused warnings w/o async feature

        Ok(Self {
            module_limits,
            instances: mem::ManuallyDrop::new(instances),
            #[cfg(all(feature = "async", unix))]
            stacks: StackPool::new(&instance_limits, stack_size)?,
            #[cfg(all(feature = "async", windows))]
            stack_size,
            #[cfg(all(feature = "uffd", target_os = "linux"))]
            _fault_handler,
        })
    }
/// Creates a new pooling instance allocator with the given strategy and limits.
Creates a new pooling instance allocator with the given strategy and limits.
Creates a new pooling instance allocator with the given strategy and limits .
pub fn new(
        strategy: PoolingAllocationStrategy,
        module_limits: ModuleLimits,
        instance_limits: InstanceLimits,
        stack_size: usize,
        tunables: &Tunables,
    ) -> Result<Self> {
        if instance_limits.count == 0 {
            bail!("the instance count limit cannot be zero");
        }
        let instances = InstancePool::new(strategy, &module_limits, &instance_limits, tunables)?;
        #[cfg(all(feature = "uffd", target_os = "linux"))]
        let _fault_handler = imp::PageFaultHandler::new(&instances)?;
        drop(stack_size); // suppress unused warnings w/o async feature
        Ok(Self {
            module_limits,
            instances: mem::ManuallyDrop::new(instances),
            #[cfg(all(feature = "async", unix))]
            stacks: StackPool::new(&instance_limits, stack_size)?,
            #[cfg(all(feature = "async", windows))]
            stack_size,
            #[cfg(all(feature = "uffd", target_os = "linux"))]
            _fault_handler,
        })
    }
pub fn new ( strategy : PoolingAllocationStrategy , module_limits : ModuleLimits , instance_limits : InstanceLimits , stack_size : usize , tunables : & Tunables , ) -> Result < Self > { if instance_limits . count == 0 { bail ! ( " " ) ; } let instances = InstancePool :: new ( strategy , & module_limits , & instance_limits , tunables ) ? ; # [ cfg ( all ( feature " " target_os " " ) ) ] let _fault_handler = imp :: PageFaultHandler :: new ( & instances ) ? ; drop ( stack_size ) ; // suppress unused warnings w/o async feature Ok ( Self { module_limits , instances : mem :: ManuallyDrop :: new ( instances ) , # [ cfg ( all ( feature " " unix ) ) ] stacks : StackPool :: new ( & instance_limits , stack_size ) ? , # [ cfg ( all ( feature " " windows ) ) ] stack_size , # [ cfg ( all ( feature " " target_os " " ) ) ] _fault_handler , } ) }
Creates a new pooling instance allocator with the given strategy and limits.
Creates a new pooling instance allocator with the given strategy and limits .
strategy
PoolingAllocationStrategy
module_limits
ModuleLimits
instance_limits
InstanceLimits
stack_size
usize
tunables
&Tunables
strategy
PoolingAllocationStrategy
module_limits
ModuleLimits
instance_limits
InstanceLimits
stack_size
usize
tunables
&Tunables