Skip to content

Glossary: Rust Basics

pub

Also written: public, private

Everything in a module is private by default, usable only inside it. Marking an item `pub` makes it public so outside code can use it; struct fields need `pub` too.

Where the book teaches it

Related terms

ModuleStruct