942 lines
70 KiB
HTML
942 lines
70 KiB
HTML
|
<?xml version="1.0" encoding="utf-8" ?>
|
||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
||
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<!-- This file is generated by Nim. -->
|
||
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||
|
|
||
|
<!-- Favicon -->
|
||
|
<link rel="shortcut icon" href="data:image/x-icon;base64,AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAUAAAAF////AP///wD///8A////AP///wD///8A////AP///wD///8A////AAAAAAIAAABbAAAAlQAAAKIAAACbAAAAmwAAAKIAAACVAAAAWwAAAAL///8A////AP///wD///8A////AAAAABQAAADAAAAAYwAAAA3///8A////AP///wD///8AAAAADQAAAGMAAADAAAAAFP///wD///8A////AP///wAAAACdAAAAOv///wD///8A////AP///wD///8A////AP///wD///8AAAAAOgAAAJ3///8A////AP///wAAAAAnAAAAcP///wAAAAAoAAAASv///wD///8A////AP///wAAAABKAAAAKP///wAAAABwAAAAJ////wD///8AAAAAgQAAABwAAACIAAAAkAAAAJMAAACtAAAAFQAAABUAAACtAAAAkwAAAJAAAACIAAAAHAAAAIH///8A////AAAAAKQAAACrAAAAaP///wD///8AAAAARQAAANIAAADSAAAARf///wD///8AAAAAaAAAAKsAAACk////AAAAADMAAACcAAAAnQAAABj///8A////AP///wAAAAAYAAAAGP///wD///8A////AAAAABgAAACdAAAAnAAAADMAAAB1AAAAwwAAAP8AAADpAAAAsQAAAE4AAAAb////AP///wAAAAAbAAAATgAAALEAAADpAAAA/wAAAMMAAAB1AAAAtwAAAOkAAAD/AAAA/wAAAP8AAADvAAAA3gAAAN4AAADeAAAA3gAAAO8AAAD/AAAA/wAAAP8AAADpAAAAtwAAAGUAAAA/AAAA3wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAADfAAAAPwAAAGX///8A////AAAAAEgAAADtAAAAvwAAAL0AAADGAAAA7wAAAO8AAADGAAAAvQAAAL8AAADtAAAASP///wD///8A////AP///wD///8AAAAAO////wD///8A////AAAAAIcAAACH////AP///wD///8AAAAAO////wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A////AP///wD///8A//8AAP//AAD4HwAA7/cAAN/7AAD//wAAoYUAAJ55AACf+QAAh+EAAAAAAADAAwAA4AcAAP5/AAD//wAA//8AAA=="/>
|
||
|
<link rel="icon" type="image/png" sizes="32x32" href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4QQQEwksSS9ZWwAAAk1JREFUWMPtll2ITVEUx39nn/O7Y5qR8f05wtCUUr6ZIS++8pEnkZInPImneaCQ5METNdOkeFBKUhMPRIkHKfEuUZSUlGlKPN2TrgfncpvmnntnmlEyq1Z7t89/rf9a6+y99oZxGZf/XeIq61EdtgKXgdXA0xrYAvBjOIF1AI9zvjcC74BSpndrJPkBWDScTF8Aa4E3wDlgHbASaANmVqlcCnwHvgDvgVfAJ+AikAAvgfVZwLnSVZHZaOuKoQi3ZOMi4NkYkpe1p4J7A8BpYAD49hfIy/oqG0+hLomiKP2L5L+1ubn5115S+3OAn4EnwBlgMzCjyt6ZAnQCJ4A7wOs88iRJHvw50HoujuPBoCKwHWiosy8MdfZnAdcHk8dxXFJ3VQbQlCTJvRBCGdRbD4M6uc5glpY3eAihpN5S5w12diSEcCCEcKUO4ljdr15T76ur1FDDLIQQ3qv71EdDOe3Kxj3leRXyk+pxdWnFWod6Wt2bY3de3aSuUHcPBVimHs7mK9WrmeOF6lR1o9qnzskh2ar2qm1qizpfXaPeVGdlmGN5pb09qMxz1Xb1kLqgzn1RyH7JUXW52lr5e/Kqi9qpto7V1atuUzfnARrV7jEib1T76gG2qxdGmXyiekkt1GswPTtek0aBfJp6YySGBfWg2tPQ0FAYgf1stUfdmdcjarbYJEniKIq6gY/Aw+zWHAC+p2labGpqiorFYgGYCEzN7oQdQClN07O1/EfDyGgC0ALMBdYAi4FyK+4H3gLPsxfR1zRNi+NP7nH5J+QntnXe5B5mpfQAAAAASUVORK5CYII=">
|
||
|
|
||
|
<!-- Google fonts -->
|
||
|
<link href='https://fonts.googleapis.com/css?family=Lato:400,600,900' rel='stylesheet' type='text/css'/>
|
||
|
<link href='https://fonts.googleapis.com/css?family=Source+Code+Pro:400,500,600' rel='stylesheet' type='text/css'/>
|
||
|
|
||
|
<!-- CSS -->
|
||
|
<title>libp2p/protobuf/minprotobuf</title>
|
||
|
<link rel="stylesheet" type="text/css" href="../../nimdoc.out.css">
|
||
|
|
||
|
<script type="text/javascript" src="../../dochack.js"></script>
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
function main() {
|
||
|
var pragmaDots = document.getElementsByClassName("pragmadots");
|
||
|
for (var i = 0; i < pragmaDots.length; i++) {
|
||
|
pragmaDots[i].onclick = function(event) {
|
||
|
// Hide tease
|
||
|
event.target.parentNode.style.display = "none";
|
||
|
// Show actual
|
||
|
event.target.parentNode.nextElementSibling.style.display = "inline";
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function switchTheme(e) {
|
||
|
if (e.target.checked) {
|
||
|
document.documentElement.setAttribute('data-theme', 'dark');
|
||
|
localStorage.setItem('theme', 'dark');
|
||
|
} else {
|
||
|
document.documentElement.setAttribute('data-theme', 'light');
|
||
|
localStorage.setItem('theme', 'light');
|
||
|
}
|
||
|
}
|
||
|
|
||
|
const toggleSwitch = document.querySelector('.theme-switch input[type="checkbox"]');
|
||
|
if (toggleSwitch !== null) {
|
||
|
toggleSwitch.addEventListener('change', switchTheme, false);
|
||
|
}
|
||
|
|
||
|
var currentTheme = localStorage.getItem('theme');
|
||
|
if (!currentTheme && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||
|
currentTheme = 'dark';
|
||
|
}
|
||
|
if (currentTheme) {
|
||
|
document.documentElement.setAttribute('data-theme', currentTheme);
|
||
|
|
||
|
if (currentTheme === 'dark' && toggleSwitch !== null) {
|
||
|
toggleSwitch.checked = true;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
window.addEventListener('DOMContentLoaded', main);
|
||
|
</script>
|
||
|
|
||
|
</head>
|
||
|
<body>
|
||
|
<div class="document" id="documentId">
|
||
|
<div class="container">
|
||
|
<h1 class="title">libp2p/protobuf/minprotobuf</h1>
|
||
|
<div class="row">
|
||
|
<div class="three columns">
|
||
|
<div class="theme-switch-wrapper">
|
||
|
<label class="theme-switch" for="checkbox">
|
||
|
<input type="checkbox" id="checkbox" />
|
||
|
<div class="slider round"></div>
|
||
|
</label>
|
||
|
<em>Dark Mode</em>
|
||
|
</div>
|
||
|
<div id="global-links">
|
||
|
<ul class="simple">
|
||
|
<li>
|
||
|
<a href="../../theindex.html">Index</a>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div id="searchInputDiv">
|
||
|
Search: <input type="text" id="searchInput"
|
||
|
onkeyup="search()" />
|
||
|
</div>
|
||
|
<div>
|
||
|
Group by:
|
||
|
<select onchange="groupBy(this.value)">
|
||
|
<option value="section">Section</option>
|
||
|
<option value="type">Type</option>
|
||
|
</select>
|
||
|
</div>
|
||
|
<script type="text/javascript">
|
||
|
function main2() {
|
||
|
// Create the slider
|
||
|
var firstSlider = document.getElementsByClassName("theme-switch-wrapper")[0];
|
||
|
var newSlider = document.createRange().createContextualFragment(`
|
||
|
<div class="theme-switch-wrapper">
|
||
|
<label class="theme-switch" for="internalcheckbox">
|
||
|
<input type="checkbox" id="internalcheckbox">
|
||
|
<div class="slider round"></div>
|
||
|
</label>
|
||
|
<em>Internal</em>
|
||
|
</div>
|
||
|
`);
|
||
|
|
||
|
var sliderInst = firstSlider.after(newSlider);
|
||
|
|
||
|
// Restore slider state from storage
|
||
|
var currentMode = localStorage.getItem('privateMode');
|
||
|
if (currentMode == "private") {
|
||
|
document.getElementById("internalcheckbox").checked = true;
|
||
|
} else {
|
||
|
hidePrivateProcs();
|
||
|
}
|
||
|
|
||
|
document.getElementById("internalcheckbox").onclick = togglePrivateProcs;
|
||
|
}
|
||
|
|
||
|
function hidePrivateProcs() {
|
||
|
var toHide = document.getElementsByClassName("tohide");
|
||
|
for (var i = 0; i < toHide.length; i++) {
|
||
|
var pragmas = toHide[i].querySelectorAll("span.Identifier");
|
||
|
var public = false;
|
||
|
for (var z = 0; z < pragmas.length; z++) {
|
||
|
if (pragmas[z].innerText == "public") {
|
||
|
public = true;
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
if (public == false) {
|
||
|
toHide[i].style.display = "none";
|
||
|
toHide[i].classList.add("hidden");
|
||
|
links = document.querySelectorAll("a[href='#" + encodeURIComponent(toHide[i].id) + "']");
|
||
|
for (var y = 0; y < links.length; y++) {
|
||
|
links[y].parentNode.style.display = "none";
|
||
|
links[y].parentNode.classList.add("hidden");
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// TOC
|
||
|
var nestedSections = document.getElementsByClassName("nested-toc-section");
|
||
|
for (var i = 0; i < nestedSections.length; i++) {
|
||
|
if (nestedSections[i].querySelectorAll("li:not(.hidden)").length == 0) {
|
||
|
nestedSections[i].style.display = "none";
|
||
|
nestedSections[i].classList.add("hidden");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var sections = document.getElementsByClassName("simple-toc-section");
|
||
|
for (var i = 0; i < sections.length; i++) {
|
||
|
if (sections[i].querySelectorAll(".nested-toc-section:not(.hidden)").length == 0) {
|
||
|
sections[i].parentNode.style.display = "none";
|
||
|
sections[i].parentNode.classList.add("hidden");
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
// Sections
|
||
|
var sections = document.getElementsByClassName("section");
|
||
|
for (var i = 0; i < sections.length; i++) {
|
||
|
if (sections[i].querySelectorAll(".item > div").length == 0) continue;
|
||
|
if (sections[i].querySelectorAll(".item > div:not(.hidden)").length == 0) {
|
||
|
sections[i].style.display = "none";
|
||
|
sections[i].classList.add("hidden");
|
||
|
}
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function showPrivateProcs() {
|
||
|
var toHide = Array.from(document.getElementsByClassName("hidden"));
|
||
|
for (var i = 0; i < toHide.length; i++) {
|
||
|
toHide[i].style.display = "";
|
||
|
toHide[i].classList.remove("hidden");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function togglePrivateProcs() {
|
||
|
if (document.getElementById("internalcheckbox").checked) {
|
||
|
localStorage.setItem('privateMode', 'private');
|
||
|
showPrivateProcs();
|
||
|
} else {
|
||
|
localStorage.setItem('privateMode', 'public');
|
||
|
hidePrivateProcs();
|
||
|
}
|
||
|
}
|
||
|
window.addEventListener("DOMContentLoaded", main2);
|
||
|
</script>
|
||
|
<ul class="simple simple-toc" id="toc-list">
|
||
|
<li>
|
||
|
<a class="reference reference-toplevel" href="#6" id="56">Imports</a>
|
||
|
<ul class="simple simple-toc-section">
|
||
|
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a class="reference reference-toplevel" href="#7" id="57">Types</a>
|
||
|
<ul class="simple simple-toc-section">
|
||
|
<li><a class="reference" href="#ProtoBuffer"
|
||
|
title="ProtoBuffer = object
|
||
|
options: set[ProtoFlags]
|
||
|
buffer*: seq[byte]
|
||
|
offset*: int
|
||
|
length*: int
|
||
|
maxSize*: uint">ProtoBuffer</a></li>
|
||
|
<li><a class="reference" href="#ProtoError"
|
||
|
title="ProtoError {.pure.} = enum
|
||
|
VarintDecode, MessageIncomplete, BufferOverflow, MessageTooBig, BadWireType,
|
||
|
IncorrectBlob, RequiredFieldMissing">ProtoError</a></li>
|
||
|
<li><a class="reference" href="#ProtoField"
|
||
|
title="ProtoField = object
|
||
|
index*: int
|
||
|
case kind*: ProtoFieldKind
|
||
|
of Varint:
|
||
|
vint*: uint64
|
||
|
|
||
|
of Fixed64:
|
||
|
vfloat64*: float64
|
||
|
|
||
|
of Length:
|
||
|
vbuffer*: seq[byte]
|
||
|
|
||
|
of Fixed32:
|
||
|
vfloat32*: float32
|
||
|
|
||
|
of StartGroup, EndGroup:
|
||
|
nil">ProtoField</a></li>
|
||
|
<li><a class="reference" href="#ProtoFieldKind"
|
||
|
title="ProtoFieldKind = enum
|
||
|
Varint, Fixed64, Length, StartGroup, EndGroup, Fixed32">ProtoFieldKind</a></li>
|
||
|
<li><a class="reference" href="#ProtoFlags"
|
||
|
title="ProtoFlags = enum
|
||
|
WithVarintLength, WithUint32BeLength, WithUint32LeLength">ProtoFlags</a></li>
|
||
|
<li><a class="reference" href="#ProtoHeader"
|
||
|
title="ProtoHeader = object
|
||
|
wire*: ProtoFieldKind
|
||
|
index*: uint64">ProtoHeader</a></li>
|
||
|
<li><a class="reference" href="#ProtoResult"
|
||
|
title="ProtoResult[T] = Result[T, ProtoError]">ProtoResult</a></li>
|
||
|
<li><a class="reference" href="#ProtoScalar"
|
||
|
title="ProtoScalar = uint | uint32 | uint64 | zint | zint32 | zint64 | hint | hint32 |
|
||
|
hint64 |
|
||
|
float32 |
|
||
|
float64">ProtoScalar</a></li>
|
||
|
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a class="reference reference-toplevel" href="#10" id="60">Consts</a>
|
||
|
<ul class="simple simple-toc-section">
|
||
|
<li><a class="reference" href="#SupportedWireTypes"
|
||
|
title="SupportedWireTypes = [0, 1, 2, 5]">SupportedWireTypes</a></li>
|
||
|
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
|
||
|
<ul class="simple simple-toc-section">
|
||
|
<ul class="simple nested-toc-section">finish
|
||
|
<li><a class="reference" href="#finish%2CProtoBuffer"
|
||
|
title="finish(pb: var ProtoBuffer)">finish(pb: var ProtoBuffer)</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">getField
|
||
|
<li><a class="reference" href="#getField%2CProtoBuffer%2Cint%2CProtoBuffer"
|
||
|
title="getField(pb: ProtoBuffer; field: int; output: var ProtoBuffer): ProtoResult[bool]">getField(pb: ProtoBuffer; field: int; output: var ProtoBuffer): ProtoResult[bool]</a></li>
|
||
|
<li><a class="reference" href="#getField%2CProtoBuffer%2Cint%2CopenArray%5BT%5D%2Cint"
|
||
|
title="getField[T: byte | char](data: ProtoBuffer; field: int;
|
||
|
output: var openArray[T]; outlen: var int): ProtoResult[
|
||
|
bool]">getField[T: byte | char](data: ProtoBuffer; field: int;
|
||
|
output: var openArray[T]; outlen: var int): ProtoResult[
|
||
|
bool]</a></li>
|
||
|
<li><a class="reference" href="#getField%2CProtoBuffer%2Cint%2CT"
|
||
|
title="getField[T: ProtoScalar](data: ProtoBuffer; field: int; output: var T): ProtoResult[
|
||
|
bool]">getField[T: ProtoScalar](data: ProtoBuffer; field: int; output: var T): ProtoResult[
|
||
|
bool]</a></li>
|
||
|
<li><a class="reference" href="#getField%2CProtoBuffer%2Cint%2CT_2"
|
||
|
title="getField[T: seq[byte] | string](data: ProtoBuffer; field: int; output: var T): ProtoResult[
|
||
|
bool]">getField[T: seq[byte] | string](data: ProtoBuffer; field: int; output: var T): ProtoResult[
|
||
|
bool]</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">getPackedRepeatedField
|
||
|
<li><a class="reference" href="#getPackedRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D"
|
||
|
title="getPackedRepeatedField[T: ProtoScalar](data: ProtoBuffer; field: int;
|
||
|
output: var seq[T]): ProtoResult[bool]">getPackedRepeatedField[T: ProtoScalar](data: ProtoBuffer; field: int;
|
||
|
output: var seq[T]): ProtoResult[bool]</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">getRepeatedField
|
||
|
<li><a class="reference" href="#getRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D_2"
|
||
|
title="getRepeatedField[T: ProtoScalar](data: ProtoBuffer; field: int;
|
||
|
output: var seq[T]): ProtoResult[bool]">getRepeatedField[T: ProtoScalar](data: ProtoBuffer; field: int;
|
||
|
output: var seq[T]): ProtoResult[bool]</a></li>
|
||
|
<li><a class="reference" href="#getRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D"
|
||
|
title="getRepeatedField[T: seq[byte] | string](data: ProtoBuffer; field: int;
|
||
|
output: var seq[T]): ProtoResult[bool]">getRepeatedField[T: seq[byte] | string](data: ProtoBuffer; field: int;
|
||
|
output: var seq[T]): ProtoResult[bool]</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">getRequiredField
|
||
|
<li><a class="reference" href="#getRequiredField%2CProtoBuffer%2Cint%2CT"
|
||
|
title="getRequiredField[T](pb: ProtoBuffer; field: int; output: var T): ProtoResult[
|
||
|
void]">getRequiredField[T](pb: ProtoBuffer; field: int; output: var T): ProtoResult[
|
||
|
void]</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">getRequiredRepeatedField
|
||
|
<li><a class="reference" href="#getRequiredRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D"
|
||
|
title="getRequiredRepeatedField[T](pb: ProtoBuffer; field: int; output: var seq[T]): ProtoResult[
|
||
|
void]">getRequiredRepeatedField[T](pb: ProtoBuffer; field: int; output: var seq[T]): ProtoResult[
|
||
|
void]</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">initProtoBuffer
|
||
|
<li><a class="reference" href="#initProtoBuffer%2CopenArray%5Bbyte%5D%2Cint%2Cset%5BProtoFlags%5D"
|
||
|
title="initProtoBuffer(data: openArray[byte]; offset = 0;
|
||
|
options: set[ProtoFlags] = {}; maxSize = MaxMessageSize): ProtoBuffer">initProtoBuffer(data: openArray[byte]; offset = 0;
|
||
|
options: set[ProtoFlags] = {}; maxSize = MaxMessageSize): ProtoBuffer</a></li>
|
||
|
<li><a class="reference" href="#initProtoBuffer%2Cseq%5Bbyte%5D%2Cint%2Cset%5BProtoFlags%5D"
|
||
|
title="initProtoBuffer(data: seq[byte]; offset = 0; options: set[ProtoFlags] = {};
|
||
|
maxSize = MaxMessageSize): ProtoBuffer">initProtoBuffer(data: seq[byte]; offset = 0; options: set[ProtoFlags] = {};
|
||
|
maxSize = MaxMessageSize): ProtoBuffer</a></li>
|
||
|
<li><a class="reference" href="#initProtoBuffer%2Cset%5BProtoFlags%5D"
|
||
|
title="initProtoBuffer(options: set[ProtoFlags] = {}; maxSize = MaxMessageSize): ProtoBuffer">initProtoBuffer(options: set[ProtoFlags] = {}; maxSize = MaxMessageSize): ProtoBuffer</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">vsizeof
|
||
|
<li><a class="reference" href="#vsizeof%2CProtoField"
|
||
|
title="vsizeof(field: ProtoField): int">vsizeof(field: ProtoField): int</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">write
|
||
|
<li><a class="reference" href="#write%2CProtoBuffer%2Cint%2CProtoBuffer"
|
||
|
title="write(pb: var ProtoBuffer; field: int; value: ProtoBuffer)">write(pb: var ProtoBuffer; field: int; value: ProtoBuffer)</a></li>
|
||
|
<li><a class="reference" href="#write%2CProtoBuffer%2Cint%2CopenArray%5BT%5D"
|
||
|
title="write[T: byte | char](pb: var ProtoBuffer; field: int; value: openArray[T])">write[T: byte | char](pb: var ProtoBuffer; field: int; value: openArray[T])</a></li>
|
||
|
<li><a class="reference" href="#write%2CProtoBuffer%2Cint%2CT"
|
||
|
title="write[T: ProtoScalar](pb: var ProtoBuffer; field: int; value: T)">write[T: ProtoScalar](pb: var ProtoBuffer; field: int; value: T)</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">writePacked
|
||
|
<li><a class="reference" href="#writePacked%2CProtoBuffer%2Cint%2CopenArray%5BT%5D"
|
||
|
title="writePacked[T: ProtoScalar](pb: var ProtoBuffer; field: int; value: openArray[T])">writePacked[T: ProtoScalar](pb: var ProtoBuffer; field: int; value: openArray[T])</a></li>
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a class="reference reference-toplevel" href="#18" id="68">Templates</a>
|
||
|
<ul class="simple simple-toc-section">
|
||
|
<ul class="simple nested-toc-section">checkFieldNumber
|
||
|
<li><a class="reference" href="#checkFieldNumber.t%2Cint"
|
||
|
title="checkFieldNumber(i: int)">checkFieldNumber(i: int)</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">getLen
|
||
|
<li><a class="reference" href="#getLen.t%2CProtoBuffer"
|
||
|
title="getLen(pb: ProtoBuffer): int">getLen(pb: ProtoBuffer): int</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">getProtoHeader
|
||
|
<li><a class="reference" href="#getProtoHeader.t%2CProtoField"
|
||
|
title="getProtoHeader(field: ProtoField): uint64">getProtoHeader(field: ProtoField): uint64</a></li>
|
||
|
<li><a class="reference" href="#getProtoHeader.t%2Cint%2CProtoFieldKind"
|
||
|
title="getProtoHeader(index: int; wire: ProtoFieldKind): uint64">getProtoHeader(index: int; wire: ProtoFieldKind): uint64</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">getPtr
|
||
|
<li><a class="reference" href="#getPtr.t%2CProtoBuffer"
|
||
|
title="getPtr(pb: ProtoBuffer): pointer">getPtr(pb: ProtoBuffer): pointer</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">isEmpty
|
||
|
<li><a class="reference" href="#isEmpty.t%2CProtoBuffer"
|
||
|
title="isEmpty(pb: ProtoBuffer): bool">isEmpty(pb: ProtoBuffer): bool</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">isEnough
|
||
|
<li><a class="reference" href="#isEnough.t%2CProtoBuffer%2Cint"
|
||
|
title="isEnough(pb: ProtoBuffer; length: int): bool">isEnough(pb: ProtoBuffer; length: int): bool</a></li>
|
||
|
|
||
|
</ul>
|
||
|
<ul class="simple nested-toc-section">toOpenArray
|
||
|
<li><a class="reference" href="#toOpenArray.t%2CProtoBuffer"
|
||
|
title="toOpenArray(pb: ProtoBuffer): untyped">toOpenArray(pb: ProtoBuffer): untyped</a></li>
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</ul>
|
||
|
</li>
|
||
|
<li>
|
||
|
<a class="reference reference-toplevel" href="#19" id="69">Exports</a>
|
||
|
<ul class="simple simple-toc-section">
|
||
|
|
||
|
</ul>
|
||
|
</li>
|
||
|
|
||
|
</ul>
|
||
|
|
||
|
</div>
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L1"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
<div class="nine columns" id="content">
|
||
|
<div id="tocRoot"></div>
|
||
|
|
||
|
<p class="module-desc">This module implements minimal Google's ProtoBuf primitives.</p>
|
||
|
<div class="section" id="6">
|
||
|
<h1><a class="toc-backref" href="#6">Imports</a></h1>
|
||
|
<dl class="item">
|
||
|
<a class="reference external" href="../varint.html">../varint</a>, <a class="reference external" href="../utility.html">../utility</a>
|
||
|
</dl></div>
|
||
|
<div class="section" id="7">
|
||
|
<h1><a class="toc-backref" href="#7">Types</a></h1>
|
||
|
<dl class="item">
|
||
|
<div id="ProtoBuffer" class="tohide">
|
||
|
<dt><pre><a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
|
||
|
<span class="Identifier">options</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="minprotobuf.html#ProtoFlags"><span class="Identifier">ProtoFlags</span></a><span class="Other">]</span>
|
||
|
<span class="Identifier">buffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span>
|
||
|
<span class="Identifier">offset</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
|
||
|
<span class="Identifier">length</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
|
||
|
<span class="Identifier">maxSize</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint</span>
|
||
|
</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
Protobuf's message representation object
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L30"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L30" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="ProtoError" class="tohide">
|
||
|
<dt><pre><a href="minprotobuf.html#ProtoError"><span class="Identifier">ProtoError</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
|
||
|
<span class="Identifier">VarintDecode</span><span class="Other">,</span> <span class="Identifier">MessageIncomplete</span><span class="Other">,</span> <span class="Identifier">BufferOverflow</span><span class="Other">,</span> <span class="Identifier">MessageTooBig</span><span class="Other">,</span> <span class="Identifier">BadWireType</span><span class="Other">,</span>
|
||
|
<span class="Identifier">IncorrectBlob</span><span class="Other">,</span> <span class="Identifier">RequiredFieldMissing</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L57"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L57" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="ProtoField" class="tohide">
|
||
|
<dt><pre><a href="minprotobuf.html#ProtoField"><span class="Identifier">ProtoField</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
|
||
|
<span class="Identifier">index</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
|
||
|
<span class="Keyword">case</span> <span class="Identifier">kind</span><span class="Operator">*</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoFieldKind"><span class="Identifier">ProtoFieldKind</span></a>
|
||
|
<span class="Keyword">of</span> <span class="Identifier">Varint</span><span class="Other">:</span>
|
||
|
<span class="Identifier">vint</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint64</span>
|
||
|
|
||
|
<span class="Keyword">of</span> <span class="Identifier">Fixed64</span><span class="Other">:</span>
|
||
|
<span class="Identifier">vfloat64</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">float64</span>
|
||
|
|
||
|
<span class="Keyword">of</span> <span class="Identifier">Length</span><span class="Other">:</span>
|
||
|
<span class="Identifier">vbuffer</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span>
|
||
|
|
||
|
<span class="Keyword">of</span> <span class="Identifier">Fixed32</span><span class="Other">:</span>
|
||
|
<span class="Identifier">vfloat32</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">float32</span>
|
||
|
|
||
|
<span class="Keyword">of</span> <span class="Identifier">StartGroup</span><span class="Other">,</span> <span class="Identifier">EndGroup</span><span class="Other">:</span>
|
||
|
<span class="Keyword">nil</span>
|
||
|
|
||
|
</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
Protobuf's message field representation object
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L42"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L42" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="ProtoFieldKind" class="tohide">
|
||
|
<dt><pre><a href="minprotobuf.html#ProtoFieldKind"><span class="Identifier">ProtoFieldKind</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
|
||
|
<span class="Identifier">Varint</span><span class="Other">,</span> <span class="Identifier">Fixed64</span><span class="Other">,</span> <span class="Identifier">Length</span><span class="Other">,</span> <span class="Identifier">StartGroup</span><span class="Other">,</span> <span class="Identifier">EndGroup</span><span class="Other">,</span> <span class="Identifier">Fixed32</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
Protobuf's field types enum
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L22"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L22" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="ProtoFlags" class="tohide">
|
||
|
<dt><pre><a href="minprotobuf.html#ProtoFlags"><span class="Identifier">ProtoFlags</span></a> <span class="Other">=</span> <span class="Keyword">enum</span>
|
||
|
<span class="Identifier">WithVarintLength</span><span class="Other">,</span> <span class="Identifier">WithUint32BeLength</span><span class="Other">,</span> <span class="Identifier">WithUint32LeLength</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
Protobuf's encoding types
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L26"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L26" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="ProtoHeader" class="tohide">
|
||
|
<dt><pre><a href="minprotobuf.html#ProtoHeader"><span class="Identifier">ProtoHeader</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
|
||
|
<span class="Identifier">wire</span><span class="Operator">*</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoFieldKind"><span class="Identifier">ProtoFieldKind</span></a>
|
||
|
<span class="Identifier">index</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint64</span>
|
||
|
</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L38"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L38" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="ProtoResult" class="tohide">
|
||
|
<dt><pre><a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <a href="minprotobuf.html#ProtoError"><span class="Identifier">ProtoError</span></a><span class="Other">]</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L66"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L66" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="ProtoScalar" class="tohide">
|
||
|
<dt><pre><a href="minprotobuf.html#ProtoScalar"><span class="Identifier">ProtoScalar</span></a> <span class="Other">=</span> <span class="Identifier">uint</span> <span class="Operator">|</span> <span class="Identifier">uint32</span> <span class="Operator">|</span> <span class="Identifier">uint64</span> <span class="Operator">|</span> <a href="../varint.html#zint"><span class="Identifier">zint</span></a> <span class="Operator">|</span> <a href="../varint.html#zint32"><span class="Identifier">zint32</span></a> <span class="Operator">|</span> <a href="../varint.html#zint64"><span class="Identifier">zint64</span></a> <span class="Operator">|</span> <a href="../varint.html#hint"><span class="Identifier">hint</span></a> <span class="Operator">|</span> <a href="../varint.html#hint32"><span class="Identifier">hint32</span></a> <span class="Operator">|</span>
|
||
|
<a href="../varint.html#hint64"><span class="Identifier">hint64</span></a> <span class="Operator">|</span>
|
||
|
<span class="Identifier">float32</span> <span class="Operator">|</span>
|
||
|
<span class="Identifier">float64</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L68"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L68" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
|
||
|
</dl></div>
|
||
|
<div class="section" id="10">
|
||
|
<h1><a class="toc-backref" href="#10">Consts</a></h1>
|
||
|
<dl class="item">
|
||
|
<div id="SupportedWireTypes" class="tohide">
|
||
|
<dt><pre><a href="minprotobuf.html#SupportedWireTypes"><span class="Identifier">SupportedWireTypes</span></a> <span class="Other">=</span> <span class="Other">[</span><span class="DecNumber">0</span><span class="Other">,</span> <span class="DecNumber">1</span><span class="Other">,</span> <span class="DecNumber">2</span><span class="Other">,</span> <span class="DecNumber">5</span><span class="Other">]</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L72"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L72" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
|
||
|
</dl></div>
|
||
|
<div class="section" id="12">
|
||
|
<h1><a class="toc-backref" href="#12">Procs</a></h1>
|
||
|
<dl class="item">
|
||
|
<div id="finish,ProtoBuffer" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#finish%2CProtoBuffer"><span class="Identifier">finish</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
Prepare protobuf's buffer <tt class="docutils literal"><span class="pre">pb</span></tt> for writing to stream.
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L273"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L273" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="getField,ProtoBuffer,int,ProtoBuffer" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#getField%2CProtoBuffer%2Cint%2CProtoBuffer"><span class="Identifier">getField</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span>
|
||
|
<span class="Identifier">bool</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L576"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L576" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="getField,ProtoBuffer,int,openArray[T],int" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#getField%2CProtoBuffer%2Cint%2CopenArray%5BT%5D%2Cint"><span class="Identifier">getField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span>
|
||
|
<span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">outlen</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span>
|
||
|
<span class="Identifier">bool</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L487"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L487" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="getField,ProtoBuffer,int,T" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#getField%2CProtoBuffer%2Cint%2CT"><span class="Identifier">getField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoScalar"><span class="Identifier">ProtoScalar</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span>
|
||
|
<span class="Identifier">bool</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L446"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L446" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="getField,ProtoBuffer,int,T_2" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#getField%2CProtoBuffer%2Cint%2CT_2"><span class="Identifier">getField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span> <span class="Operator">|</span> <span class="Identifier">string</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span>
|
||
|
<span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">]</span> {.
|
||
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L539"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L539" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="getPackedRepeatedField,ProtoBuffer,int,seq[T]" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#getPackedRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D"><span class="Identifier">getPackedRepeatedField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoScalar"><span class="Identifier">ProtoScalar</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span>
|
||
|
<span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L675"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L675" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="getRepeatedField,ProtoBuffer,int,seq[T]_2" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#getRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D_2"><span class="Identifier">getRepeatedField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoScalar"><span class="Identifier">ProtoScalar</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span>
|
||
|
<span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">]</span> {.
|
||
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L629"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L629" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="getRepeatedField,ProtoBuffer,int,seq[T]" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#getRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D"><span class="Identifier">getRepeatedField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span> <span class="Operator">|</span> <span class="Identifier">string</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span>
|
||
|
<span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">]</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L592"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L592" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="getRequiredField,ProtoBuffer,int,T" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#getRequiredField%2CProtoBuffer%2Cint%2CT"><span class="Identifier">getRequiredField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">T</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span>
|
||
|
<span class="Identifier">void</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L585"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L585" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="getRequiredRepeatedField,ProtoBuffer,int,seq[T]" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#getRequiredRepeatedField%2CProtoBuffer%2Cint%2Cseq%5BT%5D"><span class="Identifier">getRequiredRepeatedField</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">output</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoResult"><span class="Identifier">ProtoResult</span></a><span class="Other">[</span>
|
||
|
<span class="Identifier">void</span><span class="Other">]</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L668"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L668" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="initProtoBuffer,openArray[byte],int,set[ProtoFlags]" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#initProtoBuffer%2CopenArray%5Bbyte%5D%2Cint%2Cset%5BProtoFlags%5D"><span class="Identifier">initProtoBuffer</span></a><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">offset</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span>
|
||
|
<span class="Identifier">options</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="minprotobuf.html#ProtoFlags"><span class="Identifier">ProtoFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span> <span class="Identifier">maxSize</span> <span class="Other">=</span> <span class="Identifier">MaxMessageSize</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a> {.
|
||
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
Initialize ProtoBuffer with copy of <tt class="docutils literal"><span class="pre">data</span></tt>.
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L130"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L130" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="initProtoBuffer,seq[byte],int,set[ProtoFlags]" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#initProtoBuffer%2Cseq%5Bbyte%5D%2Cint%2Cset%5BProtoFlags%5D"><span class="Identifier">initProtoBuffer</span></a><span class="Other">(</span><span class="Identifier">data</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><span class="Identifier">byte</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">offset</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">;</span> <span class="Identifier">options</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="minprotobuf.html#ProtoFlags"><span class="Identifier">ProtoFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span>
|
||
|
<span class="Identifier">maxSize</span> <span class="Other">=</span> <span class="Identifier">MaxMessageSize</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
|
||
|
</span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
Initialize ProtoBuffer with shallow copy of <tt class="docutils literal"><span class="pre">data</span></tt>.
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L121"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L121" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="initProtoBuffer,set[ProtoFlags]" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#initProtoBuffer%2Cset%5BProtoFlags%5D"><span class="Identifier">initProtoBuffer</span></a><span class="Other">(</span><span class="Identifier">options</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="minprotobuf.html#ProtoFlags"><span class="Identifier">ProtoFlags</span></a><span class="Other">]</span> <span class="Other">=</span> <span class="Other">{</span><span class="Other">}</span><span class="Other">;</span> <span class="Identifier">maxSize</span> <span class="Other">=</span> <span class="Identifier">MaxMessageSize</span><span class="Other">)</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a> {.
|
||
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
Initialize ProtoBuffer with new sequence of capacity <tt class="docutils literal"><span class="pre">cap</span></tt>.
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L139"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L139" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="vsizeof,ProtoField" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#vsizeof%2CProtoField"><span class="Identifier">vsizeof</span></a><span class="Other">(</span><span class="Identifier">field</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoField"><span class="Identifier">ProtoField</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span> {.<span class="Identifier">inline</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
Returns number of bytes required to store protobuf's field <tt class="docutils literal"><span class="pre">field</span></tt>.
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L106"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L106" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="write,ProtoBuffer,int,ProtoBuffer" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CProtoBuffer%2Cint%2CProtoBuffer"><span class="Identifier">write</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span> {.<span class="Identifier">inline</span><span class="Other">,</span>
|
||
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span><span class="Other">,</span> <span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
Encode Protobuf's sub-message <tt class="docutils literal"><span class="pre">value</span></tt> and store it to protobuf's buffer <tt class="docutils literal"><span class="pre">pb</span></tt> with field number <tt class="docutils literal"><span class="pre">field</span></tt>.
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L268"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L268" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="write,ProtoBuffer,int,openArray[T]" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CProtoBuffer%2Cint%2CopenArray%5BT%5D"><span class="Identifier">write</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">byte</span> <span class="Operator">|</span> <span class="Identifier">char</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.
|
||
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L248"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L248" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="write,ProtoBuffer,int,T" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#write%2CProtoBuffer%2Cint%2CT"><span class="Identifier">write</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoScalar"><span class="Identifier">ProtoScalar</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">)</span> {.
|
||
|
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L155"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L155" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="writePacked,ProtoBuffer,int,openArray[T]" class="tohide">
|
||
|
<dt><pre><span class="Keyword">proc</span> <a href="#writePacked%2CProtoBuffer%2Cint%2CopenArray%5BT%5D"><span class="Identifier">writePacked</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoScalar"><span class="Identifier">ProtoScalar</span></a><span class="Other">]</span><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">field</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span>
|
||
|
<span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">openArray</span><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> </span><span class="Identifier">public</span>.}</pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L200"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L200" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
|
||
|
</dl></div>
|
||
|
<div class="section" id="18">
|
||
|
<h1><a class="toc-backref" href="#18">Templates</a></h1>
|
||
|
<dl class="item">
|
||
|
<div id="checkFieldNumber.t,int" class="tohide">
|
||
|
<dt><pre><span class="Keyword">template</span> <a href="#checkFieldNumber.t%2Cint"><span class="Identifier">checkFieldNumber</span></a><span class="Other">(</span><span class="Identifier">i</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L79"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L79" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="getLen.t,ProtoBuffer" class="tohide">
|
||
|
<dt><pre><span class="Keyword">template</span> <a href="#getLen.t%2CProtoBuffer"><span class="Identifier">getLen</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L103"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L103" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="getProtoHeader.t,ProtoField" class="tohide">
|
||
|
<dt><pre><span class="Keyword">template</span> <a href="#getProtoHeader.t%2CProtoField"><span class="Identifier">getProtoHeader</span></a><span class="Other">(</span><span class="Identifier">field</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoField"><span class="Identifier">ProtoField</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">uint64</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
Get protobuf's field header integer for <tt class="docutils literal"><span class="pre">field</span></tt>.
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L87"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L87" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="getProtoHeader.t,int,ProtoFieldKind" class="tohide">
|
||
|
<dt><pre><span class="Keyword">template</span> <a href="#getProtoHeader.t%2Cint%2CProtoFieldKind"><span class="Identifier">getProtoHeader</span></a><span class="Other">(</span><span class="Identifier">index</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">wire</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoFieldKind"><span class="Identifier">ProtoFieldKind</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">uint64</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
Get protobuf's field header integer for <tt class="docutils literal"><span class="pre">index</span></tt> and <tt class="docutils literal"><span class="pre">wire</span></tt>.
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L83"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L83" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="getPtr.t,ProtoBuffer" class="tohide">
|
||
|
<dt><pre><span class="Keyword">template</span> <a href="#getPtr.t%2CProtoBuffer"><span class="Identifier">getPtr</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">pointer</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L100"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L100" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="isEmpty.t,ProtoBuffer" class="tohide">
|
||
|
<dt><pre><span class="Keyword">template</span> <a href="#isEmpty.t%2CProtoBuffer"><span class="Identifier">isEmpty</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L94"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L94" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="isEnough.t,ProtoBuffer,int" class="tohide">
|
||
|
<dt><pre><span class="Keyword">template</span> <a href="#isEnough.t%2CProtoBuffer%2Cint"><span class="Identifier">isEnough</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">;</span> <span class="Identifier">length</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L97"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L97" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
<div id="toOpenArray.t,ProtoBuffer" class="tohide">
|
||
|
<dt><pre><span class="Keyword">template</span> <a href="#toOpenArray.t%2CProtoBuffer"><span class="Identifier">toOpenArray</span></a><span class="Other">(</span><span class="Identifier">pb</span><span class="Other">:</span> <a href="minprotobuf.html#ProtoBuffer"><span class="Identifier">ProtoBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
|
||
|
<dd>
|
||
|
|
||
|
|
||
|
<a
|
||
|
href="https://github.com/status-im/nim-libp2p/tree/ex-race/libp2p/protobuf/minprotobuf.nim#L91"
|
||
|
class="link-seesrc" target="_blank">Source</a>
|
||
|
<a href="https://github.com/status-im/nim-libp2p/edit/devel/libp2p/protobuf/minprotobuf.nim#L91" class="link-seesrc" target="_blank" >Edit</a>
|
||
|
|
||
|
</dd>
|
||
|
</div>
|
||
|
|
||
|
</dl></div>
|
||
|
<div class="section" id="19">
|
||
|
<h1><a class="toc-backref" href="#19">Exports</a></h1>
|
||
|
<dl class="item">
|
||
|
<a href="../utility.html#withValue.t,,untyped,untyped"><span class="Identifier">withValue</span></a>, <a href="../utility.html#safeConvert.t,S"><span class="Identifier">safeConvert</span></a>, <a href="../utility.html#shortLog,openArray[byte]"><span class="Identifier">shortLog</span></a>, <a href="../utility.html#withValue.m,,untyped,untyped,untyped"><span class="Identifier">withValue</span></a>, <a href="../utility.html#public.t"><span class="Identifier">public</span></a>, <a href="../utility.html#exceptionToAssert.t,untyped"><span class="Identifier">exceptionToAssert</span></a>, <a href="../utility.html#valueOr.t,Option[T],untyped"><span class="Identifier">valueOr</span></a>, <a href="../utility.html#shortLog,string"><span class="Identifier">shortLog</span></a>, <a href="../utility.html#compilesOr.t,untyped,untyped"><span class="Identifier">compilesOr</span></a>, <a href="../utility.html#capLen,seq[T],Natural"><span class="Identifier">capLen</span></a>, <a href="../utility.html#toOpt.t,Result[T,E]"><span class="Identifier">toOpt</span></a>
|
||
|
</dl></div>
|
||
|
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
<div class="row">
|
||
|
<div class="twelve-columns footer">
|
||
|
<span class="nim-sprite"></span>
|
||
|
<br/>
|
||
|
<small style="color: var(--hint);">Made with Nim. Generated: 2024-03-02 21:58:54 UTC</small>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</body>
|
||
|
</html>
|