From 35240b29cfe46f434ed60321c8b1d7380e0d0a6c Mon Sep 17 00:00:00 2001 From: sabiwara Date: Sat, 21 Dec 2024 19:01:54 +0900 Subject: [PATCH] Improve doc navigability for child spec options --- lib/elixir/lib/gen_server.ex | 8 +++++--- lib/elixir/lib/supervisor.ex | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/elixir/lib/gen_server.ex b/lib/elixir/lib/gen_server.ex index 20ce168f7ec..bc82faf5ee4 100644 --- a/lib/elixir/lib/gen_server.ex +++ b/lib/elixir/lib/gen_server.ex @@ -203,14 +203,16 @@ defmodule GenServer do The generated `child_spec/1` can be customized with the following options: * `:id` - the child specification identifier, defaults to the current module - * `:restart` - when the child should be restarted, defaults to `:permanent` - * `:shutdown` - how to shut down the child, either immediately or by giving it time to shut down + * [`:restart`](`m:Supervisor#module-restart-values-restart`) - when the + child should be restarted, defaults to `:permanent` + * [`:shutdown`](`m:Supervisor#module-shutdown-values-shutdown`) - how to + shut down the child, either immediately or by giving it time to shut down For example: use GenServer, restart: :transient, shutdown: 10_000 - See the "Child specification" section in the `Supervisor` module for more + See the ["Child specification"](`m:Supervisor#module-child_spec-1-function`) section in the `Supervisor` module for more detailed information. The `@doc` annotation immediately preceding `use GenServer` will be attached to the generated `child_spec/1` function. diff --git a/lib/elixir/lib/supervisor.ex b/lib/elixir/lib/supervisor.ex index bc068465ef3..ee73698a298 100644 --- a/lib/elixir/lib/supervisor.ex +++ b/lib/elixir/lib/supervisor.ex @@ -130,11 +130,11 @@ defmodule Supervisor do to start the child process. This key is required. * `:restart` - an atom that defines when a terminated child process - should be restarted (see the "Restart values" section below). + should be restarted (see the ["Restart values"](#module-restart-values-restart) section below). This key is optional and defaults to `:permanent`. * `:shutdown` - an integer or atom that defines how a child process should - be terminated (see the "Shutdown values" section below). This key + be terminated (see the ["Shutdown values"](#module-shutdown-values-shutdown) section below). This key is optional and defaults to `5_000` if the type is `:worker` or `:infinity` if the type is `:supervisor`.