Skip to content

Commit 0e1932e

Browse files
V12 docs
1 parent d634989 commit 0e1932e

File tree

99 files changed

+2273
-17070
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+2273
-17070
lines changed

data/api/latest/belt.json

Lines changed: 455 additions & 230 deletions
Large diffs are not rendered by default.

data/api/latest/core.json

Lines changed: 98 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2041,6 +2041,76 @@
20412041
}
20422042
]
20432043
},
2044+
"core/int/bitwise": {
2045+
"id": "Core.Int.Bitwise",
2046+
"name": "Bitwise",
2047+
"docstrings": [],
2048+
"items": [
2049+
{
2050+
"id": "Core.Int.Bitwise.land",
2051+
"kind": "value",
2052+
"name": "land",
2053+
"docstrings": [
2054+
"`land(n1, n2)` calculates the bitwise logical AND of two integers.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.land(7, 4) == 4\n ```"
2055+
],
2056+
"signature": "let land: (int, int) => int"
2057+
},
2058+
{
2059+
"id": "Core.Int.Bitwise.lor",
2060+
"kind": "value",
2061+
"name": "lor",
2062+
"docstrings": [
2063+
"`lor(n1, n2)` calculates the bitwise logical OR of two integers.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.lor(7, 4) == 7\n ```"
2064+
],
2065+
"signature": "let lor: (int, int) => int"
2066+
},
2067+
{
2068+
"id": "Core.Int.Bitwise.lxor",
2069+
"kind": "value",
2070+
"name": "lxor",
2071+
"docstrings": [
2072+
"`lxor(n1, n2)` calculates the bitwise logical XOR of two integers.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.lxor(7, 4) == 3\n ```"
2073+
],
2074+
"signature": "let lxor: (int, int) => int"
2075+
},
2076+
{
2077+
"id": "Core.Int.Bitwise.lnot",
2078+
"kind": "value",
2079+
"name": "lnot",
2080+
"docstrings": [
2081+
"`lnot(n)` calculates the bitwise logical NOT of an integer.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.lnot(2) == -3\n ```"
2082+
],
2083+
"signature": "let lnot: int => int"
2084+
},
2085+
{
2086+
"id": "Core.Int.Bitwise.lsl",
2087+
"kind": "value",
2088+
"name": "lsl",
2089+
"docstrings": [
2090+
"`lsl(n, length)` calculates the bitwise logical left shift of an integer `n` by `length`.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.lsl(4, 1) == 8\n ```"
2091+
],
2092+
"signature": "let lsl: (int, int) => int"
2093+
},
2094+
{
2095+
"id": "Core.Int.Bitwise.lsr",
2096+
"kind": "value",
2097+
"name": "lsr",
2098+
"docstrings": [
2099+
"`lsr(n, length)` calculates the bitwise logical right shift of an integer `n` by `length`.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.lsr(8, 1) == 4\n ```"
2100+
],
2101+
"signature": "let lsr: (int, int) => int"
2102+
},
2103+
{
2104+
"id": "Core.Int.Bitwise.asr",
2105+
"kind": "value",
2106+
"name": "asr",
2107+
"docstrings": [
2108+
"`asr(n, length)` calculates the bitwise arithmetic right shift of an integer `n` by `length`.\n\n ## Examples\n\n ```rescript\n Int.Bitwise.asr(4, 1) == 2\n ```"
2109+
],
2110+
"signature": "let asr: (int, int) => int"
2111+
}
2112+
]
2113+
},
20442114
"core/int/constants": {
20452115
"id": "Core.Int.Constants",
20462116
"name": "Constants",
@@ -4742,12 +4812,39 @@
47424812
"docstrings": [],
47434813
"signature": "type value<'a> = {done: bool, value: option<'a>}"
47444814
},
4815+
{
4816+
"id": "Core.AsyncIterator.make",
4817+
"kind": "value",
4818+
"name": "make",
4819+
"docstrings": [
4820+
"`make(nextFn)`\n\n Creates an async iterator from a function that returns the next value of the iterator.\n\n ## Examples\n - A simple example, creating an async iterator that returns 1, 2, 3:\n ```rescript\n let context = ref(0)\n\n let asyncIterator = AsyncIterator.make(async () => {\n let currentValue = context.contents\n // Increment current value\n context := currentValue + 1\n \n {\n AsyncIterator.value: Some(currentValue),\n done: currentValue >= 3\n }\n })\n\n // This will log 1, 2, 3\n await asyncIterator->AsyncIterator.forEach(value =>\n switch value {\n | Some(value) => Console.log(value)\n | None => ()\n }\n )\n ```"
4821+
],
4822+
"signature": "let make: (unit => promise<value<'value>>) => t<'value>"
4823+
},
4824+
{
4825+
"id": "Core.AsyncIterator.value",
4826+
"kind": "value",
4827+
"name": "value",
4828+
"docstrings": [
4829+
"`value(value)`\n\n Shorthand for creating a value object with the provided value, and the `done` property set to false.\n\n ## Examples\n ```rescript\n let context = ref(0)\n\n let asyncIterator = AsyncIterator.make(async () => {\n let currentValue = context.contents\n // Increment current value\n context := currentValue + 1\n \n if currentValue >= 3 {\n AsyncIterator.done()\n } else {\n AsyncIterator.value(currentValue)\n }\n })\n ```"
4830+
],
4831+
"signature": "let value: 'value => value<'value>"
4832+
},
4833+
{
4834+
"id": "Core.AsyncIterator.done",
4835+
"kind": "value",
4836+
"name": "done",
4837+
"docstrings": [
4838+
"`done(~finalValue=?)`\n\n Shorthand for creating a value object with the `done` property set to true, and the provided value as the final value, if any.\n\n ## Examples\n ```rescript\n let context = ref(0)\n\n let asyncIterator = AsyncIterator.make(async () => {\n let currentValue = context.contents\n // Increment current value\n context := currentValue + 1\n \n if currentValue >= 3 {\n AsyncIterator.done()\n } else {\n AsyncIterator.value(currentValue)\n }\n })\n ```"
4839+
],
4840+
"signature": "let done: (~finalValue: 'value=?) => value<'value>"
4841+
},
47454842
{
47464843
"id": "Core.AsyncIterator.next",
47474844
"kind": "value",
47484845
"name": "next",
47494846
"docstrings": [
4750-
"`next(asyncIterator)`\n\nReturns the next value of the iterator, if any.\n\nSee [async iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols) on MDN.\n\n## Examples\n- A simple example, getting the next value:\n```rescript\n@val external asyncIterator: AsyncIterator.t<int> = \"someAsyncIterator\"\nlet {AsyncIterator.done, value} = await asyncIterator->AsyncIterator.next\n```\n\n- Complete example, including looping over all values:\n```rescript\n// Let's pretend we get an async iterator returning ints from somewhere.\n@val external asyncIterator: AsyncIterator.t<int> = \"someAsyncIterator\"\n\n\nlet processMyAsyncIterator = async () => {\n // ReScript doesn't have `for ... of` loops, but it's easy to mimic using a while loop.\n let break = ref(false)\n\n while !break.contents {\n // Await the next iterator value\n let {value, done} = await asyncIterator->AsyncIterator.next\n\n // Exit the while loop if the iterator says it's done\n break := done\n\n // This will log the (int) value of the current async iteration, if a value was returned.\n Console.log(value)\n }\n}\n```"
4847+
"`next(asyncIterator)`\n\nReturns the next value of the iterator, if any.\n\nSee [async iterator protocols](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#the_async_iterator_and_async_iterable_protocols) on MDN.\n\n## Examples\n- A simple example, getting the next value:\n```rescript\n@val external asyncIterator: AsyncIterator.t<int> = \"someAsyncIterator\"\nlet value = await asyncIterator->AsyncIterator.next\n```\n\n- Complete example, including looping over all values:\n```rescript\n// Let's pretend we get an async iterator returning ints from somewhere.\n@val external asyncIterator: AsyncIterator.t<int> = \"someAsyncIterator\"\n\n\nlet processMyAsyncIterator = async () => {\n // ReScript doesn't have `for ... of` loops, but it's easy to mimic using a while loop.\n let break = ref(false)\n\n while !break.contents {\n // Await the next iterator value\n let {value, done} = await asyncIterator->AsyncIterator.next\n\n // Exit the while loop if the iterator says it's done\n break := done\n\n // This will log the (int) value of the current async iteration, if a value was returned.\n Console.log(value)\n }\n}\n```"
47514848
],
47524849
"signature": "let next: t<'a> => promise<value<'a>>"
47534850
},

0 commit comments

Comments
 (0)