"""The Mimeo Raw Consumer module.

It exports only one class:
    * RawConsumer
        A Consumer implementation printing data in the standard output.
"""
from __future__ import annotations

from typing import Collection, Generator

from mimeo.consumers import Consumer


class RawConsumer(Consumer):
    """A Consumer implementation printing data in the standard output.

    This Consumer is instantiated for the 'stdout' output direction
    and prints data produced by Mimeo in the standard output.

    Methods
    -------
    consume
        Print data generated in the standard output.
    """

    async def consume(
            self,
            data: Collection | Generator,
    ) -> None:
        """Print data generated in the standard output.

        It is an implementation of Consumer's abstract method.

        Parameters
        ----------
        data : Collection | Generator
            Stringified data generated by Mimeo
        """
        for data_unit in data:
            print(data_unit)
