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

Method unparse_fstring

crates/codegen/src/unparse.rs:625–640  ·  view source on GitHub ↗
(&mut self, value: &ast::FStringValue)

Source from the content-addressed store, hash-verified

623 }
624
625 fn unparse_fstring(&mut self, value: &ast::FStringValue) -> fmt::Result {
626 self.p("f")?;
627 let body = fmt::from_fn(|f| {
628 value.iter().try_for_each(|part| match part {
629 ast::FStringPart::Literal(lit) => f.write_str(lit),
630 ast::FStringPart::FString(ast::FString { elements, .. }) => {
631 Unparser::new(f, self.source).unparse_fstring_body(elements)
632 }
633 })
634 })
635 .to_string();
636 // .unparse_fstring_body(elements));
637 UnicodeEscape::new_repr(body.as_str().as_ref())
638 .str_repr()
639 .write(self.f)
640 }
641
642 fn unparse_tstring(&mut self, value: &ast::TStringValue) -> fmt::Result {
643 self.p("t")?;

Callers 1

unparse_exprMethod · 0.80

Calls 10

newFunction · 0.85
to_stringMethod · 0.80
unparse_fstring_bodyMethod · 0.80
str_reprMethod · 0.80
pMethod · 0.45
iterMethod · 0.45
write_strMethod · 0.45
writeMethod · 0.45
as_refMethod · 0.45
as_strMethod · 0.45

Tested by

no test coverage detected