We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d7181c3 commit de87771Copy full SHA for de87771
contracts/utils/structs/CircularBuffer.sol
@@ -34,9 +34,19 @@ import {Panic} from "../Panic.sol";
34
*
35
* // Declare a buffer storage variable
36
* CircularBuffer.Bytes32CircularBuffer private myBuffer;
37
+ *
38
+ * constructor() {
39
+ * myBuffer.setup(16); // Initialize the buffer with a non-zero fixed size (e.g., 16)
40
+ * }
41
42
+ * function pushValue(bytes32 value) external {
43
+ * myBuffer.push(value); // Safe to push because the buffer was initialized in the constructor
44
45
* }
46
* ```
47
48
+ * NOTE: Make sure to call {setup} on your buffer during construction/initialization
49
50
* _Available since v5.1._
51
*/
52
library CircularBuffer {
0 commit comments