From 495e6117a5616fd692e2db5a33da26ffad4b57c2 Mon Sep 17 00:00:00 2001 From: Gusarich Date: Sun, 29 Dec 2024 03:43:29 +0300 Subject: [PATCH] feat(docs): cover `fromCell()` --- docs/src/content/docs/book/maps.mdx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/src/content/docs/book/maps.mdx b/docs/src/content/docs/book/maps.mdx index 4183465de..6823b034d 100644 --- a/docs/src/content/docs/book/maps.mdx +++ b/docs/src/content/docs/book/maps.mdx @@ -360,6 +360,21 @@ contract Example { } ``` +### Convert from a `Cell`, `.fromCell()` {#fromcell} + +

+ +To convert a [`Cell{:tact}`][cell] type back to a map, use the `.fromCell(){:tact}` [method](/book/functions#extension-function). + +```tact +// Suppose we have a Cell +let cell: Cell = ...; + +// And we want to initialize a map variable from it +let fizz: map = emptyMap(); +fizz.fromCell(cell); +``` + ### Traverse over entries {#traverse} To iterate over map entries there is a [`foreach{:tact}`](/book/statements#foreach-loop) loop statement: