class_docstr: A printer to convert SymPy expressions to strings of Rust code
class_docstr_tok: ["A","printer","to","convert","SymPy","expressions","to","strings","of","Rust","code"]
code: def _print_Piecewise(self, expr):
      if expr.args[-1].cond != True:
          # We need the last conditional to be a True, otherwise the resulting
          # function may not return a result.
          raise ValueError(
              "All Piecewise expressions must contain an "
              "(expr, True) statement to be used as a default "
              "condition. Without one, the generated "
              "expression may not evaluate to anything under "
              "some condition."
          )
      lines = []
  
      for i, (e, c) in enumerate(expr.args):
          if i == 0:
              lines.append("if (%s) {" % self._print(c))
          elif i == len(expr.args) - 1 and c == True:
              lines[-1] += " else {"
          else:
              lines[-1] += " else if (%s) {" % self._print(c)
          code0 = self._print(e)
          lines.append(code0)
          lines.append("}")
  
      if self._settings["inline"]:
          return " ".join(lines)
      else:
          return "\n".join(lines)
  
imports: from __future__ import annotations
  from typing import Any
  from sympy.core import S, Rational, Float, Lambda
  from sympy.core.numbers import equal_valued
  from sympy.printing.codeprinter import CodePrinter
label_desc: Use image node_id 27 for calling the RustCodePrinter obj's underlying member method code with example usage: obj._print_Piecewise(expr) and returns: str, str