Public visibility
Public visibility is an access level that allows a declaration or resource to be accessed beyond its defining scope or boundary, subject to the applicable access rules.
Refactoring to Rust
A visibility modifier is Rust syntax that controls which modules or crates can access an item.
- How it is used
- Controls which module or crate callers can access Rust functions and other API items.
- How deep it goes
- Works through compiler errors, `pub(crate)`, and parent-module access rules; does not develop a broader visibility taxonomy.
- Examples
- Uses a greeting program, a calculator library, and an internal forest helper to show failed and successful access.
- What you can do after
- Apply it via `pub` or `pub(crate)` to expose intended entry points while retaining internal helpers.
Modern C, Third Edition
Visibility is the property determining whether an identifier can be referenced from a particular part of a program.
- How it is used
- Determines where C identifiers can be referenced and which declaration a name denotes.
- How deep it goes
- Works through declaration boundaries, shadowing, nested structs, and extern declarations; distinguishes name visibility from access to an object.
- Examples
- Uses nested local variables, a saved pointer, an extern declaration, and a struct declared inside another struct.
- What you can do after
- Diagnose/debug which declaration a C name refers to and whether an object remains accessible when its name is shadowed.
Read how Modern C, Third Edition explains public visibility →
Modern C
Visibility is the property determining where a C identifier can be referred to by name.
- How it is used
- Explains where C identifiers may be named and how nested declarations alter name lookup.
- How deep it goes
- Distinguishes scope, shadowing, object accessibility, definitions, and extern declarations through worked examples.
- Examples
- Uses nested local variables, a pointer, and an extern declaration to demonstrate shadowing and object identity.
- What you can do after
- Evaluate which declaration a name denotes at each point in a C program and distinguish names from objects.
Kotlin in Action, 2E
Visibility is the access-control property that determines which code can refer to a declaration.
- How it is used
- Controls access to declarations so implementation details can change without breaking dependent code.
- How deep it goes
- Defines four modifiers, compares member and top-level rules, and demonstrates property accessors; it defers broader property features.
- Examples
- Uses a converted Person class, a visibility-modifier table, and a LengthCounter with a private setter.
- What you can do after
- Apply it in Kotlin to expose APIs deliberately and restrict mutation or implementation details with suitable modifiers.
Code Like a Pro in Rust
Visibility is a Rust access-control property that determines which modules and crates can access a declaration or struct field.
- How it is used
- Controls which module and crate callers can access declarations and struct fields.
- How deep it goes
- Explains private defaults, scoped `pub` modifiers, module-path limits, field-level visibility, and exceptions for public trait and enum items.
- Examples
- Contrasts public functions in private and public modules, then shows a public struct with fields using three visibility scopes.
- What you can do after
- Apply it to expose needed APIs while keeping other declarations and fields within narrower module or crate scopes.
Read how Code Like a Pro in Rust explains public visibility →
Idiomatic Rust
Visibility is the language-defined accessibility of a program item from a given scope or module.
- How it is used
- Exposes selected Rust items to external callers while shaping a library's public API.
- How deep it goes
- Defines `pub` for fields and items, contrasts direct access with methods, and traces compiler errors for private library interfaces.
- Examples
- Uses pizza toppings, a bicycle builder API, and a linked-list library tested from outside its crate.
- What you can do after
- Configure a library API by exposing required types and methods while keeping fields private where access needs control.
Learn Rust in a Month of Lunches
Visibility is the Rust access-control property that determines whether an item or field can be referenced from a given module or crate.
- How it is used
- Controls access across modules and crates while supporting encapsulation of implementation details.
- How deep it goes
- Explains defaults, compiler feedback, and item-specific rules, but stops short of advanced visibility forms.
- Examples
- Uses a printing module, an E0603 diagnostic, and a Billy struct with selective field visibility.
- What you can do after
- Apply Rust pub declarations to expose functions, types, fields, methods, variants, and modules selectively.
Read how Learn Rust in a Month of Lunches explains public visibility →
Learn Go with Pocket-Sized Projects
Visibility is the rule determining whether a Go identifier can be referenced from outside its package, based on its initial capitalization.
- How it is used
- Controls cross-package access and determines which struct fields Go templates can print.
- How deep it goes
- Defines capitalization and demonstrates practical access failures, without detailing broader scope rules.
- Examples
- Uses fmt.Println in a runnable program and Name or WeeklyFrequency in an HTML template.
- What you can do after
- Apply it by capitalizing identifiers that other packages or templates must access.
Read how Learn Go with Pocket-Sized Projects explains public visibility →
Related concepts
- storage durationcontrasts with · Storage duration is the C property that determines how long an object exists during program execution and how its storage is managed.
- structconfigures · A struct is a composite data type or structure that groups related fields or values into a single unit.
- scopeconfigured by · Scope is the region of a program in which names are visible and can be resolved according to the language’s lookup rules.
- moduleconfigures · A module is a distinct, bounded software unit that groups related code or functionality and provides an organizational or interaction boundary within a larger system.
- functionconfigures · A function is a defined operation that maps inputs to outputs and, when implemented as a callable program unit, may also produce effects.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.







