docs

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

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

#E0016: visibility where it has no meaning

pub was written where it changes nothing: on a function or item inside a block (it is visible only in that block) or on an enum variant (variants take the enum's visibility). Remove it.

nabi
enum Color { pub Red, Blue }
error[E0016]: enum variants take the enum's visibility; remove the visibility keyword
  --> main.nabi:1:14
   |
 1 | enum Color { pub Red, Blue }
   |              ^^^

Remove pub from the variant; to make the variants visible, mark the enum pub.

nabi
#[derive(Debug)]
pub enum Color { Red, Blue }
println(f"{Color::Red:?}");
Red

Related: E0034 item is private

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