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

fn oxlContractRoundtrip

x as an old peer of the contract test's old schema reads it and writes it back (D-7071): fields and variants the old schema does not know are dropped. Panics when the old peer cannot read the value or the new reader cannot read its answer.

Example:

oxl✓ проверяется в CI
data Person {
  id: i64
  name: str
}

test contract "old readers understand Person" with schema(old: "published") as old {
  let p = Person{ id: 1, name: "ann" }
  assert_eq(old.roundtrip(p), p)
}
@intrinsic("test.contractRoundtrip") pub(api) fn oxlContractRoundtrip<T: Serializable>(x: &T) -> T

С версии. 1.0.0-beta

Параметры

ИмяТип
x&T

Возвращает

T

Эффекты

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

Определено в: std/core/testing.oxl:358

См. также