docs

您正在閱讀 v0.1.2 的文件。Nabi 0.1.2 已停止支援。 最新版本:v0.1.3 →

本頁尚未翻譯,以下為英文原文。

#E0088: invalid format

An f-string hole formats a value that does not support the format ({} needs Display, {:?} needs Debug), or its format spec is not valid. Implement or derive the trait, or change the spec.

nabi
let name = "nabi";
println(f"{name:x}");
error[E0088]: format type `x` needs an integer, found `str`
  --> main.nabi:2:12
   |
 2 | println(f"{name:x}");
   |            ^^^^

Use a format that fits the value:

nabi
let n = 255;
println(f"{n:x}");
ff

Related: E0008 malformed f-string, E0069 trait bound not satisfied

Found a mistake? Edit this page on GitHub. Last updated