MCPcopy Index your code
hub / github.com/RustPython/RustPython / unparse_fstring_elem

Method unparse_fstring_elem

crates/codegen/src/unparse.rs:599–618  ·  view source on GitHub ↗
(&mut self, elem: &ast::InterpolatedStringElement)

Source from the content-addressed store, hash-verified

597 }
598
599 fn unparse_fstring_elem(&mut self, elem: &ast::InterpolatedStringElement) -> fmt::Result {
600 match elem {
601 ast::InterpolatedStringElement::Interpolation(ast::InterpolatedElement {
602 expression,
603 debug_text,
604 conversion,
605 format_spec,
606 ..
607 }) => self.unparse_formatted(
608 expression,
609 debug_text.as_ref(),
610 *conversion,
611 format_spec.as_deref(),
612 ),
613 ast::InterpolatedStringElement::Literal(ast::InterpolatedStringLiteralElement {
614 value,
615 ..
616 }) => self.unparse_fstring_str(value),
617 }
618 }
619
620 fn unparse_fstring_str(&mut self, s: &str) -> fmt::Result {
621 let s = s.replace('{', "{{").replace('}', "}}");

Callers 1

unparse_fstring_bodyMethod · 0.80

Calls 3

unparse_formattedMethod · 0.80
unparse_fstring_strMethod · 0.80
as_refMethod · 0.45

Tested by

no test coverage detected