You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/mainnet/smart-contracts/guides/no-std.rst
+29-14Lines changed: 29 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -37,46 +37,54 @@ You can update your `Cargo.toml` file by using:
37
37
.. code-block:: rust
38
38
39
39
[dependencies]
40
-
concordium-std = { version = "6.0", default-features = false }
40
+
concordium-std = { version = "10.0", default-features = false }
41
41
42
42
.. note::
43
43
44
44
To compile your smart contracts, a memory `allocator <https://docs.rs/concordium-std/6.0.0/concordium_std/#use-a-custom-allocator>`_ is used.
45
45
``concordium-std`` version ``<6.0.0`` hard-coded the use of the `wee_alloc <https://docs.rs/wee_alloc/>`_ allocator.
46
-
In ``concordium-std`` version ``>=6.0.0``, ``wee_alloc`` is a feature and needs to be explicitly enabled.
46
+
In ``concordium-std`` version in the range of ``>=6.0.0`` and ``<10.0.0``, ``wee_alloc`` is a feature and needs to be explicitly enabled.
47
+
In ``concordium-std`` version ``>=10.0.0``, `bump_alloc <https://docs.rs/concordium-std/10.0.0/concordium_std/#use-a-custom-allocator>`_ is a feature and needs to be explicitly enabled.
47
48
When ``std`` feature is enabled, the allocator provided by the Rust standard library is used
48
-
by default but when the ``wee_alloc`` feature is enabled in addition, `wee_alloc <https://docs.rs/wee_alloc/>`_ is used instead.
49
+
by default but when the ``wee_alloc``/``bump_alloc`` feature is enabled in addition, `bump_alloc <https://docs.rs/concordium-std/10.0.0/concordium_std/#use-a-custom-allocator>`_ ( or `wee_alloc <https://docs.rs/wee_alloc/>`_) is used instead.
49
50
50
-
You can enable the ``std`` feature and the ``wee_alloc`` feature in ``concordium-std`` version ``>=6.0.0`` by using:
51
+
You can enable the ``std`` feature and the ``wee_alloc`` feature in ``concordium-std`` version in the range of ``>=6.0.0`` and ``<10.0.0`` by using:
51
52
52
53
.. code-block:: rust
53
54
54
55
[dependencies]
55
56
concordium-std = {version = "6.0", features = ["wee_alloc"]}
56
57
57
-
Alternatively, if you want to test with and without ``wee_alloc`` enabled add a ``wee_alloc`` feature to the smart contract crate as follows:
58
+
You can enable the ``std`` feature and the ``bump_alloc`` feature in ``concordium-std`` version ``>=10.0.0`` by using:
59
+
60
+
.. code-block:: rust
61
+
62
+
[dependencies]
63
+
concordium-std = {version = "10.0", features = ["bump_alloc"]}
64
+
65
+
Alternatively, if you want to test with and without ``wee_alloc``/``bump_alloc`` enabled add a ``wee_alloc``/``bump_alloc`` feature to the smart contract crate as follows:
58
66
59
67
.. code-block:: rust
60
68
61
69
[features]
62
-
default = ["std", "wee_alloc"]
70
+
default = ["std", "bump_alloc"]
63
71
std = ["concordium-std/std"]
64
-
wee_alloc = ["concordium-std/wee_alloc"]
72
+
bump_alloc = ["concordium-std/bump_alloc"]
65
73
66
-
The above code blocks will use the `wee_alloc<https://docs.rs/wee_alloc/>`_ allocator and not the allocator
74
+
The above code blocks will use the `bump_alloc<https://docs.rs/concordium-std/10.0.0/concordium_std/#use-a-custom-allocator>`_ allocator and not the allocator
67
75
provided by the Rust standard library when compiled with the default features as follows:
68
76
69
77
.. code-block:: console
70
78
71
79
$cargo concordium build
72
80
73
-
When ``no_std`` is used either ``wee_alloc`` must be enabled, or another global allocator
74
-
must be set in the smart contract. You can add the ``wee_alloc`` feature by using:
81
+
When ``no_std`` is used either ``wee_alloc``/``bump_alloc`` must be enabled, or another global allocator
82
+
must be set in the smart contract. You can add the ``wee_alloc``/``bump_alloc`` feature by using e.g.:
75
83
76
84
.. code-block:: rust
77
85
78
86
[features]
79
-
wee_alloc = ["concordium-std/wee_alloc"]
87
+
bump_alloc = ["concordium-std/bump_alloc"]
80
88
81
89
To be able to toggle between with and without std, also add a ``std`` to your
82
90
own module, which enables the ``std`` feature of ``concordium-std``:
@@ -104,12 +112,19 @@ you can pass extra arguments for ``cargo``:
0 commit comments