Sha256: 4f970663f3502a2644162033aaf6a7b65336e3e1a9b064737f5cace89636e556

Contents?: true

Size: 1.91 KB

Versions: 21

Compression:

Stored size: 1.91 KB

Contents

//! Shims for ControlPlane when chaos mode is disabled. Enables
//! unconditional use of the type and its methods throughout cranelift.

/// A shim for ControlPlane when chaos mode is disabled.
/// Please see the [crate-level documentation](crate).
#[derive(Debug, Clone, Default)]
pub struct ControlPlane {
    /// prevent direct instantiation (use `default` instead)
    _private: (),
}

/// A shim for ControlPlane's `Arbitrary` implementation when chaos mode is
/// disabled. It doesn't consume any bytes and always returns a default
/// control plane.
impl arbitrary::Arbitrary<'_> for ControlPlane {
    fn arbitrary(_u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {
        Ok(Self::default())
    }
}

impl ControlPlane {
    /// Set the [fuel limit](crate#fuel-limit). This variant is used when
    /// chaos mode is disabled. It doesn't do anything.
    pub fn set_fuel(&mut self, _fuel: u8) {}

    /// Returns a pseudo-random boolean. This variant is used when chaos
    /// mode is disabled. It always returns `false`.
    #[inline]
    pub fn get_decision(&mut self) -> bool {
        false
    }

    /// Returns an arbitrary value. This variant is used when chaos mode is
    /// disabled. It always returns the default value.
    #[inline]
    pub fn get_arbitrary<T: for<'a> arbitrary::Arbitrary<'a> + Default>(&mut self) -> T {
        T::default()
    }

    /// Shuffles the items in the slice into a pseudo-random permutation.
    /// This variant is used when chaos mode is disabled. It doesn't do
    /// anything.
    #[inline]
    pub fn shuffle<T>(&mut self, _slice: &mut [T]) {}

    /// Returns a new iterator over the same items as the input iterator in
    /// a pseudo-random order. This variant is used when chaos mode is
    /// disabled. It always returns the same order.
    #[inline]
    pub fn shuffled<T>(&mut self, iter: impl Iterator<Item = T>) -> impl Iterator<Item = T> {
        iter
    }
}

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
wasmtime-23.0.2 ./ext/cargo-vendor/cranelift-control-0.110.2/src/zero_sized.rs
wasmtime-22.0.0 ./ext/cargo-vendor/cranelift-control-0.109.0/src/zero_sized.rs
wasmtime-21.0.1 ./ext/cargo-vendor/cranelift-control-0.108.1/src/zero_sized.rs
wasmtime-20.0.2 ./ext/cargo-vendor/cranelift-control-0.107.2/src/zero_sized.rs
wasmtime-20.0.0 ./ext/cargo-vendor/cranelift-control-0.107.2/src/zero_sized.rs
wasmtime-18.0.3 ./ext/cargo-vendor/cranelift-control-0.105.3/src/zero_sized.rs
wasmtime-17.0.1 ./ext/cargo-vendor/cranelift-control-0.104.1/src/zero_sized.rs
wasmtime-17.0.0 ./ext/cargo-vendor/cranelift-control-0.104.0/src/zero_sized.rs
wasmtime-16.0.0 ./ext/cargo-vendor/cranelift-control-0.103.0/src/zero_sized.rs
wasmtime-15.0.1 ./ext/cargo-vendor/cranelift-control-0.102.1/src/zero_sized.rs
wasmtime-15.0.0 ./ext/cargo-vendor/cranelift-control-0.102.1/src/zero_sized.rs
wasmtime-14.0.4 ./ext/cargo-vendor/cranelift-control-0.101.4/src/zero_sized.rs
wasmtime-14.0.3 ./ext/cargo-vendor/cranelift-control-0.101.4/src/zero_sized.rs
wasmtime-14.0.1 ./ext/cargo-vendor/cranelift-control-0.101.1/src/zero_sized.rs
wasmtime-14.0.0 ./ext/cargo-vendor/cranelift-control-0.101.1/src/zero_sized.rs
wasmtime-13.0.0 ./ext/cargo-vendor/cranelift-control-0.100.0/src/zero_sized.rs
wasmtime-12.0.1 ./ext/cargo-vendor/cranelift-control-0.99.1/src/zero_sized.rs
wasmtime-12.0.0 ./ext/cargo-vendor/cranelift-control-0.99.1/src/zero_sized.rs
wasmtime-11.0.0 ./ext/cargo-vendor/cranelift-control-0.98.1/src/zero_sized.rs
wasmtime-10.0.1 ./ext/cargo-vendor/cranelift-control-0.97.1/src/zero_sized.rs