MCPcopy Create free account
hub / github.com/argumentcomputer/ix / decode

Method decode

crates/ffi/src/ix/data.rs:38–46  ·  view source on GitHub ↗

Decode Ix.Int from Lean object. Ix.Int: ofNat (tag 0, 1 field) | negSucc (tag 1, 1 field)

(&self)

Source from the content-addressed store, hash-verified

36 /// Decode Ix.Int from Lean object.
37 /// Ix.Int: ofNat (tag 0, 1 field) | negSucc (tag 1, 1 field)
38 pub fn decode(&self) -> Int {
39 let ctor = self.as_ctor();
40 let nat = LeanNat::to_nat(&ctor.get(0));
41 match ctor.tag() {
42 0 => Int::OfNat(nat),
43 1 => Int::NegSucc(nat),
44 _ => panic!("Invalid Ix.Int tag: {}", ctor.tag()),
45 }
46 }
47}
48
49impl LeanIxSubstring<LeanOwned> {

Callers 6

rs_roundtrip_ix_intFunction · 0.45
rs_roundtrip_ix_syntaxFunction · 0.45

Calls 4

NodeClass · 0.85
tagMethod · 0.80
as_arrayMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected