lsdocs_plugin_sdk::config #
Reading a plugin's settings from the site's .config/ directory.
The host says where .config/ is (ConfigInfo); what a plugin keeps
there, and in what format, is its own business. The recommended layout
is <vendor>/<name>/, name being the plugin's name in the site
config, so that two instances of a plugin keep separate settings:
recommended builds such a path for lsdocs' own plugins, and
toml_file reads one TOML file. A plugin registers a loader with
Plugin::settings; it runs once, at
initialize.
struct Loaded #
A plugin's settings, as its loader read them.
Trait implementations
field settings #
pub settings: ValueThe settings, as the plugin wants them (null for none).
field files #
pub files: The files read (relative to .config/, or absolute), including
ones looked for and not found: the host's cache keys cover them.
function recommended #
lsdocs/<name>/<file>: where lsdocs' own plugins keep file.
function toml_file #
Reads <.config>/<relative> as TOML. A missing file is no settings
(null), still listed in Loaded::files; a file that is not TOML is
an error naming it.
function settings_toml #
lsdocs' own plugins' loader: lsdocs/<name>/settings.toml, as TOML.
function settings_toml_as #
settings_toml, checked against T (unknown or bad keys are an
error naming the file): a loader for plugins with a settings type.
enum Kind #
What a setting's value must be (see settings_toml_keys).
Trait implementations
variant Bool #
Booltrue or false.
variant Integer #
IntegerA whole number.
variant String #
StringA string.
variant Array #
ArrayAn array.
variant Table #
TableA table.
variant Any #
AnyAnything.
function settings_toml_keys #
settings_toml, with only keys allowed, each of its kind (any
other key, or a value of another kind, is an error naming the file): a
loader for plugins reading a few keys.
function parse #
Reads settings (as a loader returned them) into a type, null being
its default; an unknown or bad key is an error naming file.