OxL Reference

method DynHandle.set

Sets the override of layer (checked by policy Name { allow set if … } for a caller, the type and its refinements). The program's own code (no caller) may always set.

Example:

oxl✓ checked in CI
dynamic Limits {
  rps: u32 where 1..=1000 = 100
}

fn main() io {
  let l = Limits.get()
  l.rps.set(500)!
  print("{l.rps.get()}")
  print("{l.rps.check("5000") is DynError}")
}
Output
500
true
pub(api) fn set(v: T, layer: DynScope = .Global) -> () | DynError where T: Serializable

Since. 1.0.0-beta

Parameters

NameType
vT
layerDynScope = .Global

Returns

()

Errors

  • DynError where T: Serializable
  • `DynError` when the policy of the config refuses the caller, or the value violates a refinement of its type.

Effects

none declared (pure unless the body says otherwise)

Defined in: std/core/dynconf.oxl:543

See also