def to_json

cswap-bend-cli@0.1.0.0 · profile.bend:265

import cswap-bend-cli@0.1.0.0/profile.bend as Profile
import Base
import cswap-bend-cli@0.1.0.0/json.bend as Json
import cswap-bend-cli@0.1.0.0/policy/safe.bend as SF

265# The profile as a JSON object laid over `base` (the stored object, so keys we
266# do not know survive).
267def to_json(+p: Prof, +base: Json.Json) -> Json.Json:
268  match p:
269    case Prof{n, algo, th, ms, cd, iv}:
270      opt_set("interval_s", num_json(iv), opt_set("cooldown_s", num_json(cd), opt_set("models", models_json(ms), opt_set("threshold", num_json(th), Json.set("strategy", Json.JStr{SF.name(algo)}, base)))))

Uses (7)

Used by (2)