package oasis

  1. Overview
  2. Docs

This module defines a field that hold a value. A field can be set and retrieve. It is stored in Data.t.

type ('a, 'b, 'c) t

A field.

val create : ?schema:('a, 'b) Schema.t -> ?name:name -> ?parse:(?context:'a -> string -> 'c) -> ?print:('c -> string) -> ?default:'c -> ?update:(?context:'a -> 'c -> 'c -> 'c) -> ?help:(unit -> string) -> 'b -> ('a, 'c, 'b) t

Create a field, and optionally attached it to a schema.

val fset : Data.t -> ('a, 'b, 'c) t -> ?context:'a -> 'b -> unit

Store a field in a Data.t.

val fget : Data.t -> ('a, 'b, 'c) t -> 'b

Retrieve a field from a Data.t.

val fsets : Data.t -> ('a, 'b, 'c) t -> ?context:'a -> string -> unit

Same as Field.fset but parses a string to get the value.

val fgets : Data.t -> ('a, 'b, 'c) t -> string

Same as Field.fget but applies a printer to the value returned.