class_docstr: A piece of text with associated style. Segments are produced by the Console render process and
  are ultimately converted in to strings to be written to the terminal.
  
  Args:
      text (str): A piece of text.
      style (:class:`~rich.style.Style`, optional): An optional style to apply to the text.
      control (Tuple[ControlCode], optional): Optional sequence of control codes.
  
  Attributes:
      cell_length (int): The cell length of this Segment.
docstr: Apply style(s) to an iterable of segments.
  
  Returns an iterable of segments where the style is replaced by ``style + segment.style + post_style``.
  
  Args:
      segments (Iterable[Segment]): Segments to process.
      style (Style, optional): Base style. Defaults to None.
      post_style (Style, optional): Style to apply on top of segment style. Defaults to None.
  
  Returns:
      Iterable[Segments]: A new iterable of segments (possibly the same iterable).
docstr_tok: ["Apply","style","(","s",")","to","an","iterable","of","segments",".","Returns","an","iterable","of","segments","where","the","style","is","replaced","by","``","style","+","segment.style","+","post_style","``",".","Args",":","segments","(","Iterable","[","Segment","]",")",":","Segments","to","process",".","style","(","Style",",","optional",")",":","Base","style",".","Defaults","to","None",".","post_style","(","Style",",","optional",")",":","Style","to","apply","on","top","of","segment","style",".","Defaults","to","None",".","Returns",":","Iterable","[","Segments","]",":","A","new","iterable","of","segments","(","possibly","the","same","iterable",")","."]
code: def apply_style(
      cls,
      segments: Iterable["Segment"],
      style: Optional[Style] = None,
      post_style: Optional[Style] = None,
  ) -> Iterable["Segment"]:
      """Apply style(s) to an iterable of segments.
  
      Returns an iterable of segments where the style is replaced by ``style + segment.style + post_style``.
  
      Args:
          segments (Iterable[Segment]): Segments to process.
          style (Style, optional): Base style. Defaults to None.
          post_style (Style, optional): Style to apply on top of segment style. Defaults to None.
  
      Returns:
          Iterable[Segments]: A new iterable of segments (possibly the same iterable).
      """
      result_segments = segments
      if style:
          apply = style.__add__
          result_segments = (
              cls(text, None if control else apply(_style), control)
              for text, _style, control in result_segments
          )
      if post_style:
          result_segments = (
              cls(
                  text,
                  (
                      None
                      if control
                      else (
                          _style + post_style if _style else post_style
                      )
                  ),
                  control,
              )
              for text, _style, control in result_segments
          )
      return result_segments
  
imports: from enum import IntEnum
  from functools import lru_cache
  from itertools import filterfalse
  from logging import getLogger
  from operator import attrgetter
  from typing import TYPE_CHECKING, Dict, Iterable, List, NamedTuple, Optional, Sequence, Tuple, Type, Union
  from .cells import _is_single_cell_widths, cached_cell_len, cell_len, get_character_cell_size, set_cell_size
  from .repr import Result, rich_repr
  from .style import Style
label_desc: Use image node_id 8 for calling the Segment obj's underlying member method code with example usage: obj.apply_style(cls, segments, style, post_style) and returns: result_segments