Path: blob/main/cranelift/control/src/zero_sized.rs
1692 views
//! Shims for ControlPlane when chaos mode is disabled. Enables1//! unconditional use of the type and its methods throughout cranelift.23/// A shim for ControlPlane when chaos mode is disabled.4/// Please see the [crate-level documentation](crate).5#[derive(Debug, Clone, Default)]6pub struct ControlPlane {7/// prevent direct instantiation (use `default` instead)8_private: (),9}1011/// A shim for ControlPlane's `Arbitrary` implementation when chaos mode is12/// disabled. It doesn't consume any bytes and always returns a default13/// control plane.14#[cfg(feature = "fuzz")]15impl arbitrary::Arbitrary<'_> for ControlPlane {16fn arbitrary(_u: &mut arbitrary::Unstructured<'_>) -> arbitrary::Result<Self> {17Ok(Self::default())18}19}2021impl ControlPlane {22/// Set the [fuel limit](crate#fuel-limit). This variant is used when23/// chaos mode is disabled. It doesn't do anything.24pub fn set_fuel(&mut self, _fuel: u8) {}2526/// Returns a pseudo-random boolean. This variant is used when chaos27/// mode is disabled. It always returns `false`.28#[inline]29pub fn get_decision(&mut self) -> bool {30false31}3233/// Returns an arbitrary value. This variant is used when chaos mode is34/// disabled. It always returns the default value.35#[inline]36pub fn get_arbitrary<T: Default>(&mut self) -> T {37T::default()38}3940/// Shuffles the items in the slice into a pseudo-random permutation.41/// This variant is used when chaos mode is disabled. It doesn't do42/// anything.43#[inline]44pub fn shuffle<T>(&mut self, _slice: &mut [T]) {}4546/// Returns a new iterator over the same items as the input iterator in47/// a pseudo-random order. This variant is used when chaos mode is48/// disabled. It always returns the same order.49#[inline]50pub fn shuffled<T>(&mut self, iter: impl Iterator<Item = T>) -> impl Iterator<Item = T> {51iter52}53}545556