Skip to content

lib.gvariant: GVariant formatted string serialization functions

A partial and basic implementation of GVariant formatted strings. See GVariant Format Strings for details.

Warning

This API is not considered fully stable and it might therefore change in backwards incompatible ways without prior notice.

lib.gvariant.isGVariant

Check if a value is a GVariant value

Inputs

v

: value to check

Type

isGVariant :: Any -> Bool

Located at lib/gvariant.nix:65 in <nixpkgs>.

lib.gvariant.mkValue

Returns the GVariant value that most closely matches the given Nix value. If no GVariant value can be found unambiguously then error is thrown.

Inputs

v

: 1. Function argument

Type

mkValue :: Any -> gvariant

Located at lib/gvariant.nix:131 in <nixpkgs>.

lib.gvariant.mkArray

Returns the GVariant array from the given type of the elements and a Nix list.

Inputs

elems

: 1. Function argument

Type

mkArray :: [Any] -> gvariant

Examples

lib.gvariant.mkArray usage example

# Creating a string array
lib.gvariant.mkArray [ "a" "b" "c" ]

Located at lib/gvariant.nix:184 in <nixpkgs>.

lib.gvariant.mkEmptyArray

Returns the GVariant array from the given empty Nix list.

Inputs

elemType

: 1. Function argument

Type

mkEmptyArray :: gvariant.type -> gvariant

Examples

lib.gvariant.mkEmptyArray usage example

# Creating an empty string array
lib.gvariant.mkEmptyArray (lib.gvariant.type.string)

Located at lib/gvariant.nix:223 in <nixpkgs>.

lib.gvariant.mkVariant

Returns the GVariant variant from the given Nix value. Variants are containers of different GVariant type.

Inputs

elem

: 1. Function argument

Type

mkVariant :: Any -> gvariant

Examples

lib.gvariant.mkVariant usage example

lib.gvariant.mkArray [
  (lib.gvariant.mkVariant "a string")
  (lib.gvariant.mkVariant (lib.gvariant.mkInt32 1))
]

Located at lib/gvariant.nix:258 in <nixpkgs>.

lib.gvariant.mkDictionaryEntry

Returns the GVariant dictionary entry from the given key and value.

Inputs

name

: The key of the entry

value

: The value of the entry

Type

mkDictionaryEntry :: String -> Any -> gvariant

Examples

lib.gvariant.mkDictionaryEntry usage example

# A dictionary describing an Epiphany’s search provider
[
  (lib.gvariant.mkDictionaryEntry "url" (lib.gvariant.mkVariant "https://duckduckgo.com/?q=%s&t=epiphany"))
  (lib.gvariant.mkDictionaryEntry "bang" (lib.gvariant.mkVariant "!d"))
  (lib.gvariant.mkDictionaryEntry "name" (lib.gvariant.mkVariant "DuckDuckGo"))
]

Located at lib/gvariant.nix:299 in <nixpkgs>.

lib.gvariant.mkMaybe

Returns the GVariant maybe from the given element type.

Inputs

elemType

: 1. Function argument

elem

: 2. Function argument

Type

mkMaybe :: gvariant.type -> Any -> gvariant

Located at lib/gvariant.nix:331 in <nixpkgs>.

lib.gvariant.mkNothing

Returns the GVariant nothing from the given element type.

Inputs

elemType

: 1. Function argument

Type

mkNothing :: gvariant.type -> gvariant

Located at lib/gvariant.nix:356 in <nixpkgs>.

lib.gvariant.mkJust

Returns the GVariant just from the given Nix value.

Inputs

elem

: 1. Function argument

Type

mkJust :: Any -> gvariant

Located at lib/gvariant.nix:374 in <nixpkgs>.

lib.gvariant.mkTuple

Returns the GVariant tuple from the given Nix list.

Inputs

elems

: 1. Function argument

Type

mkTuple :: [Any] -> gvariant

Located at lib/gvariant.nix:392 in <nixpkgs>.

lib.gvariant.mkBoolean

Returns the GVariant boolean from the given Nix bool value.

Inputs

v

: 1. Function argument

Type

mkBoolean :: Bool -> gvariant

Located at lib/gvariant.nix:418 in <nixpkgs>.

lib.gvariant.mkString

Returns the GVariant string from the given Nix string value.

Inputs

v

: 1. Function argument

Type

mkString :: String -> gvariant

Located at lib/gvariant.nix:439 in <nixpkgs>.

lib.gvariant.mkObjectpath

Returns the GVariant object path from the given Nix string value.

Inputs

v

: 1. Function argument

Type

mkObjectpath :: String -> gvariant

Located at lib/gvariant.nix:461 in <nixpkgs>.

lib.gvariant.mkUchar

Returns the GVariant uchar from the given Nix int value.

Type

mkUchar :: Int -> gvariant

Located at lib/gvariant.nix:475 in <nixpkgs>.

lib.gvariant.mkInt16

Returns the GVariant int16 from the given Nix int value.

Type

mkInt16 :: Int -> gvariant

Located at lib/gvariant.nix:486 in <nixpkgs>.

lib.gvariant.mkUint16

Returns the GVariant uint16 from the given Nix int value.

Type

mkUint16 :: Int -> gvariant

Located at lib/gvariant.nix:497 in <nixpkgs>.

lib.gvariant.mkInt32

Returns the GVariant int32 from the given Nix int value.

Inputs

v

: 1. Function argument

Type

mkInt32 :: Int -> gvariant

Located at lib/gvariant.nix:515 in <nixpkgs>.

lib.gvariant.mkUint32

Returns the GVariant uint32 from the given Nix int value.

Type

mkUint32 :: Int -> gvariant

Located at lib/gvariant.nix:529 in <nixpkgs>.

lib.gvariant.mkInt64

Returns the GVariant int64 from the given Nix int value.

Type

mkInt64 :: Int -> gvariant

Located at lib/gvariant.nix:540 in <nixpkgs>.

lib.gvariant.mkUint64

Returns the GVariant uint64 from the given Nix int value.

Type

mkUint64 :: Int -> gvariant

Located at lib/gvariant.nix:551 in <nixpkgs>.

lib.gvariant.mkDouble

Returns the GVariant double from the given Nix float value.

Inputs

v

: 1. Function argument

Type

mkDouble :: Float -> gvariant

Located at lib/gvariant.nix:569 in <nixpkgs>.