OxL Справочник OxL
РусскийEnglish

method DynHandle.rollback

Undoes the latest change (of layer when given) or, with to, goes back to the state after that version (layer: only that layer; none: every layer). A rollback is a new version.

Example:

oxl✓ проверяется в CI
dynamic Limits {
  rps: u32 = 100
  title: str = "shop"
}

fn main() io {
  let l = Limits.get()
  l.rps.set(500)!
  l.rps.set(700)!
  l.rps.rollback()!
  print("{l.rps.get()}")
}
Вывод
500
pub(api) fn rollback(to: u64 = 0, layer: DynScope? = none) -> () | DynError

С версии. 1.0.0-beta

Параметры

ИмяТип
tou64 = 0
layerDynScope? = none

Возвращает

()

Ошибки

  • DynError @error
  • `DynError` when the policy of the config refuses the caller, or there is nothing to roll back.

Эффекты

не объявлены (чистая, пока тело не говорит иное)

Определено в: std/core/dynconf.oxl:653

См. также