From 235bd87db5ea6f8ed8a0e369047582bbcf51504b Mon Sep 17 00:00:00 2001 From: kahsa Date: Sun, 23 Oct 2022 23:31:50 +0900 Subject: [PATCH] doc: improve TOC (#16166) --- doc/docs.md | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/doc/docs.md b/doc/docs.md index 108ecff9e3..3e427b9e5a 100644 --- a/doc/docs.md +++ b/doc/docs.md @@ -37,12 +37,13 @@ To do so, run the command `v up`. * [Running a project folder](#running-a-project-folder-with-several-files) * [Comments](#comments) * [Functions](#functions) - * [Returning multiple values](#returning-multiple-values) * [Hoistings](#hoistings) + * [Returning multiple values](#returning-multiple-values) * [Symbol visibility](#symbol-visibility) * [Variables](#variables) * [V types](#v-types) * [Strings](#strings) + * [Runes](#runes) * [Numbers](#numbers) * [Arrays](#arrays) * [Multidimensional arrays](#multidimensional-arrays) @@ -61,12 +62,10 @@ To do so, run the command `v up`. * [Default field values](#default-field-values) * [Short struct literal syntax](#short-struct-literal-syntax) * [Access modifiers](#access-modifiers) + * [Anonymous structs](#anonymous-structs) * [Methods](#methods) * [Embedded structs](#embedded-structs) * [Unions](#unions) - - - * [Functions 2](#functions-2) * [Immutable function args by default](#immutable-function-args-by-default) * [Mutable arguments](#mutable-arguments) @@ -74,6 +73,9 @@ To do so, run the command `v up`. * [Anonymous & higher-order functions](#anonymous--higher-order-functions) * [Closures](#closures) * [Parameter evaluation order](#parameter-evaluation-order) + + + * [References](#references) * [Constants](#constants) * [Builtin functions](#builtin-functions) @@ -82,12 +84,13 @@ To do so, run the command `v up`. * [Modules](#modules) * [Type Declarations](#type-declarations) * [Interfaces](#interfaces) + * [Function Types](#function-types) * [Enums](#enums) * [Sum types](#sum-types) * [Type aliases](#type-aliases) * [Option/Result types & error handling](#optionresult-types-and-error-handling) -* [Custom error types](#custom-error-types) -* [Generics](#generics) + * [Custom error types](#custom-error-types) + * [Generics](#generics) * [Concurrency](#concurrency) * [Spawning Concurrent Tasks](#spawning-concurrent-tasks) * [Channels](#channels) @@ -102,16 +105,17 @@ To do so, run the command `v up`. * [Test files](#test-files) * [Running tests](#running-tests) * [Memory management](#memory-management) + * [Control](#control) * [Stack and Heap](#stack-and-heap) * [ORM](#orm) - - - * [Writing documentation](#writing-documentation) * [Tools](#tools) * [v fmt](#v-fmt) * [v shader](#v-shader) * [Profiling](#profiling) + + + * [Package Management](#package-management) * [Publish package](#publish-package) * [Advanced Topics](#advanced-topics) @@ -3592,7 +3596,7 @@ Above, `http.get` returns a `?http.Response`. `resp` is only in scope for the fi `if` branch. `err` is only in scope for the `else` branch. -## Custom error types +### Custom error types V gives you the ability to define custom error types through the `IError` interface. The interface requires two methods: `msg() string` and `code() int`. Every type that @@ -3624,7 +3628,7 @@ fn main() { } ``` -## Generics +### Generics ```v wip @@ -4207,7 +4211,7 @@ fn test_atoi() ? { } ``` -#### Running tests +### Running tests To run test functions in an individual test file, use `v foo_test.v`. @@ -4275,7 +4279,7 @@ Note 2: Autofree is still WIP. Until it stabilises and becomes the default, plea avoid using it. Right now allocations are handled by a minimal and well performing GC until V's autofree engine is production ready. -### Examples +**Examples** ```v import strings