From 1ecf7c6e4184b97ea440782a0eca220b0417844b Mon Sep 17 00:00:00 2001 From: kahsa Date: Thu, 3 Nov 2022 13:38:07 +0900 Subject: [PATCH] doc: fix function heading (#16307) --- doc/docs.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/doc/docs.md b/doc/docs.md index fc4de3b7f7..f72e1d4786 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -323,8 +323,8 @@ fn private_function() { ``` Functions are private (not exported) by default. -To allow other modules to use them, prepend `pub`. The same applies -to constants and types. +To allow other [modules](#module-imports) to use them, prepend `pub`. The same applies +to [structs](#structs), [constants](#constants) and [types](#type-declarations). Note: `pub` can only be used from a named module. For information about creating a module, see [Modules](#modules). @@ -2886,6 +2886,8 @@ the expression itself, and the expression value. Every file in the root of a folder is part of the same module. Simple programs don't need to specify module name, in which case it defaults to 'main'. +See [symbol visibility](#symbol-visibility), [Access modifiers](#access-modifiers). + ### Create modules V is a very modular language. Creating reusable modules is encouraged and is @@ -2991,25 +2993,25 @@ of an interface. // interface-example.2 module main -pub interface Foo { +interface Foo { write(string) string } // => the method signature of a type, implementing interface Foo should be: -// `pub fn (s Type) write(a string) string` +// `fn (s Type) write(a string) string` -pub interface Bar { +interface Bar { mut: write(string) string } // => the method signature of a type, implementing interface Bar should be: -// `pub fn (mut s Type) write(a string) string` +// `fn (mut s Type) write(a string) string` struct MyStruct {} // MyStruct implements the interface Foo, but *not* interface Bar -pub fn (s MyStruct) write(a string) string { +fn (s MyStruct) write(a string) string { return a }