Task Description: Implement the Xorcism Struct for Stateful Data Transformation
You need to implement the Xorcism struct that provides methods for a encryption-like transformation of data, known as "munging". The implementation must fulfill the following requirements:
The method should take a slice of bytes (&[u8]), apply a transformation using a stateful algorithm based on an internal key, and return an iterator that produces transformed bytes.
Key Management:
The constructor new(key: &[u8]) -> Self should initialize the Xorcism struct with an internal state based on the provided key. The key may vary in length from less than, equal, or greater than the input data.
In-Place Munging:
Implement the method munge_in_place(&mut self, input: &mut [u8]) that performs the transformation directly on the provided mutable reference to input data (&mut [u8]).
Statefulness:
Ensure that the state of the Xorcism struct affects the transformation. Specifically, inputs that are transformed consecutively should produce different outputs until the internal state rotates through all key positions.
Round Trip Transformation:
Implement functionality so that transforming data with munge, followed by transforming the result back should yield the original input data.
IO Support (Conditional):
If the feature io is enabled, implement methods reader(&self, input: &[u8]) -> impl Read and writer(&self, output: impl Write) -> impl Write that allows reading from and writing to streams while applying the munging transformation.
Make sure that your implementation passes all the provided tests in the test code. Place the solution in the /app/ directory and ensure it's clean, well-structured code that meets the Rust coding standards.