1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="stylesheet" href="style.css" type="text/css">
<meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="Start" href="index.html">
<link rel="previous" href="Stdlib.Buffer.html">
<link rel="next" href="Stdlib.BytesLabels.html">
<link rel="Up" href="Stdlib.html">
<link title="Index of types" rel=Appendix href="index_types.html">
<link title="Index of extensions" rel=Appendix href="index_extensions.html">
<link title="Index of exceptions" rel=Appendix href="index_exceptions.html">
<link title="Index of values" rel=Appendix href="index_values.html">
<link title="Index of modules" rel=Appendix href="index_modules.html">
<link title="Index of module types" rel=Appendix href="index_module_types.html">
<link title="Arg" rel="Chapter" href="Arg.html">
<link title="Array" rel="Chapter" href="Array.html">
<link title="ArrayLabels" rel="Chapter" href="ArrayLabels.html">
<link title="Bigarray" rel="Chapter" href="Bigarray.html">
<link title="Bool" rel="Chapter" href="Bool.html">
<link title="Buffer" rel="Chapter" href="Buffer.html">
<link title="Bytes" rel="Chapter" href="Bytes.html">
<link title="BytesLabels" rel="Chapter" href="BytesLabels.html">
<link title="Callback" rel="Chapter" href="Callback.html">
<link title="CamlinternalFormat" rel="Chapter" href="CamlinternalFormat.html">
<link title="CamlinternalFormatBasics" rel="Chapter" href="CamlinternalFormatBasics.html">
<link title="CamlinternalLazy" rel="Chapter" href="CamlinternalLazy.html">
<link title="CamlinternalMod" rel="Chapter" href="CamlinternalMod.html">
<link title="CamlinternalOO" rel="Chapter" href="CamlinternalOO.html">
<link title="Char" rel="Chapter" href="Char.html">
<link title="Complex" rel="Chapter" href="Complex.html">
<link title="Condition" rel="Chapter" href="Condition.html">
<link title="Digest" rel="Chapter" href="Digest.html">
<link title="Dynlink" rel="Chapter" href="Dynlink.html">
<link title="Ephemeron" rel="Chapter" href="Ephemeron.html">
<link title="Event" rel="Chapter" href="Event.html">
<link title="Filename" rel="Chapter" href="Filename.html">
<link title="Float" rel="Chapter" href="Float.html">
<link title="Format" rel="Chapter" href="Format.html">
<link title="Fun" rel="Chapter" href="Fun.html">
<link title="Gc" rel="Chapter" href="Gc.html">
<link title="Genlex" rel="Chapter" href="Genlex.html">
<link title="Hashtbl" rel="Chapter" href="Hashtbl.html">
<link title="Int" rel="Chapter" href="Int.html">
<link title="Int32" rel="Chapter" href="Int32.html">
<link title="Int64" rel="Chapter" href="Int64.html">
<link title="Lazy" rel="Chapter" href="Lazy.html">
<link title="Lexing" rel="Chapter" href="Lexing.html">
<link title="List" rel="Chapter" href="List.html">
<link title="ListLabels" rel="Chapter" href="ListLabels.html">
<link title="Map" rel="Chapter" href="Map.html">
<link title="Marshal" rel="Chapter" href="Marshal.html">
<link title="MoreLabels" rel="Chapter" href="MoreLabels.html">
<link title="Mutex" rel="Chapter" href="Mutex.html">
<link title="Nativeint" rel="Chapter" href="Nativeint.html">
<link title="Obj" rel="Chapter" href="Obj.html">
<link title="Ocaml_operators" rel="Chapter" href="Ocaml_operators.html">
<link title="Oo" rel="Chapter" href="Oo.html">
<link title="Option" rel="Chapter" href="Option.html">
<link title="Parsing" rel="Chapter" href="Parsing.html">
<link title="Printexc" rel="Chapter" href="Printexc.html">
<link title="Printf" rel="Chapter" href="Printf.html">
<link title="Queue" rel="Chapter" href="Queue.html">
<link title="Random" rel="Chapter" href="Random.html">
<link title="Result" rel="Chapter" href="Result.html">
<link title="Scanf" rel="Chapter" href="Scanf.html">
<link title="Seq" rel="Chapter" href="Seq.html">
<link title="Set" rel="Chapter" href="Set.html">
<link title="Spacetime" rel="Chapter" href="Spacetime.html">
<link title="Stack" rel="Chapter" href="Stack.html">
<link title="StdLabels" rel="Chapter" href="StdLabels.html">
<link title="Stdlib" rel="Chapter" href="Stdlib.html">
<link title="Str" rel="Chapter" href="Str.html">
<link title="Stream" rel="Chapter" href="Stream.html">
<link title="String" rel="Chapter" href="String.html">
<link title="StringLabels" rel="Chapter" href="StringLabels.html">
<link title="Sys" rel="Chapter" href="Sys.html">
<link title="Thread" rel="Chapter" href="Thread.html">
<link title="ThreadUnix" rel="Chapter" href="ThreadUnix.html">
<link title="Uchar" rel="Chapter" href="Uchar.html">
<link title="Unit" rel="Chapter" href="Unit.html">
<link title="Unix" rel="Chapter" href="Unix.html">
<link title="UnixLabels" rel="Chapter" href="UnixLabels.html">
<link title="Weak" rel="Chapter" href="Weak.html"><link title="Unsafe conversions (for advanced users)" rel="Section" href="#unsafe">
<link title="Iterators" rel="Section" href="#1_Iterators">
<link title="Binary encoding/decoding of integers" rel="Section" href="#1_Binaryencodingdecodingofintegers">
<title>Stdlib.Bytes</title>
</head>
<body>
<div class="navbar"><a class="pre" href="Stdlib.Buffer.html" title="Stdlib.Buffer">Previous</a>
<a class="up" href="Stdlib.html" title="Stdlib">Up</a>
<a class="post" href="Stdlib.BytesLabels.html" title="Stdlib.BytesLabels">Next</a>
</div>
<h1>Module <a href="type_Stdlib.Bytes.html">Stdlib.Bytes</a></h1>
<pre><span id="MODULEBytes"><span class="keyword">module</span> Bytes</span>: <code class="type"><a href="Bytes.html">Bytes</a></code></pre><hr width="100%">
<pre><span id="VALlength"><span class="keyword">val</span> length</span> : <code class="type">bytes -> int</code></pre><div class="info ">
<div class="info-desc">
<p>Return the length (number of bytes) of the argument.</p>
</div>
</div>
<pre><span id="VALget"><span class="keyword">val</span> get</span> : <code class="type">bytes -> int -> char</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get s n</code> returns the byte at index <code class="code">n</code> in argument <code class="code">s</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">n</code> is not a valid index in <code class="code">s</code>.</li>
</ul>
</div>
<pre><span id="VALset"><span class="keyword">val</span> set</span> : <code class="type">bytes -> int -> char -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set s n c</code> modifies <code class="code">s</code> in place, replacing the byte at index <code class="code">n</code>
with <code class="code">c</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">n</code> is not a valid index in <code class="code">s</code>.</li>
</ul>
</div>
<pre><span id="VALcreate"><span class="keyword">val</span> create</span> : <code class="type">int -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">create n</code> returns a new byte sequence of length <code class="code">n</code>. The
sequence is uninitialized and contains arbitrary bytes.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">n < 0</code> or <code class="code">n > </code><a href="Sys.html#VALmax_string_length"><code class="code"><span class="constructor">Sys</span>.max_string_length</code></a>.</li>
</ul>
</div>
<pre><span id="VALmake"><span class="keyword">val</span> make</span> : <code class="type">int -> char -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">make n c</code> returns a new byte sequence of length <code class="code">n</code>, filled with
the byte <code class="code">c</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">n < 0</code> or <code class="code">n > </code><a href="Sys.html#VALmax_string_length"><code class="code"><span class="constructor">Sys</span>.max_string_length</code></a>.</li>
</ul>
</div>
<pre><span id="VALinit"><span class="keyword">val</span> init</span> : <code class="type">int -> (int -> char) -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code"><span class="constructor">Bytes</span>.init n f</code> returns a fresh byte sequence of length <code class="code">n</code>, with
character <code class="code">i</code> initialized to the result of <code class="code">f i</code> (in increasing
index order).</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">n < 0</code> or <code class="code">n > </code><a href="Sys.html#VALmax_string_length"><code class="code"><span class="constructor">Sys</span>.max_string_length</code></a>.</li>
</ul>
</div>
<pre><span id="VALempty"><span class="keyword">val</span> empty</span> : <code class="type">bytes</code></pre><div class="info ">
<div class="info-desc">
<p>A byte sequence of size 0.</p>
</div>
</div>
<pre><span id="VALcopy"><span class="keyword">val</span> copy</span> : <code class="type">bytes -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p>Return a new byte sequence that contains the same bytes as the
argument.</p>
</div>
</div>
<pre><span id="VALof_string"><span class="keyword">val</span> of_string</span> : <code class="type">string -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p>Return a new byte sequence that contains the same bytes as the
given string.</p>
</div>
</div>
<pre><span id="VALto_string"><span class="keyword">val</span> to_string</span> : <code class="type">bytes -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Return a new string that contains the same bytes as the given byte
sequence.</p>
</div>
</div>
<pre><span id="VALsub"><span class="keyword">val</span> sub</span> : <code class="type">bytes -> int -> int -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">sub s start len</code> returns a new byte sequence of length <code class="code">len</code>,
containing the subsequence of <code class="code">s</code> that starts at position <code class="code">start</code>
and has length <code class="code">len</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">start</code> and <code class="code">len</code> do not designate a
valid range of <code class="code">s</code>.</li>
</ul>
</div>
<pre><span id="VALsub_string"><span class="keyword">val</span> sub_string</span> : <code class="type">bytes -> int -> int -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <code class="code">sub</code> but return a string instead of a byte sequence.</p>
</div>
</div>
<pre><span id="VALextend"><span class="keyword">val</span> extend</span> : <code class="type">bytes -> int -> int -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">extend s left right</code> returns a new byte sequence that contains
the bytes of <code class="code">s</code>, with <code class="code">left</code> uninitialized bytes prepended and
<code class="code">right</code> uninitialized bytes appended to it. If <code class="code">left</code> or <code class="code">right</code>
is negative, then bytes are removed (instead of appended) from
the corresponding side of <code class="code">s</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if the result length is negative or
longer than <a href="Sys.html#VALmax_string_length"><code class="code"><span class="constructor">Sys</span>.max_string_length</code></a> bytes.</li>
</ul>
</div>
<pre><span id="VALfill"><span class="keyword">val</span> fill</span> : <code class="type">bytes -> int -> int -> char -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">fill s start len c</code> modifies <code class="code">s</code> in place, replacing <code class="code">len</code>
characters with <code class="code">c</code>, starting at <code class="code">start</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">start</code> and <code class="code">len</code> do not designate a
valid range of <code class="code">s</code>.</li>
</ul>
</div>
<pre><span id="VALblit"><span class="keyword">val</span> blit</span> : <code class="type">bytes -> int -> bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">blit src srcoff dst dstoff len</code> copies <code class="code">len</code> bytes from sequence
<code class="code">src</code>, starting at index <code class="code">srcoff</code>, to sequence <code class="code">dst</code>, starting at
index <code class="code">dstoff</code>. It works correctly even if <code class="code">src</code> and <code class="code">dst</code> are the
same byte sequence, and the source and destination intervals
overlap.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">srcoff</code> and <code class="code">len</code> do not
designate a valid range of <code class="code">src</code>, or if <code class="code">dstoff</code> and <code class="code">len</code>
do not designate a valid range of <code class="code">dst</code>.</li>
</ul>
</div>
<pre><span id="VALblit_string"><span class="keyword">val</span> blit_string</span> : <code class="type">string -> int -> bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">blit_string src srcoff dst dstoff len</code> copies <code class="code">len</code> bytes from
string <code class="code">src</code>, starting at index <code class="code">srcoff</code>, to byte sequence <code class="code">dst</code>,
starting at index <code class="code">dstoff</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">srcoff</code> and <code class="code">len</code> do not
designate a valid range of <code class="code">src</code>, or if <code class="code">dstoff</code> and <code class="code">len</code>
do not designate a valid range of <code class="code">dst</code>.</li>
</ul>
</div>
<pre><span id="VALconcat"><span class="keyword">val</span> concat</span> : <code class="type">bytes -> bytes list -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">concat sep sl</code> concatenates the list of byte sequences <code class="code">sl</code>,
inserting the separator byte sequence <code class="code">sep</code> between each, and
returns the result as a new byte sequence.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if the result is longer than
<a href="Sys.html#VALmax_string_length"><code class="code"><span class="constructor">Sys</span>.max_string_length</code></a> bytes.</li>
</ul>
</div>
<pre><span id="VALcat"><span class="keyword">val</span> cat</span> : <code class="type">bytes -> bytes -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">cat s1 s2</code> concatenates <code class="code">s1</code> and <code class="code">s2</code> and returns the result
as a new byte sequence.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if the result is longer than
<a href="Sys.html#VALmax_string_length"><code class="code"><span class="constructor">Sys</span>.max_string_length</code></a> bytes.</li>
</ul>
</div>
<pre><span id="VALiter"><span class="keyword">val</span> iter</span> : <code class="type">(char -> unit) -> bytes -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">iter f s</code> applies function <code class="code">f</code> in turn to all the bytes of <code class="code">s</code>.
It is equivalent to <code class="code">f (get s 0); f (get s 1); ...; f (get s<br>
(length s - 1)); ()</code>.</p>
</div>
</div>
<pre><span id="VALiteri"><span class="keyword">val</span> iteri</span> : <code class="type">(int -> char -> unit) -> bytes -> unit</code></pre><div class="info ">
<div class="info-desc">
<p>Same as <a href="Bytes.html#VALiter"><code class="code"><span class="constructor">Bytes</span>.iter</code></a>, but the function is applied to the index of
the byte as first argument and the byte itself as second
argument.</p>
</div>
</div>
<pre><span id="VALmap"><span class="keyword">val</span> map</span> : <code class="type">(char -> char) -> bytes -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">map f s</code> applies function <code class="code">f</code> in turn to all the bytes of <code class="code">s</code>
(in increasing index order) and stores the resulting bytes in
a new sequence that is returned as the result.</p>
</div>
</div>
<pre><span id="VALmapi"><span class="keyword">val</span> mapi</span> : <code class="type">(int -> char -> char) -> bytes -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">mapi f s</code> calls <code class="code">f</code> with each character of <code class="code">s</code> and its
index (in increasing index order) and stores the resulting bytes
in a new sequence that is returned as the result.</p>
</div>
</div>
<pre><span id="VALtrim"><span class="keyword">val</span> trim</span> : <code class="type">bytes -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p>Return a copy of the argument, without leading and trailing
whitespace. The bytes regarded as whitespace are the ASCII
characters <code class="code"><span class="string">' '</span></code>, <code class="code"><span class="string">'\012'</span></code>, <code class="code"><span class="string">'\n'</span></code>, <code class="code"><span class="string">'\r'</span></code>, and <code class="code"><span class="string">'\t'</span></code>.</p>
</div>
</div>
<pre><span id="VALescaped"><span class="keyword">val</span> escaped</span> : <code class="type">bytes -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p>Return a copy of the argument, with special characters represented
by escape sequences, following the lexical conventions of OCaml.
All characters outside the ASCII printable range (32..126) are
escaped, as well as backslash and double-quote.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if the result is longer than
<a href="Sys.html#VALmax_string_length"><code class="code"><span class="constructor">Sys</span>.max_string_length</code></a> bytes.</li>
</ul>
</div>
<pre><span id="VALindex"><span class="keyword">val</span> index</span> : <code class="type">bytes -> char -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">index s c</code> returns the index of the first occurrence of byte <code class="code">c</code>
in <code class="code">s</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Not_found</code> if <code class="code">c</code> does not occur in <code class="code">s</code>.</li>
</ul>
</div>
<pre><span id="VALindex_opt"><span class="keyword">val</span> index_opt</span> : <code class="type">bytes -> char -> int option</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">index_opt s c</code> returns the index of the first occurrence of byte <code class="code">c</code>
in <code class="code">s</code> or <code class="code"><span class="constructor">None</span></code> if <code class="code">c</code> does not occur in <code class="code">s</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>
<pre><span id="VALrindex"><span class="keyword">val</span> rindex</span> : <code class="type">bytes -> char -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">rindex s c</code> returns the index of the last occurrence of byte <code class="code">c</code>
in <code class="code">s</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Not_found</code> if <code class="code">c</code> does not occur in <code class="code">s</code>.</li>
</ul>
</div>
<pre><span id="VALrindex_opt"><span class="keyword">val</span> rindex_opt</span> : <code class="type">bytes -> char -> int option</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">rindex_opt s c</code> returns the index of the last occurrence of byte <code class="code">c</code>
in <code class="code">s</code> or <code class="code"><span class="constructor">None</span></code> if <code class="code">c</code> does not occur in <code class="code">s</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
</ul>
</div>
<pre><span id="VALindex_from"><span class="keyword">val</span> index_from</span> : <code class="type">bytes -> int -> char -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">index_from s i c</code> returns the index of the first occurrence of
byte <code class="code">c</code> in <code class="code">s</code> after position <code class="code">i</code>. <code class="code"><span class="constructor">Bytes</span>.index s c</code> is
equivalent to <code class="code"><span class="constructor">Bytes</span>.index_from s 0 c</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b><ul><li><code>Invalid_argument</code> if <code class="code">i</code> is not a valid position in <code class="code">s</code>.</li>
<li><code>Not_found</code> if <code class="code">c</code> does not occur in <code class="code">s</code> after position <code class="code">i</code>.</li>
</ul></li>
</ul>
</div>
<pre><span id="VALindex_from_opt"><span class="keyword">val</span> index_from_opt</span> : <code class="type">bytes -> int -> char -> int option</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">index_from_opt s i c</code> returns the index of the first occurrence of
byte <code class="code">c</code> in <code class="code">s</code> after position <code class="code">i</code> or <code class="code"><span class="constructor">None</span></code> if <code class="code">c</code> does not occur in <code class="code">s</code>
after position <code class="code">i</code>.
<code class="code"><span class="constructor">Bytes</span>.index_opt s c</code> is equivalent to <code class="code"><span class="constructor">Bytes</span>.index_from_opt s 0 c</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">i</code> is not a valid position in <code class="code">s</code>.</li>
</ul>
</div>
<pre><span id="VALrindex_from"><span class="keyword">val</span> rindex_from</span> : <code class="type">bytes -> int -> char -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">rindex_from s i c</code> returns the index of the last occurrence of
byte <code class="code">c</code> in <code class="code">s</code> before position <code class="code">i+1</code>. <code class="code">rindex s c</code> is equivalent
to <code class="code">rindex_from s (<span class="constructor">Bytes</span>.length s - 1) c</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b><ul><li><code>Invalid_argument</code> if <code class="code">i+1</code> is not a valid position in <code class="code">s</code>.</li>
<li><code>Not_found</code> if <code class="code">c</code> does not occur in <code class="code">s</code> before position <code class="code">i+1</code>.</li>
</ul></li>
</ul>
</div>
<pre><span id="VALrindex_from_opt"><span class="keyword">val</span> rindex_from_opt</span> : <code class="type">bytes -> int -> char -> int option</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">rindex_from_opt s i c</code> returns the index of the last occurrence
of byte <code class="code">c</code> in <code class="code">s</code> before position <code class="code">i+1</code> or <code class="code"><span class="constructor">None</span></code> if <code class="code">c</code> does not
occur in <code class="code">s</code> before position <code class="code">i+1</code>. <code class="code">rindex_opt s c</code> is equivalent to
<code class="code">rindex_from s (<span class="constructor">Bytes</span>.length s - 1) c</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.05</li>
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">i+1</code> is not a valid position in <code class="code">s</code>.</li>
</ul>
</div>
<pre><span id="VALcontains"><span class="keyword">val</span> contains</span> : <code class="type">bytes -> char -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">contains s c</code> tests if byte <code class="code">c</code> appears in <code class="code">s</code>.</p>
</div>
</div>
<pre><span id="VALcontains_from"><span class="keyword">val</span> contains_from</span> : <code class="type">bytes -> int -> char -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">contains_from s start c</code> tests if byte <code class="code">c</code> appears in <code class="code">s</code> after
position <code class="code">start</code>. <code class="code">contains s c</code> is equivalent to <code class="code">contains_from<br>
s 0 c</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">start</code> is not a valid position in <code class="code">s</code>.</li>
</ul>
</div>
<pre><span id="VALrcontains_from"><span class="keyword">val</span> rcontains_from</span> : <code class="type">bytes -> int -> char -> bool</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">rcontains_from s stop c</code> tests if byte <code class="code">c</code> appears in <code class="code">s</code> before
position <code class="code">stop+1</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Raises</b> <code>Invalid_argument</code> if <code class="code">stop < 0</code> or <code class="code">stop+1</code> is not a valid
position in <code class="code">s</code>.</li>
</ul>
</div>
<pre><span id="VALuppercase"><span class="keyword">val</span> uppercase</span> : <code class="type">bytes -> bytes</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Functions operating on Latin-1 character set are deprecated.</div>
<div class="info-desc">
<p>Return a copy of the argument, with all lowercase letters
translated to uppercase, including accented letters of the ISO
Latin-1 (8859-1) character set.</p>
</div>
</div>
<pre><span id="VALlowercase"><span class="keyword">val</span> lowercase</span> : <code class="type">bytes -> bytes</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Functions operating on Latin-1 character set are deprecated.</div>
<div class="info-desc">
<p>Return a copy of the argument, with all uppercase letters
translated to lowercase, including accented letters of the ISO
Latin-1 (8859-1) character set.</p>
</div>
</div>
<pre><span id="VALcapitalize"><span class="keyword">val</span> capitalize</span> : <code class="type">bytes -> bytes</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Functions operating on Latin-1 character set are deprecated.</div>
<div class="info-desc">
<p>Return a copy of the argument, with the first character set to uppercase,
using the ISO Latin-1 (8859-1) character set..</p>
</div>
</div>
<pre><span id="VALuncapitalize"><span class="keyword">val</span> uncapitalize</span> : <code class="type">bytes -> bytes</code></pre><div class="info ">
<div class="info-deprecated">
<span class="warning">Deprecated.</span>Functions operating on Latin-1 character set are deprecated.</div>
<div class="info-desc">
<p>Return a copy of the argument, with the first character set to lowercase,
using the ISO Latin-1 (8859-1) character set..</p>
</div>
</div>
<pre><span id="VALuppercase_ascii"><span class="keyword">val</span> uppercase_ascii</span> : <code class="type">bytes -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p>Return a copy of the argument, with all lowercase letters
translated to uppercase, using the US-ASCII character set.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>
<pre><span id="VALlowercase_ascii"><span class="keyword">val</span> lowercase_ascii</span> : <code class="type">bytes -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p>Return a copy of the argument, with all uppercase letters
translated to lowercase, using the US-ASCII character set.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>
<pre><span id="VALcapitalize_ascii"><span class="keyword">val</span> capitalize_ascii</span> : <code class="type">bytes -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p>Return a copy of the argument, with the first character set to uppercase,
using the US-ASCII character set.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>
<pre><span id="VALuncapitalize_ascii"><span class="keyword">val</span> uncapitalize_ascii</span> : <code class="type">bytes -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p>Return a copy of the argument, with the first character set to lowercase,
using the US-ASCII character set.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>
<pre><span id="TYPEt"><span class="keyword">type</span> <code class="type"></code>t</span> = <code class="type">bytes</code> </pre>
<div class="info ">
<div class="info-desc">
<p>An alias for the type of byte sequences.</p>
</div>
</div>
<pre><span id="VALcompare"><span class="keyword">val</span> compare</span> : <code class="type"><a href="Bytes.html#TYPEt">t</a> -> <a href="Bytes.html#TYPEt">t</a> -> int</code></pre><div class="info ">
<div class="info-desc">
<p>The comparison function for byte sequences, with the same
specification as <a href="Stdlib.html#VALcompare"><code class="code">compare</code></a>. Along with the type <code class="code">t</code>,
this function <code class="code">compare</code> allows the module <code class="code"><span class="constructor">Bytes</span></code> to be passed as
argument to the functors <a href="Set.Make.html"><code class="code"><span class="constructor">Set</span>.<span class="constructor">Make</span></code></a> and <a href="Map.Make.html"><code class="code"><span class="constructor">Map</span>.<span class="constructor">Make</span></code></a>.</p>
</div>
</div>
<pre><span id="VALequal"><span class="keyword">val</span> equal</span> : <code class="type"><a href="Bytes.html#TYPEt">t</a> -> <a href="Bytes.html#TYPEt">t</a> -> bool</code></pre><div class="info ">
<div class="info-desc">
<p>The equality function for byte sequences.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.03.0</li>
</ul>
</div>
<h2 id="unsafe">Unsafe conversions (for advanced users)</h2>
<p>This section describes unsafe, low-level conversion functions
between <code class="code">bytes</code> and <code class="code">string</code>. They do not copy the internal data;
used improperly, they can break the immutability invariant on
strings provided by the <code class="code">-safe-string</code> option. They are available for
expert library authors, but for most purposes you should use the
always-correct <a href="Bytes.html#VALto_string"><code class="code"><span class="constructor">Bytes</span>.to_string</code></a> and <a href="Bytes.html#VALof_string"><code class="code"><span class="constructor">Bytes</span>.of_string</code></a> instead.</p>
<pre><span id="VALunsafe_to_string"><span class="keyword">val</span> unsafe_to_string</span> : <code class="type">bytes -> string</code></pre><div class="info ">
<div class="info-desc">
<p>Unsafely convert a byte sequence into a string.</p>
<p>To reason about the use of <code class="code">unsafe_to_string</code>, it is convenient to
consider an "ownership" discipline. A piece of code that
manipulates some data "owns" it; there are several disjoint ownership
modes, including:</p>
<ul>
<li>Unique ownership: the data may be accessed and mutated</li>
<li>Shared ownership: the data has several owners, that may only
access it, not mutate it.</li>
</ul>
<p>Unique ownership is linear: passing the data to another piece of
code means giving up ownership (we cannot write the
data again). A unique owner may decide to make the data shared
(giving up mutation rights on it), but shared data may not become
uniquely-owned again.</p>
<p><code class="code">unsafe_to_string s</code> can only be used when the caller owns the byte
sequence <code class="code">s</code> -- either uniquely or as shared immutable data. The
caller gives up ownership of <code class="code">s</code>, and gains ownership of the
returned string.</p>
<p>There are two valid use-cases that respect this ownership
discipline:</p>
<p>1. Creating a string by initializing and mutating a byte sequence
that is never changed after initialization is performed.</p>
<pre class="codepre"><code class="code"><span class="keyword">let</span> string_init len f : string =
<span class="keyword">let</span> s = <span class="constructor">Bytes</span>.create len <span class="keyword">in</span>
<span class="keyword">for</span> i = 0 <span class="keyword">to</span> len - 1 <span class="keyword">do</span> <span class="constructor">Bytes</span>.set s i (f i) <span class="keyword">done</span>;
<span class="constructor">Bytes</span>.unsafe_to_string s
</code></pre>
<p>This function is safe because the byte sequence <code class="code">s</code> will never be
accessed or mutated after <code class="code">unsafe_to_string</code> is called. The
<code class="code">string_init</code> code gives up ownership of <code class="code">s</code>, and returns the
ownership of the resulting string to its caller.</p>
<p>Note that it would be unsafe if <code class="code">s</code> was passed as an additional
parameter to the function <code class="code">f</code> as it could escape this way and be
mutated in the future -- <code class="code">string_init</code> would give up ownership of
<code class="code">s</code> to pass it to <code class="code">f</code>, and could not call <code class="code">unsafe_to_string</code>
safely.</p>
<p>We have provided the <a href="String.html#VALinit"><code class="code"><span class="constructor">String</span>.init</code></a>, <a href="String.html#VALmap"><code class="code"><span class="constructor">String</span>.map</code></a> and
<a href="String.html#VALmapi"><code class="code"><span class="constructor">String</span>.mapi</code></a> functions to cover most cases of building
new strings. You should prefer those over <code class="code">to_string</code> or
<code class="code">unsafe_to_string</code> whenever applicable.</p>
<p>2. Temporarily giving ownership of a byte sequence to a function
that expects a uniquely owned string and returns ownership back, so
that we can mutate the sequence again after the call ended.</p>
<pre class="codepre"><code class="code"><span class="keyword">let</span> bytes_length (s : bytes) =
<span class="constructor">String</span>.length (<span class="constructor">Bytes</span>.unsafe_to_string s)
</code></pre>
<p>In this use-case, we do not promise that <code class="code">s</code> will never be mutated
after the call to <code class="code">bytes_length s</code>. The <a href="String.html#VALlength"><code class="code"><span class="constructor">String</span>.length</code></a> function
temporarily borrows unique ownership of the byte sequence
(and sees it as a <code class="code">string</code>), but returns this ownership back to
the caller, which may assume that <code class="code">s</code> is still a valid byte
sequence after the call. Note that this is only correct because we
know that <a href="String.html#VALlength"><code class="code"><span class="constructor">String</span>.length</code></a> does not capture its argument -- it could
escape by a side-channel such as a memoization combinator.</p>
<p>The caller may not mutate <code class="code">s</code> while the string is borrowed (it has
temporarily given up ownership). This affects concurrent programs,
but also higher-order functions: if <a href="String.html#VALlength"><code class="code"><span class="constructor">String</span>.length</code></a> returned
a closure to be called later, <code class="code">s</code> should not be mutated until this
closure is fully applied and returns ownership.</p>
</div>
</div>
<pre><span id="VALunsafe_of_string"><span class="keyword">val</span> unsafe_of_string</span> : <code class="type">string -> bytes</code></pre><div class="info ">
<div class="info-desc">
<p>Unsafely convert a shared string to a byte sequence that should
not be mutated.</p>
<p>The same ownership discipline that makes <code class="code">unsafe_to_string</code>
correct applies to <code class="code">unsafe_of_string</code>: you may use it if you were
the owner of the <code class="code">string</code> value, and you will own the return
<code class="code">bytes</code> in the same mode.</p>
<p>In practice, unique ownership of string values is extremely
difficult to reason about correctly. You should always assume
strings are shared, never uniquely owned.</p>
<p>For example, string literals are implicitly shared by the
compiler, so you never uniquely own them.</p>
<pre class="codepre"><code class="code"><span class="keyword">let</span> incorrect = <span class="constructor">Bytes</span>.unsafe_of_string <span class="string">"hello"</span>
<span class="keyword">let</span> s = <span class="constructor">Bytes</span>.of_string <span class="string">"hello"</span>
</code></pre>
<p>The first declaration is incorrect, because the string literal
<code class="code"><span class="string">"hello"</span></code> could be shared by the compiler with other parts of the
program, and mutating <code class="code">incorrect</code> is a bug. You must always use
the second version, which performs a copy and is thus correct.</p>
<p>Assuming unique ownership of strings that are not string
literals, but are (partly) built from string literals, is also
incorrect. For example, mutating <code class="code">unsafe_of_string (<span class="string">"foo"</span> ^ s)</code>
could mutate the shared string <code class="code"><span class="string">"foo"</span></code> -- assuming a rope-like
representation of strings. More generally, functions operating on
strings will assume shared ownership, they do not preserve unique
ownership. It is thus incorrect to assume unique ownership of the
result of <code class="code">unsafe_of_string</code>.</p>
<p>The only case we have reasonable confidence is safe is if the
produced <code class="code">bytes</code> is shared -- used as an immutable byte
sequence. This is possibly useful for incremental migration of
low-level programs that manipulate immutable sequences of bytes
(for example <a href="Marshal.html#VALfrom_bytes"><code class="code"><span class="constructor">Marshal</span>.from_bytes</code></a>) and previously used the
<code class="code">string</code> type for this purpose.</p>
</div>
</div>
<h2 id="1_Iterators">Iterators</h2>
<pre><span id="VALto_seq"><span class="keyword">val</span> to_seq</span> : <code class="type"><a href="Bytes.html#TYPEt">t</a> -> char <a href="Seq.html#TYPEt">Seq.t</a></code></pre><div class="info ">
<div class="info-desc">
<p>Iterate on the string, in increasing index order. Modifications of the
string during iteration will be reflected in the iterator.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.07</li>
</ul>
</div>
<pre><span id="VALto_seqi"><span class="keyword">val</span> to_seqi</span> : <code class="type"><a href="Bytes.html#TYPEt">t</a> -> (int * char) <a href="Seq.html#TYPEt">Seq.t</a></code></pre><div class="info ">
<div class="info-desc">
<p>Iterate on the string, in increasing order, yielding indices along chars</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.07</li>
</ul>
</div>
<pre><span id="VALof_seq"><span class="keyword">val</span> of_seq</span> : <code class="type">char <a href="Seq.html#TYPEt">Seq.t</a> -> <a href="Bytes.html#TYPEt">t</a></code></pre><div class="info ">
<div class="info-desc">
<p>Create a string from the generator</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.07</li>
</ul>
</div>
<h2 id="1_Binaryencodingdecodingofintegers">Binary encoding/decoding of integers</h2><p>The functions in this section binary encode and decode integers to
and from byte sequences.</p>
<p>All following functions raise <code class="code"><span class="constructor">Invalid_argument</span></code> if the space
needed at index <code class="code">i</code> to decode or encode the integer is not
available.</p>
<p>Little-endian (resp. big-endian) encoding means that least
(resp. most) significant bytes are stored first. Big-endian is
also known as network byte order. Native-endian encoding is
either little-endian or big-endian depending on <a href="Sys.html#VALbig_endian"><code class="code"><span class="constructor">Sys</span>.big_endian</code></a>.</p>
<p>32-bit and 64-bit integers are represented by the <code class="code">int32</code> and
<code class="code">int64</code> types, which can be interpreted either as signed or
unsigned numbers.</p>
<p>8-bit and 16-bit integers are represented by the <code class="code">int</code> type,
which has more bits than the binary encoding. These extra bits
are handled as follows:</p>
<ul>
<li>Functions that decode signed (resp. unsigned) 8-bit or 16-bit
integers represented by <code class="code">int</code> values sign-extend
(resp. zero-extend) their result.</li>
<li>Functions that encode 8-bit or 16-bit integers represented by
<code class="code">int</code> values truncate their input to their least significant
bytes.</li>
</ul>
<pre><span id="VALget_uint8"><span class="keyword">val</span> get_uint8</span> : <code class="type">bytes -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_uint8 b i</code> is <code class="code">b</code>'s unsigned 8-bit integer starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALget_int8"><span class="keyword">val</span> get_int8</span> : <code class="type">bytes -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_int8 b i</code> is <code class="code">b</code>'s signed 8-bit integer starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALget_uint16_ne"><span class="keyword">val</span> get_uint16_ne</span> : <code class="type">bytes -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_uint16_ne b i</code> is <code class="code">b</code>'s native-endian unsigned 16-bit integer
starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALget_uint16_be"><span class="keyword">val</span> get_uint16_be</span> : <code class="type">bytes -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_uint16_be b i</code> is <code class="code">b</code>'s big-endian unsigned 16-bit integer
starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALget_uint16_le"><span class="keyword">val</span> get_uint16_le</span> : <code class="type">bytes -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_uint16_le b i</code> is <code class="code">b</code>'s little-endian unsigned 16-bit integer
starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALget_int16_ne"><span class="keyword">val</span> get_int16_ne</span> : <code class="type">bytes -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_int16_ne b i</code> is <code class="code">b</code>'s native-endian signed 16-bit integer
starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALget_int16_be"><span class="keyword">val</span> get_int16_be</span> : <code class="type">bytes -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_int16_be b i</code> is <code class="code">b</code>'s big-endian signed 16-bit integer
starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALget_int16_le"><span class="keyword">val</span> get_int16_le</span> : <code class="type">bytes -> int -> int</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_int16_le b i</code> is <code class="code">b</code>'s little-endian signed 16-bit integer
starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALget_int32_ne"><span class="keyword">val</span> get_int32_ne</span> : <code class="type">bytes -> int -> int32</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_int32_ne b i</code> is <code class="code">b</code>'s native-endian 32-bit integer
starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALget_int32_be"><span class="keyword">val</span> get_int32_be</span> : <code class="type">bytes -> int -> int32</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_int32_be b i</code> is <code class="code">b</code>'s big-endian 32-bit integer
starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALget_int32_le"><span class="keyword">val</span> get_int32_le</span> : <code class="type">bytes -> int -> int32</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_int32_le b i</code> is <code class="code">b</code>'s little-endian 32-bit integer
starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALget_int64_ne"><span class="keyword">val</span> get_int64_ne</span> : <code class="type">bytes -> int -> int64</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_int64_ne b i</code> is <code class="code">b</code>'s native-endian 64-bit integer
starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALget_int64_be"><span class="keyword">val</span> get_int64_be</span> : <code class="type">bytes -> int -> int64</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_int64_be b i</code> is <code class="code">b</code>'s big-endian 64-bit integer
starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALget_int64_le"><span class="keyword">val</span> get_int64_le</span> : <code class="type">bytes -> int -> int64</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">get_int64_le b i</code> is <code class="code">b</code>'s little-endian 64-bit integer
starting at byte index <code class="code">i</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_uint8"><span class="keyword">val</span> set_uint8</span> : <code class="type">bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_uint8 b i v</code> sets <code class="code">b</code>'s unsigned 8-bit integer starting at byte index
<code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_int8"><span class="keyword">val</span> set_int8</span> : <code class="type">bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_int8 b i v</code> sets <code class="code">b</code>'s signed 8-bit integer starting at byte index
<code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_uint16_ne"><span class="keyword">val</span> set_uint16_ne</span> : <code class="type">bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_uint16_ne b i v</code> sets <code class="code">b</code>'s native-endian unsigned 16-bit integer
starting at byte index <code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_uint16_be"><span class="keyword">val</span> set_uint16_be</span> : <code class="type">bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_uint16_be b i v</code> sets <code class="code">b</code>'s big-endian unsigned 16-bit integer
starting at byte index <code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_uint16_le"><span class="keyword">val</span> set_uint16_le</span> : <code class="type">bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_uint16_le b i v</code> sets <code class="code">b</code>'s little-endian unsigned 16-bit integer
starting at byte index <code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_int16_ne"><span class="keyword">val</span> set_int16_ne</span> : <code class="type">bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_int16_ne b i v</code> sets <code class="code">b</code>'s native-endian signed 16-bit integer
starting at byte index <code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_int16_be"><span class="keyword">val</span> set_int16_be</span> : <code class="type">bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_int16_be b i v</code> sets <code class="code">b</code>'s big-endian signed 16-bit integer
starting at byte index <code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_int16_le"><span class="keyword">val</span> set_int16_le</span> : <code class="type">bytes -> int -> int -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_int16_le b i v</code> sets <code class="code">b</code>'s little-endian signed 16-bit integer
starting at byte index <code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_int32_ne"><span class="keyword">val</span> set_int32_ne</span> : <code class="type">bytes -> int -> int32 -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_int32_ne b i v</code> sets <code class="code">b</code>'s native-endian 32-bit integer
starting at byte index <code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_int32_be"><span class="keyword">val</span> set_int32_be</span> : <code class="type">bytes -> int -> int32 -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_int32_be b i v</code> sets <code class="code">b</code>'s big-endian 32-bit integer
starting at byte index <code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_int32_le"><span class="keyword">val</span> set_int32_le</span> : <code class="type">bytes -> int -> int32 -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_int32_le b i v</code> sets <code class="code">b</code>'s little-endian 32-bit integer
starting at byte index <code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_int64_ne"><span class="keyword">val</span> set_int64_ne</span> : <code class="type">bytes -> int -> int64 -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_int64_ne b i v</code> sets <code class="code">b</code>'s native-endian 64-bit integer
starting at byte index <code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_int64_be"><span class="keyword">val</span> set_int64_be</span> : <code class="type">bytes -> int -> int64 -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_int64_be b i v</code> sets <code class="code">b</code>'s big-endian 64-bit integer
starting at byte index <code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
<pre><span id="VALset_int64_le"><span class="keyword">val</span> set_int64_le</span> : <code class="type">bytes -> int -> int64 -> unit</code></pre><div class="info ">
<div class="info-desc">
<p><code class="code">set_int64_le b i v</code> sets <code class="code">b</code>'s little-endian 64-bit integer
starting at byte index <code class="code">i</code> to <code class="code">v</code>.</p>
</div>
<ul class="info-attributes">
<li><b>Since</b> 4.08</li>
</ul>
</div>
</body></html>
|