Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
fix: applied some suggestions from a code review
Browse files Browse the repository at this point in the history
  • Loading branch information
novusnota committed Aug 13, 2024
1 parent 1ef11fd commit 0b9b2a0
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions pages/book/cells.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,18 +128,25 @@ Similar to serialization options of [`Int{:tact}`](/book/integers) type, `Cell{:
* as fields of [contracts](/book/contracts) and [traits](/book/types#traits),
* and as fields of [Structs](/book/structs-and-messages#structs) and [Messages](/book/structs-and-messages#messages).

```tact
```tact {2-3}
contract SerializationExample {
someCell: Cell as remaining;
someSlice: Slice as bytes32;
// Constructor function,
// necessary for this example contract to compile
init() {
self.someCell = emptyCell();
self.someSlice = emptySlice();
}
}
```

### `remaining` [#serialization-remaining]

To illustrate what `remaining{:tact}` serialization type does, let's take a look at [cell manipulation primitives](#cells-immutability) and their [TL-B][tlb] representation produced by Tact:

```tact
```tact {3-5, 8-10}
contract SerializationExample {
// By default
cRef: Cell; // ^cell in TL-B
Expand All @@ -150,6 +157,17 @@ contract SerializationExample {
cRem: Cell as remaining; // remainder<cell> in TL-B
bRem: Builder as remaining; // remainder<builder> in TL-B
sRem: Slice as remaining; // remainder<slice> in TL-B
// Constructor function,
// necessary for this example contract to compile
init() {
self.cRef = emptyCell();
self.bRef = beginCell();
self.sRef = emptySlice();
self.cRem = emptyCell();
self.bRem = beginCell();
self.sRem = emptySlice();
}
}
```

Expand Down

0 comments on commit 0b9b2a0

Please sign in to comment.