From 3e906060a88a6929c40b7170e73e7adf9e84a8a8 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Sat, 6 May 2023 16:03:18 +0200 Subject: [PATCH] docs: Add inline anchors for direct linking to GVariant types --- docs/writing-modules.adoc | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/writing-modules.adoc b/docs/writing-modules.adoc index d8d69e828..a0fcc3a3f 100644 --- a/docs/writing-modules.adoc +++ b/docs/writing-modules.adoc @@ -77,12 +77,12 @@ foo.bar = { + would place `c` before `b` and after `a` in the graph. -`hm.types.gvariant`:: +[[sec-option-types-gvariant]]`hm.types.gvariant`:: This type is useful for options representing {gvariant-description}[GVariant] values. The type accepts all primitive GVariant types as well as arrays and tuples. Dictionaries are not currently supported. + To create a GVariant value you can use a number of provided functions. Examples assume an option `foo.bar` of type `hm.types.gvariant`. + -`hm.gvariant.mkBoolean (v: bool)`::: +[[sec-option-types-gvariant-mkBoolean]]`hm.gvariant.mkBoolean (v: bool)`::: Takes a Nix value `v` to a GVariant `boolean` value. Note, Nix booleans are automatically coerced using this function. That is, + [source,nix] @@ -96,7 +96,7 @@ is equivalent to ---- foo.bar = true; ---- -`hm.gvariant.mkString (v: string)`::: +[[sec-option-types-gvariant-mkString]]`hm.gvariant.mkString (v: string)`::: Takes a Nix value `v` to a GVariant `string` value. Note, Nix strings are automatically coerced using this function. That is, + [source,nix] @@ -110,15 +110,15 @@ is equivalent to ---- foo.bar = "a string"; ---- -`hm.gvariant.mkObjectpath (v: string)`::: +[[sec-option-types-gvariant-mkObjectpath]]`hm.gvariant.mkObjectpath (v: string)`::: Takes a Nix value `v` to a GVariant `objectpath` value. -`hm.gvariant.mkUchar (v: string)`::: +[[sec-option-types-gvariant-mkUchar]]`hm.gvariant.mkUchar (v: string)`::: Takes a Nix value `v` to a GVariant `uchar` value. -`hm.gvariant.mkInt16 (v: int)`::: +[[sec-option-types-gvariant-mkInt16]]`hm.gvariant.mkInt16 (v: int)`::: Takes a Nix value `v` to a GVariant `int16` value. -`hm.gvariant.mkUint16 (v: int)`::: +[[sec-option-types-gvariant-mkUint16]]`hm.gvariant.mkUint16 (v: int)`::: Takes a Nix value `v` to a GVariant `uint16` value. -`hm.gvariant.mkInt32 (v: int)`::: +[[sec-option-types-gvariant-mkInt32]]`hm.gvariant.mkInt32 (v: int)`::: Takes a Nix value `v` to a GVariant `int32` value. Note, Nix integers are automatically coerced using this function. That is, + [source,nix] @@ -132,13 +132,13 @@ is equivalent to ---- foo.bar = 7; ---- -`hm.gvariant.mkUint32 (v: int)`::: +[[sec-option-types-gvariant-mkUint32]]`hm.gvariant.mkUint32 (v: int)`::: Takes a Nix value `v` to a GVariant `uint32` value. -`hm.gvariant.mkInt64 (v: int)`::: +[[sec-option-types-gvariant-mkInt64]]`hm.gvariant.mkInt64 (v: int)`::: Takes a Nix value `v` to a GVariant `int64` value. -`hm.gvariant.mkUint64 (v: int)`::: +[[sec-option-types-gvariant-mkUint64]]`hm.gvariant.mkUint64 (v: int)`::: Takes a Nix value `v` to a GVariant `uint64` value. -`hm.gvariant.mkDouble (v: double)`::: +[[sec-option-types-gvariant-mkDouble]]`hm.gvariant.mkDouble (v: double)`::: Takes a Nix value `v` to a GVariant `double` value. Note, Nix floats are automatically coerced using this function. That is, + [source,nix] @@ -153,7 +153,7 @@ is equivalent to foo.bar = 3.14; ---- + -`hm.gvariant.mkArray type elements`::: +[[sec-option-types-gvariant-mkArray]]`hm.gvariant.mkArray type elements`::: Builds a GVariant array containing the given list of elements, where each element is a GVariant value of the given type. The `type` value can be constructed using + -- @@ -176,20 +176,20 @@ Builds a GVariant array containing the given list of elements, where each elemen + where `type` and `types` are themselves a type and list of types, respectively. + -`hm.gvariant.mkEmptyArray type`::: +[[sec-option-types-gvariant-mkEmptyArray]]`hm.gvariant.mkEmptyArray type`::: An alias of `hm.gvariant.mkArray type []`. + -`hm.gvariant.mkNothing type`::: +[[sec-option-types-gvariant-mkNothing]]`hm.gvariant.mkNothing type`::: Builds a GVariant maybe value whose (non-existent) element is of the given type. The `type` value is constructed as described for the `mkArray` function above. + -`hm.gvariant.mkJust element`::: +[[sec-option-types-gvariant-mkJust]]`hm.gvariant.mkJust element`::: Builds a GVariant maybe value containing the given GVariant element. + -`hm.gvariant.mkTuple elements`::: +[[sec-option-types-gvariant-mkTuple]]`hm.gvariant.mkTuple elements`::: Builds a GVariant tuple containing the given list of elements, where each element is a GVariant value. + -`hm.gvariant.mkVariant element`::: +[[sec-option-types-gvariant-mkVariant]]`hm.gvariant.mkVariant element`::: Builds a GVariant variant which contains the value of a GVariant element. + -`hm.gvariant.mkDictionaryEntry elements`::: +[[sec-option-types-gvariant-mkDictionaryEntry]]`hm.gvariant.mkDictionaryEntry elements`::: Builds a GVariant dictionary entry containing the given list of elements, where each element is a GVariant value.