This commit is contained in:
cheatfate 2024-11-28 08:22:47 +00:00
commit 0ce376b486
109 changed files with 43277 additions and 0 deletions

1
.nojekyll Normal file
View File

@ -0,0 +1 @@
This file makes sure that Github Pages doesn't process mdBook's output.

222
404.html Normal file
View File

@ -0,0 +1,222 @@
<!DOCTYPE HTML>
<html lang="en" class="light" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>Page not found - Chronos</title>
<base href="/">
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="open-in.css">
</head>
<body class="sidebar-visible no-js">
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('light')
html.classList.add(theme);
var body = document.querySelector('body');
body.classList.remove('no-js')
body.classList.add('js');
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var body = document.querySelector('body');
var sidebar = null;
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
body.classList.remove('sidebar-visible');
body.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="examples.html"><strong aria-hidden="true">2.</strong> Examples</a></li><li class="chapter-item expanded affix "><li class="part-title">User guide</li><li class="chapter-item expanded "><a href="concepts.html"><strong aria-hidden="true">3.</strong> Core concepts</a></li><li class="chapter-item expanded "><a href="async_procs.html"><strong aria-hidden="true">4.</strong> async functions</a></li><li class="chapter-item expanded "><a href="error_handling.html"><strong aria-hidden="true">5.</strong> Errors and exceptions</a></li><li class="chapter-item expanded "><a href="threads.html"><strong aria-hidden="true">6.</strong> Threads</a></li><li class="chapter-item expanded "><a href="tips.html"><strong aria-hidden="true">7.</strong> Tips, tricks and best practices</a></li><li class="chapter-item expanded "><a href="porting.html"><strong aria-hidden="true">8.</strong> Porting code to chronos</a></li><li class="chapter-item expanded "><a href="http_server_middleware.html"><strong aria-hidden="true">9.</strong> HTTP server middleware</a></li><li class="chapter-item expanded affix "><li class="part-title">Developer guide</li><li class="chapter-item expanded "><a href="book.html"><strong aria-hidden="true">10.</strong> Updating this book</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<!-- Track and set sidebar scroll position -->
<script>
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
sidebarScrollbox.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
sidebarScrollbox.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
</script>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Chronos</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/status-im/nim-chronos/" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h1 id="document-not-found-404"><a class="header" href="#document-not-found-404">Document not found (404)</a></h1>
<p>This URL is invalid, sorry. Please use the navigation bar or search to continue.</p>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
</nav>
</div>
<script>
window.playground_copyable = true;
</script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>

4
FontAwesome/css/font-awesome.css vendored Normal file

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

After

Width:  |  Height:  |  Size: 434 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

153
api/chronos.html Normal file

File diff suppressed because one or more lines are too long

151
api/chronos/asyncloop.html Normal file

File diff suppressed because one or more lines are too long

1191
api/chronos/asyncsync.html Normal file

File diff suppressed because one or more lines are too long

55
api/chronos/asyncsync.idx Normal file
View File

@ -0,0 +1,55 @@
AsyncLock chronos/asyncsync.html#AsyncLock asyncsync: AsyncLock
AsyncEvent chronos/asyncsync.html#AsyncEvent asyncsync: AsyncEvent
AsyncQueue chronos/asyncsync.html#AsyncQueue asyncsync: AsyncQueue
AsyncQueueEmptyError chronos/asyncsync.html#AsyncQueueEmptyError asyncsync: AsyncQueueEmptyError
AsyncQueueFullError chronos/asyncsync.html#AsyncQueueFullError asyncsync: AsyncQueueFullError
AsyncLockError chronos/asyncsync.html#AsyncLockError asyncsync: AsyncLockError
AsyncEventQueueFullError chronos/asyncsync.html#AsyncEventQueueFullError asyncsync: AsyncEventQueueFullError
EventQueueKey chronos/asyncsync.html#EventQueueKey asyncsync: EventQueueKey
EventQueueReader chronos/asyncsync.html#EventQueueReader asyncsync: EventQueueReader
AsyncEventQueue chronos/asyncsync.html#AsyncEventQueue asyncsync: AsyncEventQueue
newAsyncLock chronos/asyncsync.html#newAsyncLock asyncsync: newAsyncLock(): AsyncLock
acquire chronos/asyncsync.html#acquire,AsyncLock asyncsync: acquire(lock: AsyncLock): InternalRaisesFuture[void, (CancelledError,)]
locked chronos/asyncsync.html#locked,AsyncLock asyncsync: locked(lock: AsyncLock): bool
release chronos/asyncsync.html#release,AsyncLock asyncsync: release(lock: AsyncLock)
newAsyncEvent chronos/asyncsync.html#newAsyncEvent asyncsync: newAsyncEvent(): AsyncEvent
wait chronos/asyncsync.html#wait,AsyncEvent asyncsync: wait(event: AsyncEvent): InternalRaisesFuture[void, (CancelledError,)]
fire chronos/asyncsync.html#fire,AsyncEvent asyncsync: fire(event: AsyncEvent)
clear chronos/asyncsync.html#clear,AsyncEvent asyncsync: clear(event: AsyncEvent)
isSet chronos/asyncsync.html#isSet,AsyncEvent asyncsync: isSet(event: AsyncEvent): bool
newAsyncQueue chronos/asyncsync.html#newAsyncQueue,int asyncsync: newAsyncQueue[T](maxsize: int = 0): AsyncQueue[T]
full chronos/asyncsync.html#full,AsyncQueue[T] asyncsync: full[T](aq: AsyncQueue[T]): bool
empty chronos/asyncsync.html#empty,AsyncQueue[T] asyncsync: empty[T](aq: AsyncQueue[T]): bool
addFirstNoWait chronos/asyncsync.html#addFirstNoWait,AsyncQueue[T],T asyncsync: addFirstNoWait[T](aq: AsyncQueue[T]; item: T)
addLastNoWait chronos/asyncsync.html#addLastNoWait,AsyncQueue[T],T asyncsync: addLastNoWait[T](aq: AsyncQueue[T]; item: T)
popFirstNoWait chronos/asyncsync.html#popFirstNoWait,AsyncQueue[T] asyncsync: popFirstNoWait[T](aq: AsyncQueue[T]): T
popLastNoWait chronos/asyncsync.html#popLastNoWait,AsyncQueue[T] asyncsync: popLastNoWait[T](aq: AsyncQueue[T]): T
addFirst chronos/asyncsync.html#addFirst,AsyncQueue[T],T asyncsync: addFirst[T](aq: AsyncQueue[T]; item: T): InternalRaisesFuture[void,\n (CancelledError,)]
addLast chronos/asyncsync.html#addLast,AsyncQueue[T],T asyncsync: addLast[T](aq: AsyncQueue[T]; item: T): InternalRaisesFuture[void,\n (CancelledError,)]
popFirst chronos/asyncsync.html#popFirst,AsyncQueue[T] asyncsync: popFirst[T](aq: AsyncQueue[T]): InternalRaisesFuture[T, (CancelledError,)]
popLast chronos/asyncsync.html#popLast,AsyncQueue[T] asyncsync: popLast[T](aq: AsyncQueue[T]): InternalRaisesFuture[T, (CancelledError,)]
putNoWait chronos/asyncsync.html#putNoWait,AsyncQueue[T],T asyncsync: putNoWait[T](aq: AsyncQueue[T]; item: T)
getNoWait chronos/asyncsync.html#getNoWait,AsyncQueue[T] asyncsync: getNoWait[T](aq: AsyncQueue[T]): T
put chronos/asyncsync.html#put,AsyncQueue[T],T asyncsync: put[T](aq: AsyncQueue[T]; item: T): InternalRaisesFuture[void, (CancelledError,)]
get chronos/asyncsync.html#get,AsyncQueue[T] asyncsync: get[T](aq: AsyncQueue[T]): InternalRaisesFuture[T, (CancelledError,)]
clear chronos/asyncsync.html#clear,AsyncQueue[T] asyncsync: clear[T](aq: AsyncQueue[T])
len chronos/asyncsync.html#len,AsyncQueue[T] asyncsync: len[T](aq: AsyncQueue[T]): int
size chronos/asyncsync.html#size,AsyncQueue[T] asyncsync: size[T](aq: AsyncQueue[T]): int
`[]` chronos/asyncsync.html#[],AsyncQueue[T],Natural asyncsync: `[]`[T](aq: AsyncQueue[T]; i: Natural): T
`[]` chronos/asyncsync.html#[],AsyncQueue[T],BackwardsIndex asyncsync: `[]`[T](aq: AsyncQueue[T]; i: BackwardsIndex): T
`[]=` chronos/asyncsync.html#[]=,AsyncQueue[T],Natural,T asyncsync: `[]=`[T](aq: AsyncQueue[T]; i: Natural; item: T)
`[]=` chronos/asyncsync.html#[]=,AsyncQueue[T],BackwardsIndex,T asyncsync: `[]=`[T](aq: AsyncQueue[T]; i: BackwardsIndex; item: T)
items chronos/asyncsync.html#items.i,AsyncQueue[T] asyncsync: items[T](aq: AsyncQueue[T]): T
mitems chronos/asyncsync.html#mitems.i,AsyncQueue[T] asyncsync: mitems[T](aq: AsyncQueue[T]): var T
pairs chronos/asyncsync.html#pairs.i,AsyncQueue[T] asyncsync: pairs[T](aq: AsyncQueue[T]): tuple[key: int, val: T]
contains chronos/asyncsync.html#contains,AsyncQueue[T],T asyncsync: contains[T](aq: AsyncQueue[T]; item: T): bool
`$` chronos/asyncsync.html#$,AsyncQueue[T] asyncsync: `$`[T](aq: AsyncQueue[T]): string
newAsyncEventQueue chronos/asyncsync.html#newAsyncEventQueue,int asyncsync: newAsyncEventQueue[T](limitSize = 0): AsyncEventQueue[T]
len chronos/asyncsync.html#len,AsyncEventQueue asyncsync: len(ab: AsyncEventQueue): int
register chronos/asyncsync.html#register,AsyncEventQueue asyncsync: register(ab: AsyncEventQueue): EventQueueKey
unregister chronos/asyncsync.html#unregister,AsyncEventQueue,EventQueueKey asyncsync: unregister(ab: AsyncEventQueue; key: EventQueueKey)
close chronos/asyncsync.html#close,AsyncEventQueue asyncsync: close(ab: AsyncEventQueue)
closeWait chronos/asyncsync.html#closeWait,AsyncEventQueue asyncsync: closeWait(ab: AsyncEventQueue): InternalRaisesFuture[void, void]
readerOverflow chronos/asyncsync.html#readerOverflow.t,AsyncEventQueue,EventQueueReader asyncsync: readerOverflow(ab: AsyncEventQueue; reader: EventQueueReader): bool
emit chronos/asyncsync.html#emit,AsyncEventQueue[T],T asyncsync: emit[T](ab: AsyncEventQueue[T]; data: T)
waitEvents chronos/asyncsync.html#waitEvents,AsyncEventQueue[T],EventQueueKey,int asyncsync: waitEvents[T](ab: AsyncEventQueue[T]; key: EventQueueKey; eventsCount = -1): InternalRaisesFuture[\n seq[T], (AsyncEventQueueFullError, CancelledError)]

328
api/chronos/bipbuffer.html Normal file
View File

@ -0,0 +1,328 @@
<?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>chronos/bipbuffer</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">chronos/bipbuffer</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>
&nbsp;&nbsp;&nbsp; <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>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#7" id="57">Types</a>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#BipBuffer"
title="BipBuffer = object
a, b, r: BipPos
data: seq[byte]">BipBuffer</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">availSpace
<li><a class="reference" href="#availSpace%2CBipBuffer"
title="availSpace(bp: BipBuffer): Natural">availSpace(bp: BipBuffer): Natural</a></li>
</ul>
<ul class="simple nested-toc-section">commit
<li><a class="reference" href="#commit%2CBipBuffer%2CNatural"
title="commit(bp: var BipBuffer; size: Natural)">commit(bp: var BipBuffer; size: Natural)</a></li>
</ul>
<ul class="simple nested-toc-section">consume
<li><a class="reference" href="#consume%2CBipBuffer%2CNatural"
title="consume(bp: var BipBuffer; size: Natural)">consume(bp: var BipBuffer; size: Natural)</a></li>
</ul>
<ul class="simple nested-toc-section">init
<li><a class="reference" href="#init%2Ctypedesc%5BBipBuffer%5D%2Cint"
title="init(t: typedesc[BipBuffer]; size: int): BipBuffer">init(t: typedesc[BipBuffer]; size: int): BipBuffer</a></li>
</ul>
<ul class="simple nested-toc-section">len
<li><a class="reference" href="#len%2CBipBuffer"
title="len(bp: BipBuffer): Natural">len(bp: BipBuffer): Natural</a></li>
</ul>
<ul class="simple nested-toc-section">reserve
<li><a class="reference" href="#reserve%2CBipBuffer%2CNatural"
title="reserve(bp: var BipBuffer; size: Natural = 0): tuple[data: ptr byte,
size: Natural]">reserve(bp: var BipBuffer; size: Natural = 0): tuple[data: ptr byte,
size: Natural]</a></li>
</ul>
</ul>
</li>
<li>
<a class="reference reference-toplevel" href="#15" id="65">Iterators</a>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">items
<li><a class="reference" href="#items.i%2CBipBuffer"
title="items(bp: BipBuffer): byte">items(bp: BipBuffer): byte</a></li>
</ul>
<ul class="simple nested-toc-section">regions
<li><a class="reference" href="#regions.i%2CBipBuffer"
title="regions(bp: var BipBuffer): tuple[data: ptr byte, size: Natural]">regions(bp: var BipBuffer): tuple[data: ptr byte, size: Natural]</a></li>
</ul>
</ul>
</li>
</ul>
</div>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/bipbuffer.nim#L1"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/bipbuffer.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"><p>This module implements Bip Buffer (bi-partite circular buffer) by Simone Cooke.</p>
<p>The Bip-Buffer is like a circular buffer, but slightly different. Instead of keeping one head and tail pointer to the data in the buffer, it maintains two revolving regions, allowing for fast data access without having to worry about wrapping at the end of the buffer. Buffer allocations are always maintained as contiguous blocks, allowing the buffer to be used in a highly efficient manner with API calls, and also reducing the amount of copying which needs to be performed to put data into the buffer. Finally, a two-phase allocation system allows the user to pessimistically reserve an area of buffer space, and then trim back the buffer to commit to only the space which was used.</p>
<p><a class="reference external" href="https://www.codeproject.com/Articles/3479/The-Bip-Buffer-The-Circular-Buffer-with-a-Twist">https://www.codeproject.com/Articles/3479/The-Bip-Buffer-The-Circular-Buffer-with-a-Twist</a></p>
</p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="BipBuffer">
<dt><pre><a href="bipbuffer.html#BipBuffer"><span class="Identifier">BipBuffer</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">a</span><span class="Other">,</span> <span class="Identifier">b</span><span class="Other">,</span> <span class="Identifier">r</span><span class="Other">:</span> <span class="Identifier">BipPos</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>
</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/bipbuffer.nim#L33"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/bipbuffer.nim#L33" 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="availSpace,BipBuffer">
<dt><pre><span class="Keyword">func</span> <a href="#availSpace%2CBipBuffer"><span class="Identifier">availSpace</span></a><span class="Other">(</span><span class="Identifier">bp</span><span class="Other">:</span> <a href="bipbuffer.html#BipBuffer"><span class="Identifier">BipBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Natural</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns amount of space available for reserve in buffer <tt class="docutils literal"><span class="pre"><span class="Identifier">bp</span></span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/bipbuffer.nim#L60"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/bipbuffer.nim#L60" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="commit,BipBuffer,Natural">
<dt><pre><span class="Keyword">proc</span> <a href="#commit%2CBipBuffer%2CNatural"><span class="Identifier">commit</span></a><span class="Other">(</span><span class="Identifier">bp</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="bipbuffer.html#BipBuffer"><span class="Identifier">BipBuffer</span></a><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <span class="Identifier">Natural</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Updates structure's pointers when new data inserted into buffer.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/bipbuffer.nim#L95"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/bipbuffer.nim#L95" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="consume,BipBuffer,Natural">
<dt><pre><span class="Keyword">proc</span> <a href="#consume%2CBipBuffer%2CNatural"><span class="Identifier">consume</span></a><span class="Other">(</span><span class="Identifier">bp</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="bipbuffer.html#BipBuffer"><span class="Identifier">BipBuffer</span></a><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <span class="Identifier">Natural</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
The procedure removes/frees <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span></span></tt> bytes from the buffer <tt class="docutils literal"><span class="pre">bp</span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/bipbuffer.nim#L113"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/bipbuffer.nim#L113" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="init,typedesc[BipBuffer],int">
<dt><pre><span class="Keyword">proc</span> <a href="#init%2Ctypedesc%5BBipBuffer%5D%2Cint"><span class="Identifier">init</span></a><span class="Other">(</span><span class="Identifier">t</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="bipbuffer.html#BipBuffer"><span class="Identifier">BipBuffer</span></a><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <a href="bipbuffer.html#BipBuffer"><span class="Identifier">BipBuffer</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>.}</pre></dt>
<dd>
Creates new Bip Buffer with size <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span></span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/bipbuffer.nim#L37"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/bipbuffer.nim#L37" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="len,BipBuffer">
<dt><pre><span class="Keyword">func</span> <a href="#len%2CBipBuffer"><span class="Identifier">len</span></a><span class="Other">(</span><span class="Identifier">bp</span><span class="Other">:</span> <a href="bipbuffer.html#BipBuffer"><span class="Identifier">BipBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Natural</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/bipbuffer.nim#L65"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/bipbuffer.nim#L65" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="reserve,BipBuffer,Natural">
<dt><pre><span class="Keyword">proc</span> <a href="#reserve%2CBipBuffer%2CNatural"><span class="Identifier">reserve</span></a><span class="Other">(</span><span class="Identifier">bp</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="bipbuffer.html#BipBuffer"><span class="Identifier">BipBuffer</span></a><span class="Other">;</span> <span class="Identifier">size</span><span class="Other">:</span> <span class="Identifier">Natural</span> <span class="Other">=</span> <span class="DecNumber">0</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">data</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">byte</span><span class="Other">,</span>
<span class="Identifier">size</span><span class="Other">:</span> <span class="Identifier">Natural</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Reserve <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span></span></tt> bytes in buffer.</p>
<p>If <tt class="docutils literal"><span class="pre"><span class="Identifier">size</span> <span class="Operator">==</span> <span class="DecNumber">0</span></span></tt> (default) reserve all available space from buffer.</p>
<p>If there is not enough space in buffer for resevation - error will be returned.</p>
<p>Returns current reserved range as pointer of type <tt class="docutils literal"><span class="pre"><span class="Identifier">pt</span></span></tt> and size of type <tt class="docutils literal"><span class="pre"><span class="Identifier">st</span></span></tt>.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/bipbuffer.nim#L69"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/bipbuffer.nim#L69" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</dl></div>
<div class="section" id="15">
<h1><a class="toc-backref" href="#15">Iterators</a></h1>
<dl class="item">
<div id="items.i,BipBuffer">
<dt><pre><span class="Keyword">iterator</span> <a href="#items.i%2CBipBuffer"><span class="Identifier">items</span></a><span class="Other">(</span><span class="Identifier">bp</span><span class="Other">:</span> <a href="bipbuffer.html#BipBuffer"><span class="Identifier">BipBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">byte</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Iterates over all the bytes in the buffer.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/bipbuffer.nim#L128"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/bipbuffer.nim#L128" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="regions.i,BipBuffer">
<dt><pre><span class="Keyword">iterator</span> <a href="#regions.i%2CBipBuffer"><span class="Identifier">regions</span></a><span class="Other">(</span><span class="Identifier">bp</span><span class="Other">:</span> <span class="Keyword">var</span> <a href="bipbuffer.html#BipBuffer"><span class="Identifier">BipBuffer</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">data</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">byte</span><span class="Other">,</span> <span class="Identifier">size</span><span class="Other">:</span> <span class="Identifier">Natural</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Iterates over all the regions (<tt class="docutils literal"><span class="pre"><span class="Identifier">a</span></span></tt> and <tt class="docutils literal"><span class="pre"><span class="Identifier">b</span></span></tt>) in the buffer.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/bipbuffer.nim#L135"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/bipbuffer.nim#L135" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</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-11-28 08:22:46 UTC</small>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,9 @@
BipBuffer chronos/bipbuffer.html#BipBuffer bipbuffer: BipBuffer
init chronos/bipbuffer.html#init,typedesc[BipBuffer],int bipbuffer: init(t: typedesc[BipBuffer]; size: int): BipBuffer
availSpace chronos/bipbuffer.html#availSpace,BipBuffer bipbuffer: availSpace(bp: BipBuffer): Natural
len chronos/bipbuffer.html#len,BipBuffer bipbuffer: len(bp: BipBuffer): Natural
reserve chronos/bipbuffer.html#reserve,BipBuffer,Natural bipbuffer: reserve(bp: var BipBuffer; size: Natural = 0): tuple[data: ptr byte,\n size: Natural]
commit chronos/bipbuffer.html#commit,BipBuffer,Natural bipbuffer: commit(bp: var BipBuffer; size: Natural)
consume chronos/bipbuffer.html#consume,BipBuffer,Natural bipbuffer: consume(bp: var BipBuffer; size: Natural)
items chronos/bipbuffer.html#items.i,BipBuffer bipbuffer: items(bp: BipBuffer): byte
regions chronos/bipbuffer.html#regions.i,BipBuffer bipbuffer: regions(bp: var BipBuffer): tuple[data: ptr byte, size: Natural]

374
api/chronos/config.html Normal file
View File

@ -0,0 +1,374 @@
<?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>chronos/config</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">chronos/config</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>
&nbsp;&nbsp;&nbsp; <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>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#10" id="60">Consts</a>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#chronosDumpAsync"
title="chronosDumpAsync: bool = false">chronosDumpAsync</a></li>
<li><a class="reference" href="#chronosEventEngine"
title="chronosEventEngine: string = &quot;&quot;">chronosEventEngine</a></li>
<li><a class="reference" href="#chronosEventsCount"
title="chronosEventsCount = 64">chronosEventsCount</a></li>
<li><a class="reference" href="#chronosFutureId"
title="chronosFutureId: bool = false">chronosFutureId</a></li>
<li><a class="reference" href="#chronosFutureTracking"
title="chronosFutureTracking: bool = false">chronosFutureTracking</a></li>
<li><a class="reference" href="#chronosHandleException"
title="chronosHandleException: bool = false">chronosHandleException</a></li>
<li><a class="reference" href="#chronosHasRaises"
title="chronosHasRaises = 0">chronosHasRaises</a></li>
<li><a class="reference" href="#chronosInitialSize"
title="chronosInitialSize = 64">chronosInitialSize</a></li>
<li><a class="reference" href="#chronosProcShell"
title="chronosProcShell: string = &quot;/bin/sh&quot;">chronosProcShell</a></li>
<li><a class="reference" href="#chronosStackTrace"
title="chronosStackTrace: bool = false">chronosStackTrace</a></li>
<li><a class="reference" href="#chronosStreamDefaultBufferSize"
title="chronosStreamDefaultBufferSize = 16384">chronosStreamDefaultBufferSize</a></li>
<li><a class="reference" href="#chronosStrictFutureAccess"
title="chronosStrictFutureAccess: bool = false">chronosStrictFutureAccess</a></li>
<li><a class="reference" href="#chronosTLSSessionCacheBufferSize"
title="chronosTLSSessionCacheBufferSize = 4096">chronosTLSSessionCacheBufferSize</a></li>
<li><a class="reference" href="#chronosTransportDefaultBufferSize"
title="chronosTransportDefaultBufferSize = 16384">chronosTransportDefaultBufferSize</a></li>
</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">chronosMoveSink
<li><a class="reference" href="#chronosMoveSink.t%2Cauto"
title="chronosMoveSink(val: auto): untyped">chronosMoveSink(val: auto): untyped</a></li>
</ul>
</ul>
</li>
</ul>
</div>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L1"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"><p>Compile-time configuration options for chronos that control the availability of various strictness and debuggability options. In general, debug helpers are enabled when <tt class="docutils literal"><span class="pre"><span class="Identifier">debug</span></span></tt> is defined while strictness options are introduced in transition periods leading up to a breaking release that starts enforcing them and removes the option.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">chronosPreviewV4</span></span></tt> is a preview flag to enable v4 semantics - in particular, it enables strict exception checking and disables parts of the deprecated API and other changes being prepared for the upcoming release</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">chronosDebug</span></span></tt> can be defined to enable several debugging helpers that come with a runtime cost - it is recommeneded to not enable these in production code.</p>
<p>In this file we also declare feature flags starting with <tt class="docutils literal"><span class="pre"><span class="Identifier">chronosHas</span><span class="Operator">...</span></span></tt> - these constants are declared when a feature exists in a particular release - each flag is declared as an integer starting at 0 during experimental development, 1 when feature complete and higher numbers when significant functionality has been added. If a feature ends up being removed (or changed in a backwards-incompatible way), the feature flag will be removed or renamed also - you can use <tt class="docutils literal"><span class="pre"><span class="Keyword">when</span> <span class="Identifier">declared</span><span class="Punctuation">(</span><span class="Identifier">chronosHasXxx</span><span class="Punctuation">)</span><span class="Punctuation">:</span> <span class="Keyword">when</span> <span class="Identifier">chronosHasXxx</span> <span class="Operator">&gt;=</span> <span class="Identifier">N</span><span class="Punctuation">:</span></span></tt> to require a particular version.</p>
</p>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="chronosDumpAsync">
<dt><pre><a href="config.html#chronosDumpAsync"><span class="Identifier">chronosDumpAsync</span></a><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="DecNumber">false</span></pre></dt>
<dd>
Print code generated by {.async.} transformation
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L51"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L51" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="chronosEventEngine">
<dt><pre><a href="config.html#chronosEventEngine"><span class="Identifier">chronosEventEngine</span></a><span class="Other">:</span> <span class="Identifier">string</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span></pre></dt>
<dd>
OS polling engine type which is going to be used by chronos.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L74"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L74" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="chronosEventsCount">
<dt><pre><a href="config.html#chronosEventsCount"><span class="Identifier">chronosEventsCount</span></a> <span class="Other">=</span> <span class="DecNumber">64</span></pre></dt>
<dd>
Number of OS poll events retrieved by syscall (epoll, kqueue, poll).
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L68"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L68" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="chronosFutureId">
<dt><pre><a href="config.html#chronosFutureId"><span class="Identifier">chronosFutureId</span></a><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="DecNumber">false</span></pre></dt>
<dd>
Generate a unique <tt class="docutils literal"><span class="pre"><span class="Identifier">id</span></span></tt> for every future - when disabled, the address of the future will be used instead
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L43"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L43" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="chronosFutureTracking">
<dt><pre><a href="config.html#chronosFutureTracking"><span class="Identifier">chronosFutureTracking</span></a><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="DecNumber">false</span></pre></dt>
<dd>
Keep track of all pending futures and allow iterating over them - useful for detecting hung tasks
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L47"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L47" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="chronosHandleException">
<dt><pre><a href="config.html#chronosHandleException"><span class="Identifier">chronosHandleException</span></a><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="DecNumber">false</span></pre></dt>
<dd>
<p>Remap <tt class="docutils literal"><span class="pre"><span class="Identifier">Exception</span></span></tt> to <tt class="docutils literal"><span class="pre"><span class="Identifier">AsyncExceptionError</span></span></tt> for all <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span></span></tt> functions.</p>
<p>This modes provides backwards compatibility when using functions with inaccurate <tt class="docutils literal"><span class="pre"><span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">raises</span><span class="Operator">.</span><span class="Punctuation">}</span></span></tt> effects such as unannotated forward declarations, methods and <tt class="docutils literal"><span class="pre"><span class="Keyword">proc</span></span></tt> types - it is recommened to annotate such code explicitly as the <tt class="docutils literal"><span class="pre"><span class="Identifier">Exception</span></span></tt> handling mode may introduce surprising behavior in exception handlers, should <tt class="docutils literal"><span class="pre"><span class="Identifier">Exception</span></span></tt> actually be raised.</p>
<p>The setting provides the default for the per-function-based <tt class="docutils literal"><span class="pre"><span class="Identifier">handleException</span></span></tt> parameter which has precedence over this global setting.</p>
<p><tt class="docutils literal"><span class="pre"><span class="Identifier">Exception</span></span></tt> handling may be removed in future chronos versions.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L24"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L24" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="chronosHasRaises">
<dt><pre><a href="config.html#chronosHasRaises"><span class="Identifier">chronosHasRaises</span></a> <span class="Other">=</span> <span class="DecNumber">0</span></pre></dt>
<dd>
raises effect support via <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span><span class="Punctuation">:</span> <span class="Punctuation">(</span><span class="Identifier">raises</span><span class="Punctuation">:</span> <span class="Punctuation">[</span><span class="Punctuation">]</span><span class="Punctuation">)</span></span></tt>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L91"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L91" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="chronosInitialSize">
<dt><pre><a href="config.html#chronosInitialSize"><span class="Identifier">chronosInitialSize</span></a> <span class="Other">=</span> <span class="DecNumber">64</span></pre></dt>
<dd>
Initial size of Selector[T]'s array of file descriptors.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L71"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L71" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="chronosProcShell">
<dt><pre><a href="config.html#chronosProcShell"><span class="Identifier">chronosProcShell</span></a><span class="Other">:</span> <span class="Identifier">string</span> <span class="Other">=</span> <span class="StringLit">&quot;/bin/sh&quot;</span></pre></dt>
<dd>
<p>Default shell binary path.</p>
<p>The shell is used as command for command line when process started using <tt class="docutils literal"><span class="pre"><span class="Identifier">AsyncProcessOption</span><span class="Operator">.</span><span class="Identifier">EvalCommand</span></span></tt> and API calls such as <tt class="docutils literal"><span class="pre">execCommand(command)</span></tt> and <tt class="docutils literal"><span class="pre">execCommandEx(command)</span></tt>.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L54"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L54" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="chronosStackTrace">
<dt><pre><a href="config.html#chronosStackTrace"><span class="Identifier">chronosStackTrace</span></a><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="DecNumber">false</span></pre></dt>
<dd>
Include stack traces in futures for creation and completion points
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L40"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L40" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="chronosStreamDefaultBufferSize">
<dt><pre><a href="config.html#chronosStreamDefaultBufferSize"><span class="Identifier">chronosStreamDefaultBufferSize</span></a> <span class="Other">=</span> <span class="DecNumber">16384</span></pre></dt>
<dd>
Default size of chronos async stream internal buffer.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L97"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L97" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="chronosStrictFutureAccess">
<dt><pre><a href="config.html#chronosStrictFutureAccess"><span class="Identifier">chronosStrictFutureAccess</span></a><span class="Other">:</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="DecNumber">false</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L38"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L38" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="chronosTLSSessionCacheBufferSize">
<dt><pre><a href="config.html#chronosTLSSessionCacheBufferSize"><span class="Identifier">chronosTLSSessionCacheBufferSize</span></a> <span class="Other">=</span> <span class="DecNumber">4096</span></pre></dt>
<dd>
Default size of chronos TLS Session cache's internal buffer.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L100"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L100" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="chronosTransportDefaultBufferSize">
<dt><pre><a href="config.html#chronosTransportDefaultBufferSize"><span class="Identifier">chronosTransportDefaultBufferSize</span></a> <span class="Other">=</span> <span class="DecNumber">16384</span></pre></dt>
<dd>
Default size of chronos transport internal buffer.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L94"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L94" 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="chronosMoveSink.t,auto">
<dt><pre><span class="Keyword">template</span> <a href="#chronosMoveSink.t%2Cauto"><span class="Identifier">chronosMoveSink</span></a><span class="Other">(</span><span class="Identifier">val</span><span class="Other">:</span> <span class="Identifier">auto</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/config.nim#L158"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/config.nim#L158" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</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-11-28 08:22:46 UTC</small>
</div>
</div>
</div>
</div>
</body>
</html>

15
api/chronos/config.idx Normal file
View File

@ -0,0 +1,15 @@
chronosHandleException chronos/config.html#chronosHandleException config: chronosHandleException
chronosStrictFutureAccess chronos/config.html#chronosStrictFutureAccess config: chronosStrictFutureAccess
chronosStackTrace chronos/config.html#chronosStackTrace config: chronosStackTrace
chronosFutureId chronos/config.html#chronosFutureId config: chronosFutureId
chronosFutureTracking chronos/config.html#chronosFutureTracking config: chronosFutureTracking
chronosDumpAsync chronos/config.html#chronosDumpAsync config: chronosDumpAsync
chronosProcShell chronos/config.html#chronosProcShell config: chronosProcShell
chronosEventsCount chronos/config.html#chronosEventsCount config: chronosEventsCount
chronosInitialSize chronos/config.html#chronosInitialSize config: chronosInitialSize
chronosEventEngine chronos/config.html#chronosEventEngine config: chronosEventEngine
chronosHasRaises chronos/config.html#chronosHasRaises config: chronosHasRaises
chronosTransportDefaultBufferSize chronos/config.html#chronosTransportDefaultBufferSize config: chronosTransportDefaultBufferSize
chronosStreamDefaultBufferSize chronos/config.html#chronosStreamDefaultBufferSize config: chronosStreamDefaultBufferSize
chronosTLSSessionCacheBufferSize chronos/config.html#chronosTLSSessionCacheBufferSize config: chronosTLSSessionCacheBufferSize
chronosMoveSink chronos/config.html#chronosMoveSink.t,auto config: chronosMoveSink(val: auto): untyped

274
api/chronos/debugutils.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
AllFutureStates chronos/debugutils.html#AllFutureStates debugutils: AllFutureStates
WithoutCompleted chronos/debugutils.html#WithoutCompleted debugutils: WithoutCompleted
OnlyPending chronos/debugutils.html#OnlyPending debugutils: OnlyPending
OnlyCompleted chronos/debugutils.html#OnlyCompleted debugutils: OnlyCompleted
dumpPendingFutures chronos/debugutils.html#dumpPendingFutures debugutils: dumpPendingFutures(filter = AllFutureStates): string
pendingFuturesCount chronos/debugutils.html#pendingFuturesCount,set[FutureState] debugutils: pendingFuturesCount(filter: set[FutureState]): uint

743
api/chronos/futures.html Normal file
View File

@ -0,0 +1,743 @@
<?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>chronos/futures</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">chronos/futures</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>
&nbsp;&nbsp;&nbsp; <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>
<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="#CallbackFunc"
title="CallbackFunc = proc (arg: pointer) {.gcsafe, raises: [].}">CallbackFunc</a></li>
<li><a class="reference" href="#CancelledError"
title="CancelledError = object of FutureError">CancelledError</a></li>
<li><a class="reference" href="#Future"
title="Future[T] = ref object of FutureBase
when T isnot void:
internalValue*: T ## Stored value">Future</a></li>
<li><a class="reference" href="#FutureBase"
title="FutureBase = ref object of InternalFutureBase">FutureBase</a></li>
<li><a class="reference" href="#FutureDefect"
title="FutureDefect = object of Defect
cause*: FutureBase">FutureDefect</a></li>
<li><a class="reference" href="#FutureError"
title="FutureError = object of CatchableError
future*: FutureBase">FutureError</a></li>
<li><a class="reference" href="#FutureFlag"
title="FutureFlag {.pure.} = enum
OwnCancelSchedule ## When OwnCancelSchedule is set, the owner of the future is responsible
## for implementing cancellation in one of 3 ways:
##
## * ensure that cancellation requests never reach the future by means of
## not exposing it to user code, `await` and `tryCancel`
## * set `cancelCallback` to `nil` to stop cancellation propagation - this
## is appropriate when it is expected that the future will be completed
## in a regular way &quot;soon&quot;
## * set `cancelCallback` to a handler that implements cancellation in an
## operation-specific way
##
## If `cancelCallback` is not set and the future gets cancelled, a
## `Defect` will be raised.">FutureFlag</a></li>
<li><a class="reference" href="#FutureFlags"
title="FutureFlags = set[FutureFlag]">FutureFlags</a></li>
<li><a class="reference" href="#FutureState"
title="FutureState {.pure.} = enum
Pending, Completed, Cancelled, Failed">FutureState</a></li>
<li><a class="reference" href="#InternalAsyncCallback"
title="InternalAsyncCallback = object
function*: CallbackFunc
udata*: pointer">InternalAsyncCallback</a></li>
<li><a class="reference" href="#InternalFutureBase"
title="InternalFutureBase = object of RootObj
internalLocation*: array[LocationKind, ptr SrcLoc]
internalCallbacks*: seq[InternalAsyncCallback]
internalCancelcb*: CallbackFunc
internalChild*: FutureBase
internalState*: FutureState
internalFlags*: FutureFlags
internalError*: ref CatchableError ## Stored exception
internalClosure*: iterator (f: FutureBase): FutureBase {.raises: [], gcsafe.}
when chronosFutureId:
internalId*: uint
when chronosStackTrace:
internalErrorStackTrace*: StackTrace
internalStackTrace*: StackTrace ## For debugging purposes only.
when chronosFutureTracking:
internalNext*: FutureBase
internalPrev*: FutureBase">InternalFutureBase</a></li>
<li><a class="reference" href="#LocationKind"
title="LocationKind {.pure.} = enum
Create, Finish">LocationKind</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">cancelled
<li><a class="reference" href="#cancelled%2CFutureBase"
title="cancelled(future: FutureBase): bool">cancelled(future: FutureBase): bool</a></li>
</ul>
<ul class="simple nested-toc-section">completed
<li><a class="reference" href="#completed%2CFutureBase"
title="completed(future: FutureBase): bool">completed(future: FutureBase): bool</a></li>
</ul>
<ul class="simple nested-toc-section">error
<li><a class="reference" href="#error%2CFutureBase"
title="error(future: FutureBase): ref CatchableError">error(future: FutureBase): ref CatchableError</a></li>
</ul>
<ul class="simple nested-toc-section">failed
<li><a class="reference" href="#failed%2CFutureBase"
title="failed(future: FutureBase): bool">failed(future: FutureBase): bool</a></li>
</ul>
<ul class="simple nested-toc-section">finished
<li><a class="reference" href="#finished%2CFutureBase"
title="finished(future: FutureBase): bool">finished(future: FutureBase): bool</a></li>
</ul>
<ul class="simple nested-toc-section">flags
<li><a class="reference" href="#flags%2CFutureBase"
title="flags(future: FutureBase): FutureFlags">flags(future: FutureBase): FutureFlags</a></li>
</ul>
<ul class="simple nested-toc-section">internalInitFutureBase
<li><a class="reference" href="#internalInitFutureBase%2CFutureBase%2Cptr.SrcLoc%2CFutureState%2CFutureFlags"
title="internalInitFutureBase(fut: FutureBase; loc: ptr SrcLoc; state: FutureState;
flags: FutureFlags)">internalInitFutureBase(fut: FutureBase; loc: ptr SrcLoc; state: FutureState;
flags: FutureFlags)</a></li>
</ul>
<ul class="simple nested-toc-section">location
<li><a class="reference" href="#location%2CFutureBase"
title="location(future: FutureBase): array[LocationKind, ptr SrcLoc]">location(future: FutureBase): array[LocationKind, ptr SrcLoc]</a></li>
</ul>
<ul class="simple nested-toc-section">state
<li><a class="reference" href="#state%2CFutureBase"
title="state(future: FutureBase): FutureState">state(future: FutureBase): FutureState</a></li>
</ul>
<ul class="simple nested-toc-section">value
<li><a class="reference" href="#value%2CFuture%5Bvoid%5D"
title="value(future: Future[void])">value(future: Future[void])</a></li>
<li><a class="reference" href="#value%2CFuture%5BT%3A%20not%20void%5D"
title="value[T: not void](future: Future[T]): lent T">value[T: not void](future: Future[T]): lent 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">completed
<li><a class="reference" href="#completed.t%2CtypeFuture%2Cstatic%5Bstring%5D"
title="completed(F: type Future; fromProc: static[string] = &quot;&quot;): Future[void]">completed(F: type Future; fromProc: static[string] = &quot;&quot;): Future[void]</a></li>
<li><a class="reference" href="#completed.t%2CtypeFuture%2CT%2Cstatic%5Bstring%5D"
title="completed[T: not void](F: type Future; valueParam: T;
fromProc: static[string] = &quot;&quot;): Future[T]">completed[T: not void](F: type Future; valueParam: T;
fromProc: static[string] = &quot;&quot;): Future[T]</a></li>
</ul>
<ul class="simple nested-toc-section">failed
<li><a class="reference" href="#failed.t%2CtypeFuture%5BT%5D%2Cref.CatchableError%2Cstatic%5Bstring%5D"
title="failed[T](F: type Future[T]; errorParam: ref CatchableError;
fromProc: static[string] = &quot;&quot;): Future[T]">failed[T](F: type Future[T]; errorParam: ref CatchableError;
fromProc: static[string] = &quot;&quot;): Future[T]</a></li>
</ul>
<ul class="simple nested-toc-section">id
<li><a class="reference" href="#id.t%2CFutureBase"
title="id(fut: FutureBase): uint">id(fut: FutureBase): uint</a></li>
</ul>
<ul class="simple nested-toc-section">init
<li><a class="reference" href="#init.t%2CtypeFuture%5BT%5D%2Cstatic%5Bstring%5D"
title="init[T](F: type Future[T]; fromProc: static[string] = &quot;&quot;): Future[T]">init[T](F: type Future[T]; fromProc: static[string] = &quot;&quot;): Future[T]</a></li>
<li><a class="reference" href="#init.t%2CtypeFuture%5BT%5D%2Cstatic%5Bstring%5D%2Cstatic%5BFutureFlags%5D"
title="init[T](F: type Future[T]; fromProc: static[string] = &quot;&quot;;
flags: static[FutureFlags]): Future[T]">init[T](F: type Future[T]; fromProc: static[string] = &quot;&quot;;
flags: static[FutureFlags]): Future[T]</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>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L1"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="config.html">config</a>, <a class="reference external" href="srcloc.html">srcloc</a>
</dl></div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="CallbackFunc">
<dt><pre><a href="futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</span></a> <span class="Other">=</span> <span class="Keyword">proc</span> <span class="Other">(</span><span class="Identifier">arg</span><span class="Other">:</span> <span class="Identifier">pointer</span><span class="Other">)</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">gcsafe</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L25"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L25" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="CancelledError">
<dt><pre><a href="futures.html#CancelledError"><span class="Identifier">CancelledError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="futures.html#FutureError"><span class="Identifier">FutureError</span></a>
</pre></dt>
<dd>
Exception raised when accessing the value of a cancelled future
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L91"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L91" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="Future">
<dt><pre><a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a>
<span class="Keyword">when</span> <span class="Identifier">T</span> <span class="Keyword">isnot</span> <span class="Identifier">void</span><span class="Other">:</span>
<span class="Identifier">internalValue</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">T</span> <span class="Comment">## Stored value</span>
</pre></dt>
<dd>
Typed future.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L81"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L81" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="FutureBase">
<dt><pre><a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="futures.html#InternalFutureBase"><span class="Identifier">InternalFutureBase</span></a>
</pre></dt>
<dd>
Untyped Future
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L78"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L78" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="FutureDefect">
<dt><pre><a href="futures.html#FutureDefect"><span class="Identifier">FutureDefect</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">Defect</span>
<span class="Identifier">cause</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a>
</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L85"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L85" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="FutureError">
<dt><pre><a href="futures.html#FutureError"><span class="Identifier">FutureError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">CatchableError</span>
<span class="Identifier">future</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a>
</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L88"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L88" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="FutureFlag">
<dt><pre><a href="futures.html#FutureFlag"><span class="Identifier">FutureFlag</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">OwnCancelSchedule</span> <span class="Comment">## When OwnCancelSchedule is set, the owner of the future is responsible</span>
<span class="Comment">## for implementing cancellation in one of 3 ways:</span>
<span class="Comment">## </span>
<span class="Comment">## * ensure that cancellation requests never reach the future by means of</span>
<span class="Comment">## not exposing it to user code, `await` and `tryCancel`</span>
<span class="Comment">## * set `cancelCallback` to `nil` to stop cancellation propagation - this</span>
<span class="Comment">## is appropriate when it is expected that the future will be completed</span>
<span class="Comment">## in a regular way &quot;soon&quot;</span>
<span class="Comment">## * set `cancelCallback` to a handler that implements cancellation in an</span>
<span class="Comment">## operation-specific way</span>
<span class="Comment">## </span>
<span class="Comment">## If `cancelCallback` is not set and the future gets cancelled, a</span>
<span class="Comment">## `Defect` will be raised.</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L35"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L35" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="FutureFlags">
<dt><pre><a href="futures.html#FutureFlags"><span class="Identifier">FutureFlags</span></a> <span class="Other">=</span> <span class="Identifier">set</span><span class="Other">[</span><a href="futures.html#FutureFlag"><span class="Identifier">FutureFlag</span></a><span class="Other">]</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L51"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L51" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="FutureState">
<dt><pre><a href="futures.html#FutureState"><span class="Identifier">FutureState</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">Pending</span><span class="Other">,</span> <span class="Identifier">Completed</span><span class="Other">,</span> <span class="Identifier">Cancelled</span><span class="Other">,</span> <span class="Identifier">Failed</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L32"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L32" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="InternalAsyncCallback">
<dt><pre><a href="futures.html#InternalAsyncCallback"><span class="Identifier">InternalAsyncCallback</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">function</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</span></a>
<span class="Identifier">udata</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">pointer</span>
</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L28"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L28" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="InternalFutureBase">
<dt><pre><a href="futures.html#InternalFutureBase"><span class="Identifier">InternalFutureBase</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">RootObj</span>
<span class="Identifier">internalLocation</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="Identifier">LocationKind</span><span class="Other">,</span> <span class="Keyword">ptr</span> <a href="srcloc.html#SrcLoc"><span class="Identifier">SrcLoc</span></a><span class="Other">]</span>
<span class="Identifier">internalCallbacks</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">seq</span><span class="Other">[</span><a href="futures.html#InternalAsyncCallback"><span class="Identifier">InternalAsyncCallback</span></a><span class="Other">]</span>
<span class="Identifier">internalCancelcb</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#CallbackFunc"><span class="Identifier">CallbackFunc</span></a>
<span class="Identifier">internalChild</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a>
<span class="Identifier">internalState</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#FutureState"><span class="Identifier">FutureState</span></a>
<span class="Identifier">internalFlags</span><span class="Operator">*</span><span class="Other">:</span> <a href="futures.html#FutureFlags"><span class="Identifier">FutureFlags</span></a>
<span class="Identifier">internalError</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">CatchableError</span> <span class="Comment">## Stored exception</span>
<span class="Identifier">internalClosure</span><span class="Operator">*</span><span class="Other">:</span> <span class="Keyword">iterator</span> <span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</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 class="Identifier">gcsafe</span></span>.}
<span class="Keyword">when</span> <span class="Identifier">chronosFutureId</span><span class="Other">:</span>
<span class="Identifier">internalId</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">uint</span>
<span class="Keyword">when</span> <span class="Identifier">chronosStackTrace</span><span class="Other">:</span>
<span class="Identifier">internalErrorStackTrace</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">StackTrace</span>
<span class="Identifier">internalStackTrace</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">StackTrace</span> <span class="Comment">## For debugging purposes only.</span>
<span class="Keyword">when</span> <span class="Identifier">chronosFutureTracking</span><span class="Other">:</span>
<span class="Identifier">internalNext</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">FutureBase</span>
<span class="Identifier">internalPrev</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">FutureBase</span>
</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L53"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L53" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="LocationKind">
<dt><pre><a href="futures.html#LocationKind"><span class="Identifier">LocationKind</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">Create</span><span class="Other">,</span> <span class="Identifier">Finish</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L21"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L21" 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="cancelled,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#cancelled%2CFutureBase"><span class="Identifier">cancelled</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Determines whether <tt class="docutils literal"><span class="pre">future</span></tt> has cancelled.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L210"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L210" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="completed,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#completed%2CFutureBase"><span class="Identifier">completed</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Determines whether <tt class="docutils literal"><span class="pre">future</span></tt> finished with a value.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L218"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L218" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="error,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#error%2CFutureBase"><span class="Identifier">error</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">CatchableError</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Return the error of <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt>, or <tt class="docutils literal"><span class="pre"><span class="Keyword">nil</span></span></tt> if future did not fail.</p>
<p>See <tt class="docutils literal"><span class="pre"><span class="Identifier">readError</span></span></tt> for a version that raises a catchable error when the future has not failed.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L247"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L247" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="failed,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#failed%2CFutureBase"><span class="Identifier">failed</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Determines whether <tt class="docutils literal"><span class="pre">future</span></tt> finished with an error.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L214"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L214" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="finished,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#finished%2CFutureBase"><span class="Identifier">finished</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Determines whether <tt class="docutils literal"><span class="pre">future</span></tt> has finished, i.e. <tt class="docutils literal"><span class="pre">future</span></tt> state changed from state <tt class="docutils literal"><span class="pre">Pending</span></tt> to one of the states (<tt class="docutils literal"><span class="pre">Finished</span></tt>, <tt class="docutils literal"><span class="pre">Cancelled</span></tt>, <tt class="docutils literal"><span class="pre">Failed</span></tt>).
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L204"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L204" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="flags,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#flags%2CFutureBase"><span class="Identifier">flags</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <a href="futures.html#FutureFlags"><span class="Identifier">FutureFlags</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L201"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L201" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="internalInitFutureBase,FutureBase,ptr.SrcLoc,FutureState,FutureFlags">
<dt><pre><span class="Keyword">proc</span> <a href="#internalInitFutureBase%2CFutureBase%2Cptr.SrcLoc%2CFutureState%2CFutureFlags"><span class="Identifier">internalInitFutureBase</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">;</span> <span class="Identifier">loc</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="srcloc.html#SrcLoc"><span class="Identifier">SrcLoc</span></a><span class="Other">;</span>
<span class="Identifier">state</span><span class="Other">:</span> <a href="futures.html#FutureState"><span class="Identifier">FutureState</span></a><span class="Other">;</span> <span class="Identifier">flags</span><span class="Other">:</span> <a href="futures.html#FutureFlags"><span class="Identifier">FutureFlags</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L115"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L115" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="location,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#location%2CFutureBase"><span class="Identifier">location</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="Identifier">LocationKind</span><span class="Other">,</span> <span class="Keyword">ptr</span> <a href="srcloc.html#SrcLoc"><span class="Identifier">SrcLoc</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L222"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L222" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="state,FutureBase">
<dt><pre><span class="Keyword">func</span> <a href="#state%2CFutureBase"><span class="Identifier">state</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <a href="futures.html#FutureState"><span class="Identifier">FutureState</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L198"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L198" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="value,Future[void]">
<dt><pre><span class="Keyword">func</span> <a href="#value%2CFuture%5Bvoid%5D"><span class="Identifier">value</span></a><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Return the value in a completed future - raises Defect when <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span><span class="Operator">.</span><span class="Identifier">completed</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> is <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt>.</p>
<p>See <tt class="docutils literal"><span class="pre"><span class="Identifier">read</span></span></tt> for a version that raises a catchable error when future has not completed.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L237"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L237" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="value,Future[T: not void]">
<dt><pre><span class="Keyword">func</span> <a href="#value%2CFuture%5BT%3A%20not%20void%5D"><span class="Identifier">value</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Keyword">not</span> <span class="Identifier">void</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">lent</span> <span class="Identifier">T</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>.}</pre></dt>
<dd>
<p>Return the value in a completed future - raises Defect when <tt class="docutils literal"><span class="pre"><span class="Identifier">fut</span><span class="Operator">.</span><span class="Identifier">completed</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> is <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt>.</p>
<p>See <tt class="docutils literal"><span class="pre"><span class="Identifier">read</span></span></tt> for a version that raises a catchable error when future has not completed.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L225"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L225" 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="completed.t,typeFuture,static[string]">
<dt><pre><span class="Keyword">template</span> <a href="#completed.t%2CtypeFuture%2Cstatic%5Bstring%5D"><span class="Identifier">completed</span></a><span class="Other">(</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Keyword">type</span> <span class="Identifier">Future</span><span class="Other">;</span> <span class="Identifier">fromProc</span><span class="Other">:</span> <span class="Identifier">static</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span><span class="Other">:</span> <a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">void</span><span class="Other">]</span></pre></dt>
<dd>
Create a new completed future
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L168"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L168" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="completed.t,typeFuture,T,static[string]">
<dt><pre><span class="Keyword">template</span> <a href="#completed.t%2CtypeFuture%2CT%2Cstatic%5Bstring%5D"><span class="Identifier">completed</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Keyword">not</span> <span class="Identifier">void</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Keyword">type</span> <span class="Identifier">Future</span><span class="Other">;</span> <span class="Identifier">valueParam</span><span class="Other">:</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">fromProc</span><span class="Other">:</span> <span class="Identifier">static</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span><span class="Other">:</span> <a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span></pre></dt>
<dd>
Create a new completed future
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L176"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L176" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="failed.t,typeFuture[T],ref.CatchableError,static[string]">
<dt><pre><span class="Keyword">template</span> <a href="#failed.t%2CtypeFuture%5BT%5D%2Cref.CatchableError%2Cstatic%5Bstring%5D"><span class="Identifier">failed</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Keyword">type</span> <a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">errorParam</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">CatchableError</span><span class="Other">;</span>
<span class="Identifier">fromProc</span><span class="Other">:</span> <span class="Identifier">static</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span><span class="Other">:</span> <a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span></pre></dt>
<dd>
Create a new failed future
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L184"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L184" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="id.t,FutureBase">
<dt><pre><span class="Keyword">template</span> <a href="#id.t%2CFutureBase"><span class="Identifier">id</span></a><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="futures.html#FutureBase"><span class="Identifier">FutureBase</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">uint</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L102"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L102" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="init.t,typeFuture[T],static[string]">
<dt><pre><span class="Keyword">template</span> <a href="#init.t%2CtypeFuture%5BT%5D%2Cstatic%5Bstring%5D"><span class="Identifier">init</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Keyword">type</span> <a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">fromProc</span><span class="Other">:</span> <span class="Identifier">static</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span><span class="Other">:</span> <a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span></pre></dt>
<dd>
<p>Creates a new pending future.</p>
<p>Specifying <tt class="docutils literal"><span class="pre">fromProc</span></tt>, which is a string specifying the name of the proc that this future belongs to, is a good habit as it helps with debugging.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L148"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L148" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="init.t,typeFuture[T],static[string],static[FutureFlags]">
<dt><pre><span class="Keyword">template</span> <a href="#init.t%2CtypeFuture%5BT%5D%2Cstatic%5Bstring%5D%2Cstatic%5BFutureFlags%5D"><span class="Identifier">init</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Keyword">type</span> <a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">fromProc</span><span class="Other">:</span> <span class="Identifier">static</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">;</span>
<span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">static</span><span class="Other">[</span><a href="futures.html#FutureFlags"><span class="Identifier">FutureFlags</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span></pre></dt>
<dd>
<p>Creates a new pending future.</p>
<p>Specifying <tt class="docutils literal"><span class="pre">fromProc</span></tt>, which is a string specifying the name of the proc that this future belongs to, is a good habit as it helps with debugging.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/futures.nim#L157"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/futures.nim#L157" 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="srcloc.html#$,ptr.SrcLoc"><span class="Identifier">$</span></a>, <a href="srcloc.html#SrcLoc"><span class="Identifier">SrcLoc</span></a>, <a href="srcloc.html#getSrcLocation.t,staticstring"><span class="Identifier">getSrcLocation</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-11-28 08:22:46 UTC</small>
</div>
</div>
</div>
</div>
</body>
</html>

29
api/chronos/futures.idx Normal file
View File

@ -0,0 +1,29 @@
LocationKind chronos/futures.html#LocationKind futures: LocationKind
CallbackFunc chronos/futures.html#CallbackFunc futures: CallbackFunc
InternalAsyncCallback chronos/futures.html#InternalAsyncCallback futures: InternalAsyncCallback
FutureState chronos/futures.html#FutureState futures: FutureState
FutureFlag chronos/futures.html#FutureFlag futures: FutureFlag
FutureFlags chronos/futures.html#FutureFlags futures: FutureFlags
InternalFutureBase chronos/futures.html#InternalFutureBase futures: InternalFutureBase
FutureBase chronos/futures.html#FutureBase futures: FutureBase
Future chronos/futures.html#Future futures: Future
FutureDefect chronos/futures.html#FutureDefect futures: FutureDefect
FutureError chronos/futures.html#FutureError futures: FutureError
CancelledError chronos/futures.html#CancelledError futures: CancelledError
id chronos/futures.html#id.t,FutureBase futures: id(fut: FutureBase): uint
internalInitFutureBase chronos/futures.html#internalInitFutureBase,FutureBase,ptr.SrcLoc,FutureState,FutureFlags futures: internalInitFutureBase(fut: FutureBase; loc: ptr SrcLoc; state: FutureState;\n flags: FutureFlags)
init chronos/futures.html#init.t,typeFuture[T],static[string] futures: init[T](F: type Future[T]; fromProc: static[string] = &quot;&quot;): Future[T]
init chronos/futures.html#init.t,typeFuture[T],static[string],static[FutureFlags] futures: init[T](F: type Future[T]; fromProc: static[string] = &quot;&quot;;\n flags: static[FutureFlags]): Future[T]
completed chronos/futures.html#completed.t,typeFuture,static[string] futures: completed(F: type Future; fromProc: static[string] = &quot;&quot;): Future[void]
completed chronos/futures.html#completed.t,typeFuture,T,static[string] futures: completed[T: not void](F: type Future; valueParam: T;\n fromProc: static[string] = &quot;&quot;): Future[T]
failed chronos/futures.html#failed.t,typeFuture[T],ref.CatchableError,static[string] futures: failed[T](F: type Future[T]; errorParam: ref CatchableError;\n fromProc: static[string] = &quot;&quot;): Future[T]
state chronos/futures.html#state,FutureBase futures: state(future: FutureBase): FutureState
flags chronos/futures.html#flags,FutureBase futures: flags(future: FutureBase): FutureFlags
finished chronos/futures.html#finished,FutureBase futures: finished(future: FutureBase): bool
cancelled chronos/futures.html#cancelled,FutureBase futures: cancelled(future: FutureBase): bool
failed chronos/futures.html#failed,FutureBase futures: failed(future: FutureBase): bool
completed chronos/futures.html#completed,FutureBase futures: completed(future: FutureBase): bool
location chronos/futures.html#location,FutureBase futures: location(future: FutureBase): array[LocationKind, ptr SrcLoc]
value chronos/futures.html#value,Future[T: not void] futures: value[T: not void](future: Future[T]): lent T
value chronos/futures.html#value,Future[void] futures: value(future: Future[void])
error chronos/futures.html#error,FutureBase futures: error(future: FutureBase): ref CatchableError

648
api/chronos/handles.html Normal file
View File

@ -0,0 +1,648 @@
<?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>chronos/handles</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">chronos/handles</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>
&nbsp;&nbsp;&nbsp; <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>
<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="#10" id="60">Consts</a>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#asyncInvalidPipe"
title="asyncInvalidPipe = -1'i32">asyncInvalidPipe</a></li>
<li><a class="reference" href="#asyncInvalidSocket"
title="asyncInvalidSocket = -1'i32">asyncInvalidSocket</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">createAsyncPipe
<li><a class="reference" href="#createAsyncPipe"
title="createAsyncPipe(): tuple[read: AsyncFD, write: AsyncFD]">createAsyncPipe(): tuple[read: AsyncFD, write: AsyncFD]</a></li>
</ul>
<ul class="simple nested-toc-section">createAsyncSocket
<li><a class="reference" href="#createAsyncSocket%2CDomain%2CSockType%2CProtocol"
title="createAsyncSocket(domain: Domain; sockType: SockType; protocol: Protocol;
inherit = true): AsyncFD">createAsyncSocket(domain: Domain; sockType: SockType; protocol: Protocol;
inherit = true): AsyncFD</a></li>
</ul>
<ul class="simple nested-toc-section">createAsyncSocket2
<li><a class="reference" href="#createAsyncSocket2%2CDomain%2CSockType%2CProtocol"
title="createAsyncSocket2(domain: Domain; sockType: SockType; protocol: Protocol;
inherit = true): Result[AsyncFD, OSErrorCode]">createAsyncSocket2(domain: Domain; sockType: SockType; protocol: Protocol;
inherit = true): Result[AsyncFD, OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">getDualstack
<li><a class="reference" href="#getDualstack%2CAsyncFD"
title="getDualstack(fd: AsyncFD): Result[bool, OSErrorCode]">getDualstack(fd: AsyncFD): Result[bool, OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">getInheritable
<li><a class="reference" href="#getInheritable%2CAsyncFD"
title="getInheritable(fd: AsyncFD): Result[bool, OSErrorCode]">getInheritable(fd: AsyncFD): Result[bool, OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">getMaxOpenFiles
<li><a class="reference" href="#getMaxOpenFiles"
title="getMaxOpenFiles(): int">getMaxOpenFiles(): int</a></li>
</ul>
<ul class="simple nested-toc-section">getMaxOpenFiles2
<li><a class="reference" href="#getMaxOpenFiles2"
title="getMaxOpenFiles2(): Result[int, OSErrorCode]">getMaxOpenFiles2(): Result[int, OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">getSocketError
<li><a class="reference" href="#getSocketError%2CAsyncFD%2Cint"
title="getSocketError(socket: AsyncFD; err: var int): bool">getSocketError(socket: AsyncFD; err: var int): bool</a></li>
</ul>
<ul class="simple nested-toc-section">getSocketError2
<li><a class="reference" href="#getSocketError2%2CAsyncFD"
title="getSocketError2(socket: AsyncFD): Result[cint, OSErrorCode]">getSocketError2(socket: AsyncFD): Result[cint, OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">getSockOpt
<li><a class="reference" href="#getSockOpt%2CAsyncFD%2Cint%2Cint%2Cint"
title="getSockOpt(socket: AsyncFD; level, optname: int; value: var int): bool">getSockOpt(socket: AsyncFD; level, optname: int; value: var int): bool</a></li>
<li><a class="reference" href="#getSockOpt%2CAsyncFD%2Cint%2Cint%2Cpointer%2Cint"
title="getSockOpt(socket: AsyncFD; level, optname: int; value: var pointer;
valuelen: var int): bool">getSockOpt(socket: AsyncFD; level, optname: int; value: var pointer;
valuelen: var int): bool</a></li>
</ul>
<ul class="simple nested-toc-section">getSockOpt2
<li><a class="reference" href="#getSockOpt2%2CAsyncFD%2Cint%2Cint"
title="getSockOpt2(socket: AsyncFD; level, optname: int): Result[cint, OSErrorCode]">getSockOpt2(socket: AsyncFD; level, optname: int): Result[cint, OSErrorCode]</a></li>
<li><a class="reference" href="#getSockOpt2%2CAsyncFD%2Cint%2Cint%2Ctype"
title="getSockOpt2(socket: AsyncFD; level, optname: int; T: type): Result[T,
OSErrorCode]">getSockOpt2(socket: AsyncFD; level, optname: int; T: type): Result[T,
OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">isAvailable
<li><a class="reference" href="#isAvailable%2CDomain"
title="isAvailable(domain: Domain): bool">isAvailable(domain: Domain): bool</a></li>
</ul>
<ul class="simple nested-toc-section">setDualstack
<li><a class="reference" href="#setDualstack%2CAsyncFD%2Cbool"
title="setDualstack(fd: AsyncFD; value: bool): Result[void, OSErrorCode]">setDualstack(fd: AsyncFD; value: bool): Result[void, OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">setMaxOpenFiles
<li><a class="reference" href="#setMaxOpenFiles%2Cint"
title="setMaxOpenFiles(count: int)">setMaxOpenFiles(count: int)</a></li>
</ul>
<ul class="simple nested-toc-section">setMaxOpenFiles2
<li><a class="reference" href="#setMaxOpenFiles2%2Cint"
title="setMaxOpenFiles2(count: int): Result[void, OSErrorCode]">setMaxOpenFiles2(count: int): Result[void, OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">setSocketBlocking
<li><a class="reference" href="#setSocketBlocking%2CSocketHandle%2Cbool"
title="setSocketBlocking(s: SocketHandle; blocking: bool): bool">setSocketBlocking(s: SocketHandle; blocking: bool): bool</a></li>
</ul>
<ul class="simple nested-toc-section">setSockOpt
<li><a class="reference" href="#setSockOpt%2CAsyncFD%2Cint%2Cint%2Cint"
title="setSockOpt(socket: AsyncFD; level, optname, optval: int): bool">setSockOpt(socket: AsyncFD; level, optname, optval: int): bool</a></li>
<li><a class="reference" href="#setSockOpt%2CAsyncFD%2Cint%2Cint%2Cpointer%2Cint"
title="setSockOpt(socket: AsyncFD; level, optname: int; value: pointer; valuelen: int): bool">setSockOpt(socket: AsyncFD; level, optname: int; value: pointer; valuelen: int): bool</a></li>
</ul>
<ul class="simple nested-toc-section">setSockOpt2
<li><a class="reference" href="#setSockOpt2%2CAsyncFD%2Cint%2Cint%2Cint"
title="setSockOpt2(socket: AsyncFD; level, optname, optval: int): Result[void,
OSErrorCode]">setSockOpt2(socket: AsyncFD; level, optname, optval: int): Result[void,
OSErrorCode]</a></li>
<li><a class="reference" href="#setSockOpt2%2CAsyncFD%2Cint%2Cint%2Cpointer%2Cint"
title="setSockOpt2(socket: AsyncFD; level, optname: int; value: pointer; valuelen: int): Result[
void, OSErrorCode]">setSockOpt2(socket: AsyncFD; level, optname: int; value: pointer; valuelen: int): Result[
void, OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">wrapAsyncSocket
<li><a class="reference" href="#wrapAsyncSocket"
title="wrapAsyncSocket(sock: cint | SocketHandle): AsyncFD">wrapAsyncSocket(sock: cint | SocketHandle): AsyncFD</a></li>
</ul>
<ul class="simple nested-toc-section">wrapAsyncSocket2
<li><a class="reference" href="#wrapAsyncSocket2"
title="wrapAsyncSocket2(sock: cint | SocketHandle): Result[AsyncFD, OSErrorCode]">wrapAsyncSocket2(sock: cint | SocketHandle): Result[AsyncFD, OSErrorCode]</a></li>
</ul>
</ul>
</li>
</ul>
</div>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L1"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="asyncloop.html">asyncloop</a>, <a class="reference external" href="osdefs.html">osdefs</a>, <a class="reference external" href="osutils.html">osutils</a>
</dl></div>
<div class="section" id="10">
<h1><a class="toc-backref" href="#10">Consts</a></h1>
<dl class="item">
<div id="asyncInvalidPipe">
<dt><pre><a href="handles.html#asyncInvalidPipe"><span class="Identifier">asyncInvalidPipe</span></a> <span class="Other">=</span> <span class="DecNumber">-1'i32</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L22"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L22" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="asyncInvalidSocket">
<dt><pre><a href="handles.html#asyncInvalidSocket"><span class="Identifier">asyncInvalidSocket</span></a> <span class="Other">=</span> <span class="DecNumber">-1'i32</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L21"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L21" 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="createAsyncPipe">
<dt><pre><span class="Keyword">proc</span> <a href="#createAsyncPipe"><span class="Identifier">createAsyncPipe</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">read</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">,</span> <span class="Identifier">write</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Create new asynchronouse pipe. Returns tuple of read pipe handle and write pipe handle<tt class="docutils literal"><span class="pre">asyncInvalidPipe</span></tt> on error.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L264"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L264" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="createAsyncSocket,Domain,SockType,Protocol">
<dt><pre><span class="Keyword">proc</span> <a href="#createAsyncSocket%2CDomain%2CSockType%2CProtocol"><span class="Identifier">createAsyncSocket</span></a><span class="Other">(</span><span class="Identifier">domain</span><span class="Other">:</span> <span class="Identifier">Domain</span><span class="Other">;</span> <span class="Identifier">sockType</span><span class="Other">:</span> <span class="Identifier">SockType</span><span class="Other">;</span> <span class="Identifier">protocol</span><span class="Other">:</span> <span class="Identifier">Protocol</span><span class="Other">;</span>
<span class="Identifier">inherit</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">)</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Creates new asynchronous socket. Returns <tt class="docutils literal"><span class="pre">asyncInvalidSocket</span></tt> on error.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L188"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L188" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="createAsyncSocket2,Domain,SockType,Protocol">
<dt><pre><span class="Keyword">proc</span> <a href="#createAsyncSocket2%2CDomain%2CSockType%2CProtocol"><span class="Identifier">createAsyncSocket2</span></a><span class="Other">(</span><span class="Identifier">domain</span><span class="Other">:</span> <span class="Identifier">Domain</span><span class="Other">;</span> <span class="Identifier">sockType</span><span class="Other">:</span> <span class="Identifier">SockType</span><span class="Other">;</span> <span class="Identifier">protocol</span><span class="Other">:</span> <span class="Identifier">Protocol</span><span class="Other">;</span>
<span class="Identifier">inherit</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Creates new asynchronous socket.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L128"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L128" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="getDualstack,AsyncFD">
<dt><pre><span class="Keyword">proc</span> <a href="#getDualstack%2CAsyncFD"><span class="Identifier">getDualstack</span></a><span class="Other">(</span><span class="Identifier">fd</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt> if <tt class="docutils literal"><span class="pre"><span class="Identifier">IPV6_V6ONLY</span></span></tt> socket option set to <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L275"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L275" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="getInheritable,AsyncFD">
<dt><pre><span class="Keyword">proc</span> <a href="#getInheritable%2CAsyncFD"><span class="Identifier">getInheritable</span></a><span class="Other">(</span><span class="Identifier">fd</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Returns <tt class="docutils literal"><span class="pre">true</span></tt> if <tt class="docutils literal"><span class="pre">fd</span></tt> is inheritable handle.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L251"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L251" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="getMaxOpenFiles">
<dt><pre><span class="Keyword">proc</span> <a href="#getMaxOpenFiles"><span class="Identifier">getMaxOpenFiles</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</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="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns maximum file descriptor number that can be opened by this process.</p>
<p>Note: On Windows its impossible to obtain such number, so getMaxOpenFiles() will return constant value of 16384. You can get more information on this link <a class="reference external" href="https://docs.microsoft.com/en-us/archive/blogs/markrussinovich/pushing-the-limits-of-windows-handles">https://docs.microsoft.com/en-us/archive/blogs/markrussinovich/pushing-the-limits-of-windows-handles</a></p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L232"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L232" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="getMaxOpenFiles2">
<dt><pre><span class="Keyword">proc</span> <a href="#getMaxOpenFiles2"><span class="Identifier">getMaxOpenFiles2</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">int</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Returns maximum file descriptor number that can be opened by this process.</p>
<p>Note: On Windows its impossible to obtain such number, so getMaxOpenFiles() will return constant value of 16384. You can get more information on this link <a class="reference external" href="https://docs.microsoft.com/en-us/archive/blogs/markrussinovich/pushing-the-limits-of-windows-handles">https://docs.microsoft.com/en-us/archive/blogs/markrussinovich/pushing-the-limits-of-windows-handles</a></p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L203"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L203" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="getSocketError,AsyncFD,int">
<dt><pre><span class="Keyword">proc</span> <a href="#getSocketError%2CAsyncFD%2Cint"><span class="Identifier">getSocketError</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">;</span> <span class="Identifier">err</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">&quot;Please use getSocketError() instead&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<div class="deprecation-message">
<b>Deprecated:</b> Please use getSocketError() instead
</div>
Recover error code associated with socket handle <tt class="docutils literal"><span class="pre">socket</span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L101"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L101" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="getSocketError2,AsyncFD">
<dt><pre><span class="Keyword">proc</span> <a href="#getSocketError2%2CAsyncFD"><span class="Identifier">getSocketError2</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">cint</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L109"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L109" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="getSockOpt,AsyncFD,int,int,int">
<dt><pre><span class="Keyword">proc</span> <a href="#getSockOpt%2CAsyncFD%2Cint%2Cint%2Cint"><span class="Identifier">getSockOpt</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">;</span> <span class="Identifier">level</span><span class="Other">,</span> <span class="Identifier">optname</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="Keyword">var</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">&quot;Please use getSockOpt2() instead&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<div class="deprecation-message">
<b>Deprecated:</b> Please use getSockOpt2() instead
</div>
<tt class="docutils literal"><span class="pre"><span class="Identifier">getsockopt</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> for integer options. Returns <tt class="docutils literal"><span class="pre">true</span></tt> on success, <tt class="docutils literal"><span class="pre">false</span></tt> on error.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L85"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L85" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="getSockOpt,AsyncFD,int,int,pointer,int">
<dt><pre><span class="Keyword">proc</span> <a href="#getSockOpt%2CAsyncFD%2Cint%2Cint%2Cpointer%2Cint"><span class="Identifier">getSockOpt</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">;</span> <span class="Identifier">level</span><span class="Other">,</span> <span class="Identifier">optname</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="Keyword">var</span> <span class="Identifier">pointer</span><span class="Other">;</span>
<span class="Identifier">valuelen</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">&quot;Please use getSockOpt2() instead&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<div class="deprecation-message">
<b>Deprecated:</b> Please use getSockOpt2() instead
</div>
<tt class="docutils literal"><span class="pre"><span class="Identifier">getsockopt</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> for custom options (pointer and length). Returns <tt class="docutils literal"><span class="pre">true</span></tt> on success, <tt class="docutils literal"><span class="pre">false</span></tt> on error.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L93"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L93" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="getSockOpt2,AsyncFD,int,int">
<dt><pre><span class="Keyword">proc</span> <a href="#getSockOpt2%2CAsyncFD%2Cint%2Cint"><span class="Identifier">getSockOpt2</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">;</span> <span class="Identifier">level</span><span class="Other">,</span> <span class="Identifier">optname</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">cint</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L63"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L63" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="getSockOpt2,AsyncFD,int,int,type">
<dt><pre><span class="Keyword">proc</span> <a href="#getSockOpt2%2CAsyncFD%2Cint%2Cint%2Ctype"><span class="Identifier">getSockOpt2</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">;</span> <span class="Identifier">level</span><span class="Other">,</span> <span class="Identifier">optname</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">type</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>
<span class="Identifier">OSErrorCode</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>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L74"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L74" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="isAvailable,Domain">
<dt><pre><span class="Keyword">proc</span> <a href="#isAvailable%2CDomain"><span class="Identifier">isAvailable</span></a><span class="Other">(</span><span class="Identifier">domain</span><span class="Other">:</span> <span class="Identifier">Domain</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L112"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L112" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="setDualstack,AsyncFD,bool">
<dt><pre><span class="Keyword">proc</span> <a href="#setDualstack%2CAsyncFD%2Cbool"><span class="Identifier">setDualstack</span></a><span class="Other">(</span><span class="Identifier">fd</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">bool</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Sets <tt class="docutils literal"><span class="pre"><span class="Identifier">IPV6_V6ONLY</span></span></tt> socket option value to <tt class="docutils literal"><span class="pre"><span class="Identifier">false</span></span></tt> if <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span> <span class="Operator">==</span> <span class="Identifier">true</span></span></tt> and to <tt class="docutils literal"><span class="pre"><span class="Identifier">true</span></span></tt> if <tt class="docutils literal"><span class="pre"><span class="Identifier">value</span> <span class="Operator">==</span> <span class="Identifier">false</span></span></tt>.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L286"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L286" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="setMaxOpenFiles,int">
<dt><pre><span class="Keyword">proc</span> <a href="#setMaxOpenFiles%2Cint"><span class="Identifier">setMaxOpenFiles</span></a><span class="Other">(</span><span class="Identifier">count</span><span class="Other">:</span> <span class="Identifier">int</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="Identifier">OSError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Set maximum file descriptor number that can be opened by this process.</p>
<p>Note: On Windows its impossible to set this value, so it just a nop call.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L243"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L243" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="setMaxOpenFiles2,int">
<dt><pre><span class="Keyword">proc</span> <a href="#setMaxOpenFiles2%2Cint"><span class="Identifier">setMaxOpenFiles2</span></a><span class="Other">(</span><span class="Identifier">count</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Set maximum file descriptor number that can be opened by this process.</p>
<p>Note: On Windows its impossible to set this value, so it just a nop call.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L217"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L217" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="setSocketBlocking,SocketHandle,bool">
<dt><pre><span class="Keyword">proc</span> <a href="#setSocketBlocking%2CSocketHandle%2Cbool"><span class="Identifier">setSocketBlocking</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">SocketHandle</span><span class="Other">;</span> <span class="Identifier">blocking</span><span class="Other">:</span> <span class="Identifier">bool</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">&quot;Please use setDescriptorBlocking() instead&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span>
<span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<div class="deprecation-message">
<b>Deprecated:</b> Please use setDescriptorBlocking() instead
</div>
Sets blocking mode on socket.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L24"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L24" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="setSockOpt,AsyncFD,int,int,int">
<dt><pre><span class="Keyword">proc</span> <a href="#setSockOpt%2CAsyncFD%2Cint%2Cint%2Cint"><span class="Identifier">setSockOpt</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">;</span> <span class="Identifier">level</span><span class="Other">,</span> <span class="Identifier">optname</span><span class="Other">,</span> <span class="Identifier">optval</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.
<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">&quot;Please use setSockOpt2() instead&quot;</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<div class="deprecation-message">
<b>Deprecated:</b> Please use setSockOpt2() instead
</div>
<tt class="docutils literal"><span class="pre"><span class="Identifier">setsockopt</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> for integer options. Returns <tt class="docutils literal"><span class="pre">true</span></tt> on success, <tt class="docutils literal"><span class="pre">false</span></tt> on error.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L50"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L50" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="setSockOpt,AsyncFD,int,int,pointer,int">
<dt><pre><span class="Keyword">proc</span> <a href="#setSockOpt%2CAsyncFD%2Cint%2Cint%2Cpointer%2Cint"><span class="Identifier">setSockOpt</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">;</span> <span class="Identifier">level</span><span class="Other">,</span> <span class="Identifier">optname</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">pointer</span><span class="Other">;</span>
<span class="Identifier">valuelen</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span><span class="Other pragmadots">...</span></span><span class="pragmawrap"><span class="Identifier">deprecated</span><span class="Other">:</span> <span class="StringLit">&quot;Please use setSockOpt2() instead&quot;</span><span class="Other">,</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<div class="deprecation-message">
<b>Deprecated:</b> Please use setSockOpt2() instead
</div>
<tt class="docutils literal"><span class="pre"><span class="Identifier">setsockopt</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> for custom options (pointer and length). Returns <tt class="docutils literal"><span class="pre">true</span></tt> on success, <tt class="docutils literal"><span class="pre">false</span></tt> on error.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L56"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L56" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="setSockOpt2,AsyncFD,int,int,int">
<dt><pre><span class="Keyword">proc</span> <a href="#setSockOpt2%2CAsyncFD%2Cint%2Cint%2Cint"><span class="Identifier">setSockOpt2</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">;</span> <span class="Identifier">level</span><span class="Other">,</span> <span class="Identifier">optname</span><span class="Other">,</span> <span class="Identifier">optval</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span>
<span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L31"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L31" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="setSockOpt2,AsyncFD,int,int,pointer,int">
<dt><pre><span class="Keyword">proc</span> <a href="#setSockOpt2%2CAsyncFD%2Cint%2Cint%2Cpointer%2Cint"><span class="Identifier">setSockOpt2</span></a><span class="Other">(</span><span class="Identifier">socket</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">;</span> <span class="Identifier">level</span><span class="Other">,</span> <span class="Identifier">optname</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">pointer</span><span class="Other">;</span>
<span class="Identifier">valuelen</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<tt class="docutils literal"><span class="pre"><span class="Identifier">setsockopt</span><span class="Punctuation">(</span><span class="Punctuation">)</span></span></tt> for custom options (pointer and length). Returns <tt class="docutils literal"><span class="pre">true</span></tt> on success, <tt class="docutils literal"><span class="pre">false</span></tt> on error.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L40"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L40" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="wrapAsyncSocket">
<dt><pre><span class="Keyword">proc</span> <a href="#wrapAsyncSocket"><span class="Identifier">wrapAsyncSocket</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <span class="Identifier">cint</span> <span class="Operator">|</span> <span class="Identifier">SocketHandle</span><span class="Other">)</span><span class="Other">:</span> <a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</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="Identifier">CatchableError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
Wraps socket to asynchronous socket handle. Return <tt class="docutils literal"><span class="pre">asyncInvalidSocket</span></tt> on error.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L196"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L196" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="wrapAsyncSocket2">
<dt><pre><span class="Keyword">proc</span> <a href="#wrapAsyncSocket2"><span class="Identifier">wrapAsyncSocket2</span></a><span class="Other">(</span><span class="Identifier">sock</span><span class="Other">:</span> <span class="Identifier">cint</span> <span class="Operator">|</span> <span class="Identifier">SocketHandle</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><a href="internal/asyncengine.html#AsyncFD"><span class="Identifier">AsyncFD</span></a><span class="Other">,</span> <span class="Identifier">OSErrorCode</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>.}</pre></dt>
<dd>
Wraps socket to asynchronous socket handle.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/handles.nim#L177"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/handles.nim#L177" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</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-11-28 08:22:46 UTC</small>
</div>
</div>
</div>
</div>
</body>
</html>

26
api/chronos/handles.idx Normal file
View File

@ -0,0 +1,26 @@
asyncInvalidSocket chronos/handles.html#asyncInvalidSocket handles: asyncInvalidSocket
asyncInvalidPipe chronos/handles.html#asyncInvalidPipe handles: asyncInvalidPipe
setSocketBlocking chronos/handles.html#setSocketBlocking,SocketHandle,bool handles: setSocketBlocking(s: SocketHandle; blocking: bool): bool
setSockOpt2 chronos/handles.html#setSockOpt2,AsyncFD,int,int,int handles: setSockOpt2(socket: AsyncFD; level, optname, optval: int): Result[void,\n OSErrorCode]
setSockOpt2 chronos/handles.html#setSockOpt2,AsyncFD,int,int,pointer,int handles: setSockOpt2(socket: AsyncFD; level, optname: int; value: pointer; valuelen: int): Result[\n void, OSErrorCode]
setSockOpt chronos/handles.html#setSockOpt,AsyncFD,int,int,int handles: setSockOpt(socket: AsyncFD; level, optname, optval: int): bool
setSockOpt chronos/handles.html#setSockOpt,AsyncFD,int,int,pointer,int handles: setSockOpt(socket: AsyncFD; level, optname: int; value: pointer; valuelen: int): bool
getSockOpt2 chronos/handles.html#getSockOpt2,AsyncFD,int,int handles: getSockOpt2(socket: AsyncFD; level, optname: int): Result[cint, OSErrorCode]
getSockOpt2 chronos/handles.html#getSockOpt2,AsyncFD,int,int,type handles: getSockOpt2(socket: AsyncFD; level, optname: int; T: type): Result[T,\n OSErrorCode]
getSockOpt chronos/handles.html#getSockOpt,AsyncFD,int,int,int handles: getSockOpt(socket: AsyncFD; level, optname: int; value: var int): bool
getSockOpt chronos/handles.html#getSockOpt,AsyncFD,int,int,pointer,int handles: getSockOpt(socket: AsyncFD; level, optname: int; value: var pointer;\n valuelen: var int): bool
getSocketError chronos/handles.html#getSocketError,AsyncFD,int handles: getSocketError(socket: AsyncFD; err: var int): bool
getSocketError2 chronos/handles.html#getSocketError2,AsyncFD handles: getSocketError2(socket: AsyncFD): Result[cint, OSErrorCode]
isAvailable chronos/handles.html#isAvailable,Domain handles: isAvailable(domain: Domain): bool
createAsyncSocket2 chronos/handles.html#createAsyncSocket2,Domain,SockType,Protocol handles: createAsyncSocket2(domain: Domain; sockType: SockType; protocol: Protocol;\n inherit = true): Result[AsyncFD, OSErrorCode]
wrapAsyncSocket2 chronos/handles.html#wrapAsyncSocket2 handles: wrapAsyncSocket2(sock: cint | SocketHandle): Result[AsyncFD, OSErrorCode]
createAsyncSocket chronos/handles.html#createAsyncSocket,Domain,SockType,Protocol handles: createAsyncSocket(domain: Domain; sockType: SockType; protocol: Protocol;\n inherit = true): AsyncFD
wrapAsyncSocket chronos/handles.html#wrapAsyncSocket handles: wrapAsyncSocket(sock: cint | SocketHandle): AsyncFD
getMaxOpenFiles2 chronos/handles.html#getMaxOpenFiles2 handles: getMaxOpenFiles2(): Result[int, OSErrorCode]
setMaxOpenFiles2 chronos/handles.html#setMaxOpenFiles2,int handles: setMaxOpenFiles2(count: int): Result[void, OSErrorCode]
getMaxOpenFiles chronos/handles.html#getMaxOpenFiles handles: getMaxOpenFiles(): int
setMaxOpenFiles chronos/handles.html#setMaxOpenFiles,int handles: setMaxOpenFiles(count: int)
getInheritable chronos/handles.html#getInheritable,AsyncFD handles: getInheritable(fd: AsyncFD): Result[bool, OSErrorCode]
createAsyncPipe chronos/handles.html#createAsyncPipe handles: createAsyncPipe(): tuple[read: AsyncFD, write: AsyncFD]
getDualstack chronos/handles.html#getDualstack,AsyncFD handles: getDualstack(fd: AsyncFD): Result[bool, OSErrorCode]
setDualstack chronos/handles.html#setDualstack,AsyncFD,bool handles: setDualstack(fd: AsyncFD; value: bool): Result[void, OSErrorCode]

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,53 @@
MaxEventsCount chronos/internal/asyncengine.html#MaxEventsCount asyncengine: MaxEventsCount
AsyncCallback chronos/internal/asyncengine.html#AsyncCallback asyncengine: AsyncCallback
TimerCallback chronos/internal/asyncengine.html#TimerCallback asyncengine: TimerCallback
TrackerBase chronos/internal/asyncengine.html#TrackerBase asyncengine: TrackerBase
TrackerCounter chronos/internal/asyncengine.html#TrackerCounter asyncengine: TrackerCounter
getAsyncTimestamp chronos/internal/asyncengine.html#getAsyncTimestamp,Duration asyncengine: getAsyncTimestamp(a: Duration): auto
raiseAsDefect chronos/internal/asyncengine.html#raiseAsDefect,ref.Exception,string asyncengine: raiseAsDefect(exc: ref Exception; msg: string)
raiseOsDefect chronos/internal/asyncengine.html#raiseOsDefect,OSErrorCode,string asyncengine: raiseOsDefect(error: OSErrorCode; msg = &quot;&quot;)
toException chronos/internal/asyncengine.html#toException,OSErrorCode asyncengine: toException(v: OSErrorCode): ref OSError
PDispatcher chronos/internal/asyncengine.html#PDispatcher asyncengine: PDispatcher
AsyncFD chronos/internal/asyncengine.html#AsyncFD asyncengine: AsyncFD
newDispatcher chronos/internal/asyncengine.html#newDispatcher asyncengine: newDispatcher(): PDispatcher
poll chronos/internal/asyncengine.html#poll asyncengine: poll()
register2 chronos/internal/asyncengine.html#register2,AsyncFD asyncengine: register2(fd: AsyncFD): Result[void, OSErrorCode]
unregister2 chronos/internal/asyncengine.html#unregister2,AsyncFD asyncengine: unregister2(fd: AsyncFD): Result[void, OSErrorCode]
addReader2 chronos/internal/asyncengine.html#addReader2,AsyncFD,CallbackFunc,pointer asyncengine: addReader2(fd: AsyncFD; cb: CallbackFunc; udata: pointer = nil): Result[void,\n OSErrorCode]
removeReader2 chronos/internal/asyncengine.html#removeReader2,AsyncFD asyncengine: removeReader2(fd: AsyncFD): Result[void, OSErrorCode]
addWriter2 chronos/internal/asyncengine.html#addWriter2,AsyncFD,CallbackFunc,pointer asyncengine: addWriter2(fd: AsyncFD; cb: CallbackFunc; udata: pointer = nil): Result[void,\n OSErrorCode]
removeWriter2 chronos/internal/asyncengine.html#removeWriter2,AsyncFD asyncengine: removeWriter2(fd: AsyncFD): Result[void, OSErrorCode]
closeHandle chronos/internal/asyncengine.html#closeHandle,AsyncFD,CallbackFunc asyncengine: closeHandle(fd: AsyncFD; aftercb: CallbackFunc = nil)
closeSocket chronos/internal/asyncengine.html#closeSocket,AsyncFD,CallbackFunc asyncengine: closeSocket(fd: AsyncFD; aftercb: CallbackFunc = nil)
unregisterAndCloseFd chronos/internal/asyncengine.html#unregisterAndCloseFd,AsyncFD asyncengine: unregisterAndCloseFd(fd: AsyncFD): Result[void, OSErrorCode]
`==` chronos/internal/asyncengine.html#==,AsyncFD,AsyncFD asyncengine: `==`(x: AsyncFD; y: AsyncFD): bool
setThreadDispatcher chronos/internal/asyncengine.html#setThreadDispatcher,PDispatcher asyncengine: setThreadDispatcher(disp: PDispatcher)
getThreadDispatcher chronos/internal/asyncengine.html#getThreadDispatcher asyncengine: getThreadDispatcher(): PDispatcher
setGlobalDispatcher chronos/internal/asyncengine.html#setGlobalDispatcher,PDispatcher asyncengine: setGlobalDispatcher(disp: PDispatcher)
getGlobalDispatcher chronos/internal/asyncengine.html#getGlobalDispatcher asyncengine: getGlobalDispatcher(): PDispatcher
setTimer chronos/internal/asyncengine.html#setTimer,Moment,CallbackFunc,pointer asyncengine: setTimer(at: Moment; cb: CallbackFunc; udata: pointer = nil): TimerCallback
clearTimer chronos/internal/asyncengine.html#clearTimer,TimerCallback asyncengine: clearTimer(timer: TimerCallback)
addTimer chronos/internal/asyncengine.html#addTimer,Moment,CallbackFunc,pointer asyncengine: addTimer(at: Moment; cb: CallbackFunc; udata: pointer = nil)
addTimer chronos/internal/asyncengine.html#addTimer,int64,CallbackFunc,pointer asyncengine: addTimer(at: int64; cb: CallbackFunc; udata: pointer = nil)
addTimer chronos/internal/asyncengine.html#addTimer,uint64,CallbackFunc,pointer asyncengine: addTimer(at: uint64; cb: CallbackFunc; udata: pointer = nil)
removeTimer chronos/internal/asyncengine.html#removeTimer,Moment,CallbackFunc,pointer asyncengine: removeTimer(at: Moment; cb: CallbackFunc; udata: pointer = nil)
removeTimer chronos/internal/asyncengine.html#removeTimer,int64,CallbackFunc,pointer asyncengine: removeTimer(at: int64; cb: CallbackFunc; udata: pointer = nil)
removeTimer chronos/internal/asyncengine.html#removeTimer,uint64,CallbackFunc,pointer asyncengine: removeTimer(at: uint64; cb: CallbackFunc; udata: pointer = nil)
callSoon chronos/internal/asyncengine.html#callSoon,InternalAsyncCallback asyncengine: callSoon(acb: AsyncCallback)
callSoon chronos/internal/asyncengine.html#callSoon,CallbackFunc,pointer asyncengine: callSoon(cbproc: CallbackFunc; data: pointer)
callSoon chronos/internal/asyncengine.html#callSoon,CallbackFunc asyncengine: callSoon(cbproc: CallbackFunc)
callIdle chronos/internal/asyncengine.html#callIdle,InternalAsyncCallback asyncengine: callIdle(acb: AsyncCallback)
callIdle chronos/internal/asyncengine.html#callIdle,CallbackFunc,pointer asyncengine: callIdle(cbproc: CallbackFunc; data: pointer)
callIdle chronos/internal/asyncengine.html#callIdle,CallbackFunc asyncengine: callIdle(cbproc: CallbackFunc)
internalCallTick chronos/internal/asyncengine.html#internalCallTick,InternalAsyncCallback asyncengine: internalCallTick(acb: AsyncCallback)
internalCallTick chronos/internal/asyncengine.html#internalCallTick,CallbackFunc,pointer asyncengine: internalCallTick(cbproc: CallbackFunc; data: pointer)
internalCallTick chronos/internal/asyncengine.html#internalCallTick,CallbackFunc asyncengine: internalCallTick(cbproc: CallbackFunc)
runForever chronos/internal/asyncengine.html#runForever asyncengine: runForever()
addTracker chronos/internal/asyncengine.html#addTracker,string,T asyncengine: addTracker[T](id: string; tracker: T)
getTracker chronos/internal/asyncengine.html#getTracker,string asyncengine: getTracker(id: string): TrackerBase
trackCounter chronos/internal/asyncengine.html#trackCounter,string asyncengine: trackCounter(name: string)
untrackCounter chronos/internal/asyncengine.html#untrackCounter,string asyncengine: untrackCounter(name: string)
getTrackerCounter chronos/internal/asyncengine.html#getTrackerCounter,string asyncengine: getTrackerCounter(name: string): TrackerCounter
isCounterLeaked chronos/internal/asyncengine.html#isCounterLeaked,string asyncengine: isCounterLeaked(name: string): bool
trackerCounters chronos/internal/asyncengine.html#trackerCounters.i,PDispatcher asyncengine: trackerCounters(loop: PDispatcher): tuple[name: string, value: TrackerCounter]
trackerCounterKeys chronos/internal/asyncengine.html#trackerCounterKeys.i,PDispatcher asyncengine: trackerCounterKeys(loop: PDispatcher): string

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,80 @@
LocCreateIndex chronos/internal/asyncfutures.html#LocCreateIndex.t asyncfutures: LocCreateIndex(): auto
LocFinishIndex chronos/internal/asyncfutures.html#LocFinishIndex.t asyncfutures: LocFinishIndex(): auto
LocCompleteIndex chronos/internal/asyncfutures.html#LocCompleteIndex.t asyncfutures: LocCompleteIndex(): untyped
`[]` chronos/internal/asyncfutures.html#[],array[LocationKind,ptr.SrcLoc],int asyncfutures: `[]`(loc: array[LocationKind, ptr SrcLoc]; v: int): ptr SrcLoc
FutureStr chronos/internal/asyncfutures.html#FutureStr asyncfutures: FutureStr
FutureSeq chronos/internal/asyncfutures.html#FutureSeq asyncfutures: FutureSeq
FuturePendingError chronos/internal/asyncfutures.html#FuturePendingError asyncfutures: FuturePendingError
FutureCompletedError chronos/internal/asyncfutures.html#FutureCompletedError asyncfutures: FutureCompletedError
Finished chronos/internal/asyncfutures.html#Finished.t asyncfutures: Finished()
Finished chronos/internal/asyncfutures.html#Finished.t,typeFutureState asyncfutures: Finished(T: type FutureState): FutureState
newFuture chronos/internal/asyncfutures.html#newFuture.t,static[string],static[FutureFlags] asyncfutures: newFuture[T](fromProc: static[string] = &quot;&quot;; flags: static[FutureFlags] = {}): auto
newInternalRaisesFuture chronos/internal/asyncfutures.html#newInternalRaisesFuture.t,static[string] asyncfutures: newInternalRaisesFuture[T, E](fromProc: static[string] = &quot;&quot;): auto
newFutureSeq chronos/internal/asyncfutures.html#newFutureSeq.t,static[string] asyncfutures: newFutureSeq[A, B](fromProc: static[string] = &quot;&quot;): FutureSeq[A, B]
newFutureStr chronos/internal/asyncfutures.html#newFutureStr.t,static[string] asyncfutures: newFutureStr[T](fromProc: static[string] = &quot;&quot;): FutureStr[T]
done chronos/internal/asyncfutures.html#done,FutureBase asyncfutures: done(future: FutureBase): bool
complete chronos/internal/asyncfutures.html#complete.t,Future[T],T asyncfutures: complete[T](future: Future[T]; val: T)
complete chronos/internal/asyncfutures.html#complete.t,Future[void] asyncfutures: complete(future: Future[void])
fail chronos/internal/asyncfutures.html#fail.t,Future[T],ref.CatchableError,staticbool asyncfutures: fail[T](future: Future[T]; error: ref CatchableError; warn: static bool = false)
fail chronos/internal/asyncfutures.html#fail.t,InternalRaisesFuture[T,E],ref.CatchableError,staticbool asyncfutures: fail[T, E](future: InternalRaisesFuture[T, E]; error: ref CatchableError;\n warn: static bool = true)
cancelAndSchedule chronos/internal/asyncfutures.html#cancelAndSchedule.t,FutureBase asyncfutures: cancelAndSchedule(future: FutureBase)
tryCancel chronos/internal/asyncfutures.html#tryCancel.t,FutureBase asyncfutures: tryCancel(future: FutureBase): bool
addCallback chronos/internal/asyncfutures.html#addCallback,FutureBase,CallbackFunc,pointer asyncfutures: addCallback(future: FutureBase; cb: CallbackFunc; udata: pointer)
addCallback chronos/internal/asyncfutures.html#addCallback,FutureBase,CallbackFunc asyncfutures: addCallback(future: FutureBase; cb: CallbackFunc)
removeCallback chronos/internal/asyncfutures.html#removeCallback,FutureBase,CallbackFunc,pointer asyncfutures: removeCallback(future: FutureBase; cb: CallbackFunc; udata: pointer)
removeCallback chronos/internal/asyncfutures.html#removeCallback,FutureBase,CallbackFunc asyncfutures: removeCallback(future: FutureBase; cb: CallbackFunc)
callback= chronos/internal/asyncfutures.html#callback=,FutureBase,CallbackFunc,pointer asyncfutures: callback=(future: FutureBase; cb: CallbackFunc; udata: pointer)
callback= chronos/internal/asyncfutures.html#callback=,FutureBase,CallbackFunc asyncfutures: callback=(future: FutureBase; cb: CallbackFunc)
cancelCallback= chronos/internal/asyncfutures.html#cancelCallback=,FutureBase,CallbackFunc asyncfutures: cancelCallback=(future: FutureBase; cb: CallbackFunc)
futureContinue chronos/internal/asyncfutures.html#futureContinue,FutureBase asyncfutures: futureContinue(fut: FutureBase)
internalRaiseIfError chronos/internal/asyncfutures.html#internalRaiseIfError.m,FutureBase,typed asyncfutures: internalRaiseIfError(fut: FutureBase; info: typed)
internalRaiseIfError chronos/internal/asyncfutures.html#internalRaiseIfError.m,InternalRaisesFuture,typed,typed asyncfutures: internalRaiseIfError(fut: InternalRaisesFuture; raises, info: typed)
read chronos/internal/asyncfutures.html#read,Future[T: not void] asyncfutures: read[T: not void](fut: Future[T]): lent T
read chronos/internal/asyncfutures.html#read,Future[void] asyncfutures: read(fut: Future[void])
readError chronos/internal/asyncfutures.html#readError,FutureBase asyncfutures: readError(fut: FutureBase): ref CatchableError
waitFor chronos/internal/asyncfutures.html#waitFor,Future[T: not void] asyncfutures: waitFor[T: not void](fut: Future[T]): lent T
waitFor chronos/internal/asyncfutures.html#waitFor,Future[void] asyncfutures: waitFor(fut: Future[void])
asyncSpawn chronos/internal/asyncfutures.html#asyncSpawn,Future[void] asyncfutures: asyncSpawn(future: Future[void])
asyncCheck chronos/internal/asyncfutures.html#asyncCheck,Future[T] asyncfutures: asyncCheck[T](future: Future[T])
asyncDiscard chronos/internal/asyncfutures.html#asyncDiscard,Future[T] asyncfutures: asyncDiscard[T](future: Future[T])
`and` chronos/internal/asyncfutures.html#and,Future[T],Future[Y] asyncfutures: `and`[T, Y](fut1: Future[T]; fut2: Future[Y]): Future[void]
orImpl chronos/internal/asyncfutures.html#orImpl.t,Future[T],Future[Y] asyncfutures: orImpl[T, Y](fut1: Future[T]; fut2: Future[Y]): untyped
`or` chronos/internal/asyncfutures.html#or,Future[T],Future[Y] asyncfutures: `or`[T, Y](fut1: Future[T]; fut2: Future[Y]): Future[void]
all chronos/internal/asyncfutures.html#all,varargs[Future[T]] asyncfutures: all[T](futs: varargs[Future[T]]): auto
oneIndex chronos/internal/asyncfutures.html#oneIndex,varargs[Future[T]] asyncfutures: oneIndex[T](futs: varargs[Future[T]]): Future[int]
oneValue chronos/internal/asyncfutures.html#oneValue,varargs[Future[T]] asyncfutures: oneValue[T](futs: varargs[Future[T]]): Future[T]
cancelSoon chronos/internal/asyncfutures.html#cancelSoon.t,FutureBase,CallbackFunc,pointer asyncfutures: cancelSoon(fut: FutureBase; cb: CallbackFunc; udata: pointer)
cancelSoon chronos/internal/asyncfutures.html#cancelSoon.t,FutureBase,CallbackFunc asyncfutures: cancelSoon(fut: FutureBase; cb: CallbackFunc)
cancelSoon chronos/internal/asyncfutures.html#cancelSoon.t,FutureBase,InternalAsyncCallback asyncfutures: cancelSoon(fut: FutureBase; acb: AsyncCallback)
cancelSoon chronos/internal/asyncfutures.html#cancelSoon.t,FutureBase asyncfutures: cancelSoon(fut: FutureBase)
cancel chronos/internal/asyncfutures.html#cancel.t,FutureBase asyncfutures: cancel(future: FutureBase)
cancelAndWait chronos/internal/asyncfutures.html#cancelAndWait,FutureBase,ptr.SrcLoc asyncfutures: cancelAndWait(future: FutureBase; loc: ptr SrcLoc): InternalRaisesFuture[void,\n void]
cancelAndWait chronos/internal/asyncfutures.html#cancelAndWait.t,FutureBase asyncfutures: cancelAndWait(future: FutureBase): Future[void].Raising([])
noCancel chronos/internal/asyncfutures.html#noCancel,F asyncfutures: noCancel[F: SomeFuture](future: F): auto
allFutures chronos/internal/asyncfutures.html#allFutures,varargs[FutureBase] asyncfutures: allFutures(futs: varargs[FutureBase]): InternalRaisesFuture[void,\n (CancelledError,)]
allFutures chronos/internal/asyncfutures.html#allFutures,varargs[Future[T]] asyncfutures: allFutures[T](futs: varargs[Future[T]]): InternalRaisesFuture[void,\n (CancelledError,)]
allFutures chronos/internal/asyncfutures.html#allFutures,varargs[InternalRaisesFuture[T,E]] asyncfutures: allFutures[T, E](futs: varargs[InternalRaisesFuture[T, E]]): InternalRaisesFuture[\n void, (CancelledError,)]
allFinished chronos/internal/asyncfutures.html#allFinished,varargs[F] asyncfutures: allFinished[F: SomeFuture](futs: varargs[F]): InternalRaisesFuture[seq[F],\n (CancelledError,)]
one chronos/internal/asyncfutures.html#one,F,varargs[F] asyncfutures: one[F: SomeFuture](fut0: F; futs: varargs[F]): InternalRaisesFuture[F,\n (CancelledError,)]
one chronos/internal/asyncfutures.html#one,openArray[F] asyncfutures: one[F: SomeFuture](futs: openArray[F]): InternalRaisesFuture[F,\n (ValueError, CancelledError)]
race chronos/internal/asyncfutures.html#race,FutureBase,varargs[FutureBase] asyncfutures: race(fut0: FutureBase; futs: varargs[FutureBase]): InternalRaisesFuture[\n FutureBase, (CancelledError,)]
race chronos/internal/asyncfutures.html#race,openArray[FutureBase] asyncfutures: race(futs: openArray[FutureBase]): InternalRaisesFuture[FutureBase,\n (ValueError, CancelledError)]
race chronos/internal/asyncfutures.html#race,openArray[SomeFuture] asyncfutures: race(futs: openArray[SomeFuture]): InternalRaisesFuture[FutureBase,\n (ValueError, CancelledError)]
sleepAsync chronos/internal/asyncfutures.html#sleepAsync,Duration asyncfutures: sleepAsync(duration: Duration): InternalRaisesFuture[void, (CancelledError,)]
sleepAsync chronos/internal/asyncfutures.html#sleepAsync,int asyncfutures: sleepAsync(ms: int): InternalRaisesFuture[void, (CancelledError,)]
stepsAsync chronos/internal/asyncfutures.html#stepsAsync,int asyncfutures: stepsAsync(number: int): InternalRaisesFuture[void, (CancelledError,)]
idleAsync chronos/internal/asyncfutures.html#idleAsync asyncfutures: idleAsync(): InternalRaisesFuture[void, (CancelledError,)]
withTimeout chronos/internal/asyncfutures.html#withTimeout,Future[T],Duration asyncfutures: withTimeout[T](fut: Future[T]; timeout: Duration): InternalRaisesFuture[bool,\n (CancelledError,)]
withTimeout chronos/internal/asyncfutures.html#withTimeout,Future[T],int asyncfutures: withTimeout[T](fut: Future[T]; timeout: int): Future[bool]
wait chronos/internal/asyncfutures.html#wait,Future[T] asyncfutures: wait[T](fut: Future[T]; timeout = InfiniteDuration): Future[T]
wait chronos/internal/asyncfutures.html#wait,Future[T],int asyncfutures: wait[T](fut: Future[T]; timeout = -1): Future[T]
wait chronos/internal/asyncfutures.html#wait,Future[T],SomeFuture asyncfutures: wait[T](fut: Future[T]; deadline: SomeFuture): Future[T]
join chronos/internal/asyncfutures.html#join,FutureBase asyncfutures: join(future: FutureBase): InternalRaisesFuture[void, (CancelledError,)]
join chronos/internal/asyncfutures.html#join,SomeFuture asyncfutures: join(future: SomeFuture): InternalRaisesFuture[void, (CancelledError,)]
read chronos/internal/asyncfutures.html#read,InternalRaisesFuture[T: not void,E] asyncfutures: read[T: not void; E](fut: InternalRaisesFuture[T, E]): lent T
read chronos/internal/asyncfutures.html#read,InternalRaisesFuture[void,E] asyncfutures: read[E](fut: InternalRaisesFuture[void, E])
waitFor chronos/internal/asyncfutures.html#waitFor,InternalRaisesFuture[T: not void,E] asyncfutures: waitFor[T: not void; E](fut: InternalRaisesFuture[T, E]): lent T
waitFor chronos/internal/asyncfutures.html#waitFor,InternalRaisesFuture[void,E] asyncfutures: waitFor[E](fut: InternalRaisesFuture[void, E])
`or` chronos/internal/asyncfutures.html#or,InternalRaisesFuture[T,E1],InternalRaisesFuture[Y,E2] asyncfutures: `or`[T, Y, E1, E2](fut1: InternalRaisesFuture[T, E1];\n fut2: InternalRaisesFuture[Y, E2]): auto
wait chronos/internal/asyncfutures.html#wait,InternalRaisesFuture asyncfutures: wait(fut: InternalRaisesFuture; timeout = InfiniteDuration): auto
wait chronos/internal/asyncfutures.html#wait,InternalRaisesFuture,SomeFuture asyncfutures: wait(fut: InternalRaisesFuture; deadline: SomeFuture): auto

View File

@ -0,0 +1,247 @@
<?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>chronos/internal/asyncmacro</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">chronos/internal/asyncmacro</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>
&nbsp;&nbsp;&nbsp; <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>
<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="#17" id="67">Macros</a>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">async
<li><a class="reference" href="#async.m%2Cuntyped%2Cuntyped"
title="async(params, prc: untyped): untyped">async(params, prc: untyped): untyped</a></li>
<li><a class="reference" href="#async.m%2Cuntyped"
title="async(prc: untyped): untyped">async(prc: untyped): untyped</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">await
<li><a class="reference" href="#await.t%2CInternalRaisesFuture%5BT%2CE%5D"
title="await[T, E](fut: InternalRaisesFuture[T, E]): T">await[T, E](fut: InternalRaisesFuture[T, E]): T</a></li>
<li><a class="reference" href="#await.t%2CFuture%5BT%5D"
title="await[T](f: Future[T]): T">await[T](f: Future[T]): T</a></li>
</ul>
<ul class="simple nested-toc-section">awaitne
<li><a class="reference" href="#awaitne.t%2CFuture%5BT%5D"
title="awaitne[T](f: Future[T]): Future[T]">awaitne[T](f: Future[T]): Future[T]</a></li>
</ul>
</ul>
</li>
</ul>
</div>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncmacro.nim#L1"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncmacro.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="../futures.html">../futures</a>, <a class="reference external" href="../config.html">../config</a>, <a class="reference external" href="raisesfutures.html">raisesfutures</a>
</dl></div>
<div class="section" id="17">
<h1><a class="toc-backref" href="#17">Macros</a></h1>
<dl class="item">
<div id="async.m,untyped,untyped">
<dt><pre><span class="Keyword">macro</span> <a href="#async.m%2Cuntyped%2Cuntyped"><span class="Identifier">async</span></a><span class="Other">(</span><span class="Identifier">params</span><span class="Other">,</span> <span class="Identifier">prc</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
<dd>
Macro which processes async procedures into the appropriate iterators and yield statements.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncmacro.nim#L577"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncmacro.nim#L577" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="async.m,untyped">
<dt><pre><span class="Keyword">macro</span> <a href="#async.m%2Cuntyped"><span class="Identifier">async</span></a><span class="Other">(</span><span class="Identifier">prc</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
<dd>
Macro which processes async procedures into the appropriate iterators and yield statements.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncmacro.nim#L587"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncmacro.nim#L587" 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="await.t,InternalRaisesFuture[T,E]">
<dt><pre><span class="Keyword">template</span> <a href="#await.t%2CInternalRaisesFuture%5BT%2CE%5D"><span class="Identifier">await</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">fut</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span></pre></dt>
<dd>
<p>Ensure that the given <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span></span></tt> is finished, then return its value.</p>
<p>If the <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span></span></tt> failed or was cancelled, the corresponding exception will be raised instead.</p>
<p>If the <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span></span></tt> is pending, execution of the current <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span></span></tt> procedure will be suspended until the <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span></span></tt> is finished.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncmacro.nim#L546"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncmacro.nim#L546" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="await.t,Future[T]">
<dt><pre><span class="Keyword">template</span> <a href="#await.t%2CFuture%5BT%5D"><span class="Identifier">await</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">T</span></pre></dt>
<dd>
<p>Ensure that the given <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span></span></tt> is finished, then return its value.</p>
<p>If the <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span></span></tt> failed or was cancelled, the corresponding exception will be raised instead.</p>
<p>If the <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span></span></tt> is pending, execution of the current <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span></span></tt> procedure will be suspended until the <tt class="docutils literal"><span class="pre"><span class="Identifier">Future</span></span></tt> is finished.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncmacro.nim#L524"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncmacro.nim#L524" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="awaitne.t,Future[T]">
<dt><pre><span class="Keyword">template</span> <a href="#awaitne.t%2CFuture%5BT%5D"><span class="Identifier">awaitne</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">f</span><span class="Other">:</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/asyncmacro.nim#L569"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/asyncmacro.nim#L569" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</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-11-28 08:22:46 UTC</small>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,5 @@
await chronos/internal/asyncmacro.html#await.t,Future[T] asyncmacro: await[T](f: Future[T]): T
await chronos/internal/asyncmacro.html#await.t,InternalRaisesFuture[T,E] asyncmacro: await[T, E](fut: InternalRaisesFuture[T, E]): T
awaitne chronos/internal/asyncmacro.html#awaitne.t,Future[T] asyncmacro: awaitne[T](f: Future[T]): Future[T]
async chronos/internal/asyncmacro.html#async.m,untyped,untyped asyncmacro: async(params, prc: untyped): untyped
async chronos/internal/asyncmacro.html#async.m,untyped asyncmacro: async(prc: untyped): untyped

View File

@ -0,0 +1,185 @@
<?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>chronos/internal/errors</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">chronos/internal/errors</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>
&nbsp;&nbsp;&nbsp; <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>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#7" id="57">Types</a>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#AsyncError"
title="AsyncError = object of CatchableError">AsyncError</a></li>
<li><a class="reference" href="#AsyncExceptionError"
title="AsyncExceptionError = object of AsyncError">AsyncExceptionError</a></li>
<li><a class="reference" href="#AsyncTimeoutError"
title="AsyncTimeoutError = object of AsyncError">AsyncTimeoutError</a></li>
</ul>
</li>
</ul>
</div>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/errors.nim#L1"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/errors.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="AsyncError">
<dt><pre><a href="errors.html#AsyncError"><span class="Identifier">AsyncError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <span class="Identifier">CatchableError</span>
</pre></dt>
<dd>
Generic async exception
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/errors.nim#L2"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/errors.nim#L2" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="AsyncExceptionError">
<dt><pre><a href="errors.html#AsyncExceptionError"><span class="Identifier">AsyncExceptionError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="errors.html#AsyncError"><span class="Identifier">AsyncError</span></a>
</pre></dt>
<dd>
Error raised in <tt class="docutils literal"><span class="pre"><span class="Identifier">handleException</span></span></tt> mode - the original exception is available from the <tt class="docutils literal"><span class="pre"><span class="Identifier">parent</span></span></tt> field.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/errors.nim#L7"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/errors.nim#L7" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="AsyncTimeoutError">
<dt><pre><a href="errors.html#AsyncTimeoutError"><span class="Identifier">AsyncTimeoutError</span></a> <span class="Other">=</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="errors.html#AsyncError"><span class="Identifier">AsyncError</span></a>
</pre></dt>
<dd>
Timeout exception
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/errors.nim#L4"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/errors.nim#L4" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</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-11-28 08:22:46 UTC</small>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,3 @@
AsyncError chronos/internal/errors.html#AsyncError errors: AsyncError
AsyncTimeoutError chronos/internal/errors.html#AsyncTimeoutError errors: AsyncTimeoutError
AsyncExceptionError chronos/internal/errors.html#AsyncExceptionError errors: AsyncExceptionError

View File

@ -0,0 +1,449 @@
<?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>chronos/internal/raisesfutures</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">chronos/internal/raisesfutures</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>
&nbsp;&nbsp;&nbsp; <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>
<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="#InternalRaisesFuture"
title="InternalRaisesFuture[T; E] = ref object of Future[T]
when E is void:
dummy: E
else:
dummy: array[0, E]">InternalRaisesFuture</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">error
<li><a class="reference" href="#error%2CInternalRaisesFuture%5BT%2Cvoid%5D"
title="error[T](future: InternalRaisesFuture[T, void]): ref CatchableError">error[T](future: InternalRaisesFuture[T, void]): ref CatchableError</a></li>
</ul>
<ul class="simple nested-toc-section">failed
<li><a class="reference" href="#failed%2CInternalRaisesFuture%5BT%2Cvoid%5D"
title="failed[T](future: InternalRaisesFuture[T, void]): bool">failed[T](future: InternalRaisesFuture[T, void]): bool</a></li>
</ul>
<ul class="simple nested-toc-section">getRaisesTypes
<li><a class="reference" href="#getRaisesTypes%2CNimNode"
title="getRaisesTypes(raises: NimNode): NimNode">getRaisesTypes(raises: NimNode): NimNode</a></li>
</ul>
<ul class="simple nested-toc-section">isNoRaises
<li><a class="reference" href="#isNoRaises%2CNimNode"
title="isNoRaises(n: NimNode): bool">isNoRaises(n: NimNode): bool</a></li>
</ul>
<ul class="simple nested-toc-section">makeNoRaises
<li><a class="reference" href="#makeNoRaises"
title="makeNoRaises(): NimNode">makeNoRaises(): NimNode</a></li>
</ul>
<ul class="simple nested-toc-section">readError
<li><a class="reference" href="#readError%2CInternalRaisesFuture%5BT%2Cvoid%5D"
title="readError[T](future: InternalRaisesFuture[T, void]): ref CatchableError">readError[T](future: InternalRaisesFuture[T, void]): ref CatchableError</a></li>
</ul>
</ul>
</li>
<li>
<a class="reference reference-toplevel" href="#17" id="67">Macros</a>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">checkRaises
<li><a class="reference" href="#checkRaises.m%2CInternalRaisesFuture%2Ctyped%2Cref.T%2Cstaticbool"
title="checkRaises[T: CatchableError](future: InternalRaisesFuture; raises: typed;
error: ref T; warn: static bool = true): untyped">checkRaises[T: CatchableError](future: InternalRaisesFuture; raises: typed;
error: ref T; warn: static bool = true): untyped</a></li>
</ul>
<ul class="simple nested-toc-section">prepend
<li><a class="reference" href="#prepend.m%2Ctypedesc%2Cvarargs%5Btyped%5D"
title="prepend(tup: typedesc; typs: varargs[typed]): typedesc">prepend(tup: typedesc; typs: varargs[typed]): typedesc</a></li>
</ul>
<ul class="simple nested-toc-section">Raising
<li><a class="reference" href="#Raising.m%2Ctypedesc%5BFuture%5BT%5D%5D%2Ctyped"
title="Raising[T](F: typedesc[Future[T]]; E: typed): untyped">Raising[T](F: typedesc[Future[T]]; E: typed): untyped</a></li>
</ul>
<ul class="simple nested-toc-section">remove
<li><a class="reference" href="#remove.m%2Ctypedesc%2Cvarargs%5Btyped%5D"
title="remove(tup: typedesc; typs: varargs[typed]): typedesc">remove(tup: typedesc; typs: varargs[typed]): typedesc</a></li>
</ul>
<ul class="simple nested-toc-section">union
<li><a class="reference" href="#union.m%2Ctypedesc%2Ctypedesc"
title="union(tup0: typedesc; tup1: typedesc): typedesc">union(tup0: typedesc; tup1: typedesc): typedesc</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">init
<li><a class="reference" href="#init.t%2CtypeInternalRaisesFuture%5BT%2CE%5D%2Cstatic%5Bstring%5D"
title="init[T, E](F: type InternalRaisesFuture[T, E]; fromProc: static[string] = &quot;&quot;): F:type">init[T, E](F: type InternalRaisesFuture[T, E]; fromProc: static[string] = &quot;&quot;): F:type</a></li>
<li><a class="reference" href="#init.t%2CtypeInternalRaisesFuture%5BT%2CE%5D%2Cstatic%5Bstring%5D%2Cstatic%5BFutureFlags%5D"
title="init[T, E](F: type InternalRaisesFuture[T, E]; fromProc: static[string] = &quot;&quot;;
flags: static[FutureFlags]): F:type">init[T, E](F: type InternalRaisesFuture[T, E]; fromProc: static[string] = &quot;&quot;;
flags: static[FutureFlags]): F:type</a></li>
</ul>
</ul>
</li>
</ul>
</div>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L1"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="../futures.html">../futures</a>
</dl></div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="InternalRaisesFuture">
<dt><pre><a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">;</span> <span class="Identifier">E</span><span class="Other">]</span> <span class="Other">=</span> <span class="Keyword">ref</span> <span class="Keyword">object</span> <span class="Keyword">of</span> <a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span>
<span class="Keyword">when</span> <span class="Identifier">E</span> <span class="Keyword">is</span> <span class="Identifier">void</span><span class="Other">:</span>
<span class="Identifier">dummy</span><span class="Other">:</span> <span class="Identifier">E</span>
<span class="Keyword">else</span><span class="Other">:</span>
<span class="Identifier">dummy</span><span class="Other">:</span> <span class="Identifier">array</span><span class="Other">[</span><span class="DecNumber">0</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span>
</pre></dt>
<dd>
<p>Future with a tuple of possible exception types eg InternalRaisesFuture[void, (ValueError, OSError)]</p>
<p>This type gets injected by <tt class="docutils literal"><span class="pre"><span class="Identifier">async</span><span class="Punctuation">:</span> <span class="Punctuation">(</span><span class="Identifier">raises</span><span class="Punctuation">:</span> <span class="Operator">...</span><span class="Punctuation">)</span></span></tt> and similar utilities and should not be used manually as the internal exception representation is subject to change in future chronos versions.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L8"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L8" 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="error,InternalRaisesFuture[T,void]">
<dt><pre><span class="Keyword">func</span> <a href="#error%2CInternalRaisesFuture%5BT%2Cvoid%5D"><span class="Identifier">error</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">CatchableError</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 class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L238"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L238" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="failed,InternalRaisesFuture[T,void]">
<dt><pre><span class="Keyword">func</span> <a href="#failed%2CInternalRaisesFuture%5BT%2Cvoid%5D"><span class="Identifier">failed</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</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>.}</pre></dt>
<dd>
Determines whether <tt class="docutils literal"><span class="pre">future</span></tt> finished with an error.
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L231"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L231" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="getRaisesTypes,NimNode">
<dt><pre><span class="Keyword">proc</span> <a href="#getRaisesTypes%2CNimNode"><span class="Identifier">getRaisesTypes</span></a><span class="Other">(</span><span class="Identifier">raises</span><span class="Other">:</span> <span class="Identifier">NimNode</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">NimNode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L173"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L173" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="isNoRaises,NimNode">
<dt><pre><span class="Keyword">proc</span> <a href="#isNoRaises%2CNimNode"><span class="Identifier">isNoRaises</span></a><span class="Other">(</span><span class="Identifier">n</span><span class="Other">:</span> <span class="Identifier">NimNode</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">bool</span> {.<span class="Identifier">compileTime</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L46"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L46" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="makeNoRaises">
<dt><pre><span class="Keyword">proc</span> <a href="#makeNoRaises"><span class="Identifier">makeNoRaises</span></a><span class="Other">(</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">NimNode</span> {.<span class="Identifier">compileTime</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L22"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L22" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="readError,InternalRaisesFuture[T,void]">
<dt><pre><span class="Keyword">func</span> <a href="#readError%2CInternalRaisesFuture%5BT%2Cvoid%5D"><span class="Identifier">readError</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">void</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">CatchableError</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="Identifier">ValueError</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">raises</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L244"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L244" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</dl></div>
<div class="section" id="17">
<h1><a class="toc-backref" href="#17">Macros</a></h1>
<dl class="item">
<div id="checkRaises.m,InternalRaisesFuture,typed,ref.T,staticbool">
<dt><pre><span class="Keyword">macro</span> <a href="#checkRaises.m%2CInternalRaisesFuture%2Ctyped%2Cref.T%2Cstaticbool"><span class="Identifier">checkRaises</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">:</span> <span class="Identifier">CatchableError</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">future</span><span class="Other">:</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">;</span>
<span class="Identifier">raises</span><span class="Other">:</span> <span class="Identifier">typed</span><span class="Other">;</span> <span class="Identifier">error</span><span class="Other">:</span> <span class="Keyword">ref</span> <span class="Identifier">T</span><span class="Other">;</span>
<span class="Identifier">warn</span><span class="Other">:</span> <span class="Identifier">static</span> <span class="Identifier">bool</span> <span class="Other">=</span> <span class="Identifier">true</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</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>.}</pre></dt>
<dd>
<p>Generate code that checks that the given error is compatible with the raises restrictions of <tt class="docutils literal"><span class="pre"><span class="Identifier">future</span></span></tt>.</p>
<p>This check is done either at compile time or runtime depending on the information available at compile time - in particular, if the raises inherit from <tt class="docutils literal"><span class="pre"><span class="Identifier">error</span></span></tt>, we end up with the equivalent of a downcast which raises a Defect if it fails.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L179"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L179" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="prepend.m,typedesc,varargs[typed]">
<dt><pre><span class="Keyword">macro</span> <a href="#prepend.m%2Ctypedesc%2Cvarargs%5Btyped%5D"><span class="Identifier">prepend</span></a><span class="Other">(</span><span class="Identifier">tup</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">;</span> <span class="Identifier">typs</span><span class="Other">:</span> <span class="Identifier">varargs</span><span class="Other">[</span><span class="Identifier">typed</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">typedesc</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>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L135"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L135" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="Raising.m,typedesc[Future[T]],typed">
<dt><pre><span class="Keyword">macro</span> <a href="#Raising.m%2Ctypedesc%5BFuture%5BT%5D%5D%2Ctyped"><span class="Identifier">Raising</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">[</span><a href="../futures.html#Future"><span class="Identifier">Future</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">]</span><span class="Other">]</span><span class="Other">;</span> <span class="Identifier">E</span><span class="Other">:</span> <span class="Identifier">typed</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</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>.}</pre></dt>
<dd>
<p>Given a Future type instance, return a type storing <tt class="docutils literal"><span class="pre"><span class="Punctuation">{</span><span class="Operator">.</span><span class="Identifier">raises</span><span class="Operator">.</span><span class="Punctuation">}</span></span></tt> information</p>
<p>Note; this type may change in the future</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L62"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L62" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="remove.m,typedesc,varargs[typed]">
<dt><pre><span class="Keyword">macro</span> <a href="#remove.m%2Ctypedesc%2Cvarargs%5Btyped%5D"><span class="Identifier">remove</span></a><span class="Other">(</span><span class="Identifier">tup</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">;</span> <span class="Identifier">typs</span><span class="Other">:</span> <span class="Identifier">varargs</span><span class="Other">[</span><span class="Identifier">typed</span><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">typedesc</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>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L147"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L147" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="union.m,typedesc,typedesc">
<dt><pre><span class="Keyword">macro</span> <a href="#union.m%2Ctypedesc%2Ctypedesc"><span class="Identifier">union</span></a><span class="Other">(</span><span class="Identifier">tup0</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">;</span> <span class="Identifier">tup1</span><span class="Other">:</span> <span class="Identifier">typedesc</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">typedesc</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>.}</pre></dt>
<dd>
Join the types of the two tuples deduplicating the entries
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L156"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L156" 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="init.t,typeInternalRaisesFuture[T,E],static[string]">
<dt><pre><span class="Keyword">template</span> <a href="#init.t%2CtypeInternalRaisesFuture%5BT%2CE%5D%2Cstatic%5Bstring%5D"><span class="Identifier">init</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Keyword">type</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">fromProc</span><span class="Other">:</span> <span class="Identifier">static</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">F:type</span></pre></dt>
<dd>
<p>Creates a new pending future.</p>
<p>Specifying <tt class="docutils literal"><span class="pre">fromProc</span></tt>, which is a string specifying the name of the proc that this future belongs to, is a good habit as it helps with debugging.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L94"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L94" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="init.t,typeInternalRaisesFuture[T,E],static[string],static[FutureFlags]">
<dt><pre><span class="Keyword">template</span> <a href="#init.t%2CtypeInternalRaisesFuture%5BT%2CE%5D%2Cstatic%5Bstring%5D%2Cstatic%5BFutureFlags%5D"><span class="Identifier">init</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">(</span><span class="Identifier">F</span><span class="Other">:</span> <span class="Keyword">type</span> <a href="raisesfutures.html#InternalRaisesFuture"><span class="Identifier">InternalRaisesFuture</span></a><span class="Other">[</span><span class="Identifier">T</span><span class="Other">,</span> <span class="Identifier">E</span><span class="Other">]</span><span class="Other">;</span>
<span class="Identifier">fromProc</span><span class="Other">:</span> <span class="Identifier">static</span><span class="Other">[</span><span class="Identifier">string</span><span class="Other">]</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">;</span> <span class="Identifier">flags</span><span class="Other">:</span> <span class="Identifier">static</span><span class="Other">[</span><a href="../futures.html#FutureFlags"><span class="Identifier">FutureFlags</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">F:type</span></pre></dt>
<dd>
<p>Creates a new pending future.</p>
<p>Specifying <tt class="docutils literal"><span class="pre">fromProc</span></tt>, which is a string specifying the name of the proc that this future belongs to, is a good habit as it helps with debugging.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/internal/raisesfutures.nim#L109"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/internal/raisesfutures.nim#L109" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</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-11-28 08:22:46 UTC</small>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,14 @@
InternalRaisesFuture chronos/internal/raisesfutures.html#InternalRaisesFuture raisesfutures: InternalRaisesFuture
makeNoRaises chronos/internal/raisesfutures.html#makeNoRaises raisesfutures: makeNoRaises(): NimNode
isNoRaises chronos/internal/raisesfutures.html#isNoRaises,NimNode raisesfutures: isNoRaises(n: NimNode): bool
Raising chronos/internal/raisesfutures.html#Raising.m,typedesc[Future[T]],typed raisesfutures: Raising[T](F: typedesc[Future[T]]; E: typed): untyped
init chronos/internal/raisesfutures.html#init.t,typeInternalRaisesFuture[T,E],static[string] raisesfutures: init[T, E](F: type InternalRaisesFuture[T, E]; fromProc: static[string] = &quot;&quot;): F:type
init chronos/internal/raisesfutures.html#init.t,typeInternalRaisesFuture[T,E],static[string],static[FutureFlags] raisesfutures: init[T, E](F: type InternalRaisesFuture[T, E]; fromProc: static[string] = &quot;&quot;;\n flags: static[FutureFlags]): F:type
prepend chronos/internal/raisesfutures.html#prepend.m,typedesc,varargs[typed] raisesfutures: prepend(tup: typedesc; typs: varargs[typed]): typedesc
remove chronos/internal/raisesfutures.html#remove.m,typedesc,varargs[typed] raisesfutures: remove(tup: typedesc; typs: varargs[typed]): typedesc
union chronos/internal/raisesfutures.html#union.m,typedesc,typedesc raisesfutures: union(tup0: typedesc; tup1: typedesc): typedesc
getRaisesTypes chronos/internal/raisesfutures.html#getRaisesTypes,NimNode raisesfutures: getRaisesTypes(raises: NimNode): NimNode
checkRaises chronos/internal/raisesfutures.html#checkRaises.m,InternalRaisesFuture,typed,ref.T,staticbool raisesfutures: checkRaises[T: CatchableError](future: InternalRaisesFuture; raises: typed;\n error: ref T; warn: static bool = true): untyped
failed chronos/internal/raisesfutures.html#failed,InternalRaisesFuture[T,void] raisesfutures: failed[T](future: InternalRaisesFuture[T, void]): bool
error chronos/internal/raisesfutures.html#error,InternalRaisesFuture[T,void] raisesfutures: error[T](future: InternalRaisesFuture[T, void]): ref CatchableError
readError chronos/internal/raisesfutures.html#readError,InternalRaisesFuture[T,void] raisesfutures: readError[T](future: InternalRaisesFuture[T, void]): ref CatchableError

2630
api/chronos/osdefs.html Normal file

File diff suppressed because one or more lines are too long

148
api/chronos/osdefs.idx Normal file
View File

@ -0,0 +1,148 @@
IP_MULTICAST_TTL chronos/osdefs.html#IP_MULTICAST_TTL osdefs: IP_MULTICAST_TTL
EPOLLIN chronos/osdefs.html#EPOLLIN osdefs: EPOLLIN
EPOLLPRI chronos/osdefs.html#EPOLLPRI osdefs: EPOLLPRI
EPOLLOUT chronos/osdefs.html#EPOLLOUT osdefs: EPOLLOUT
EPOLLERR chronos/osdefs.html#EPOLLERR osdefs: EPOLLERR
EPOLLHUP chronos/osdefs.html#EPOLLHUP osdefs: EPOLLHUP
EPOLLRDNORM chronos/osdefs.html#EPOLLRDNORM osdefs: EPOLLRDNORM
EPOLLRDBAND chronos/osdefs.html#EPOLLRDBAND osdefs: EPOLLRDBAND
EPOLLWRNORM chronos/osdefs.html#EPOLLWRNORM osdefs: EPOLLWRNORM
EPOLLWRBAND chronos/osdefs.html#EPOLLWRBAND osdefs: EPOLLWRBAND
EPOLLMSG chronos/osdefs.html#EPOLLMSG osdefs: EPOLLMSG
EPOLLRDHUP chronos/osdefs.html#EPOLLRDHUP osdefs: EPOLLRDHUP
EPOLLEXCLUSIVE chronos/osdefs.html#EPOLLEXCLUSIVE osdefs: EPOLLEXCLUSIVE
EPOLLWAKEUP chronos/osdefs.html#EPOLLWAKEUP osdefs: EPOLLWAKEUP
EPOLLONESHOT chronos/osdefs.html#EPOLLONESHOT osdefs: EPOLLONESHOT
EPOLLET chronos/osdefs.html#EPOLLET osdefs: EPOLLET
SFD_CLOEXEC chronos/osdefs.html#SFD_CLOEXEC osdefs: SFD_CLOEXEC
SFD_NONBLOCK chronos/osdefs.html#SFD_NONBLOCK osdefs: SFD_NONBLOCK
EFD_CLOEXEC chronos/osdefs.html#EFD_CLOEXEC osdefs: EFD_CLOEXEC
EFD_NONBLOCK chronos/osdefs.html#EFD_NONBLOCK osdefs: EFD_NONBLOCK
TFD_CLOEXEC chronos/osdefs.html#TFD_CLOEXEC osdefs: TFD_CLOEXEC
TFD_NONBLOCK chronos/osdefs.html#TFD_NONBLOCK osdefs: TFD_NONBLOCK
EPOLL_CTL_ADD chronos/osdefs.html#EPOLL_CTL_ADD osdefs: EPOLL_CTL_ADD
EPOLL_CTL_DEL chronos/osdefs.html#EPOLL_CTL_DEL osdefs: EPOLL_CTL_DEL
EPOLL_CTL_MOD chronos/osdefs.html#EPOLL_CTL_MOD osdefs: EPOLL_CTL_MOD
EpollData chronos/osdefs.html#EpollData osdefs: EpollData
EpollEvent chronos/osdefs.html#EpollEvent osdefs: EpollEvent
SignalFdInfo chronos/osdefs.html#SignalFdInfo osdefs: SignalFdInfo
epoll_create chronos/osdefs.html#epoll_create,cint osdefs: epoll_create(size: cint): cint
epoll_create1 chronos/osdefs.html#epoll_create1,cint osdefs: epoll_create1(flags: cint): cint
epoll_ctl chronos/osdefs.html#epoll_ctl,cint,cint,cint,ptr.EpollEvent osdefs: epoll_ctl(epfd: cint; op: cint; fd: cint; event: ptr EpollEvent): cint
epoll_wait chronos/osdefs.html#epoll_wait,cint,ptr.EpollEvent,cint,cint osdefs: epoll_wait(epfd: cint; events: ptr EpollEvent; maxevents: cint; timeout: cint): cint
timerfd_create chronos/osdefs.html#timerfd_create,ClockId,cint osdefs: timerfd_create(clock_id: ClockId; flags: cint): cint
timerfd_settime chronos/osdefs.html#timerfd_settime,cint,cint,Itimerspec,Itimerspec osdefs: timerfd_settime(ufd: cint; flags: cint; utmr: var Itimerspec;\n otmr: var Itimerspec): cint
eventfd chronos/osdefs.html#eventfd,cuint,cint osdefs: eventfd(count: cuint; flags: cint): cint
signalfd chronos/osdefs.html#signalfd,cint,Sigset,cint osdefs: signalfd(fd: cint; mask: var Sigset; flags: cint): cint
pipe2 chronos/osdefs.html#pipe2,array[,cint],cint osdefs: pipe2(a: array[0 .. 1, cint]; flags: cint): cint
accept4 chronos/osdefs.html#accept4,cint,ptr.SockAddr,ptr.SockLen,cint osdefs: accept4(a1: cint; a2: ptr SockAddr; a3: ptr SockLen; a4: cint): cint
SOCK_NONBLOCK chronos/osdefs.html#SOCK_NONBLOCK osdefs: SOCK_NONBLOCK
SOCK_CLOEXEC chronos/osdefs.html#SOCK_CLOEXEC osdefs: SOCK_CLOEXEC
TCP_NODELAY chronos/osdefs.html#TCP_NODELAY osdefs: TCP_NODELAY
IPPROTO_TCP chronos/osdefs.html#IPPROTO_TCP osdefs: IPPROTO_TCP
O_CLOEXEC chronos/osdefs.html#O_CLOEXEC osdefs: O_CLOEXEC
POSIX_SPAWN_USEVFORK chronos/osdefs.html#POSIX_SPAWN_USEVFORK osdefs: POSIX_SPAWN_USEVFORK
IPV6_V6ONLY chronos/osdefs.html#IPV6_V6ONLY osdefs: IPV6_V6ONLY
POSIX_SPAWN_RESETIDS chronos/osdefs.html#POSIX_SPAWN_RESETIDS osdefs: POSIX_SPAWN_RESETIDS
POSIX_SPAWN_SETPGROUP chronos/osdefs.html#POSIX_SPAWN_SETPGROUP osdefs: POSIX_SPAWN_SETPGROUP
POSIX_SPAWN_SETSCHEDPARAM chronos/osdefs.html#POSIX_SPAWN_SETSCHEDPARAM osdefs: POSIX_SPAWN_SETSCHEDPARAM
POSIX_SPAWN_SETSCHEDULER chronos/osdefs.html#POSIX_SPAWN_SETSCHEDULER osdefs: POSIX_SPAWN_SETSCHEDULER
POSIX_SPAWN_SETSIGDEF chronos/osdefs.html#POSIX_SPAWN_SETSIGDEF osdefs: POSIX_SPAWN_SETSIGDEF
POSIX_SPAWN_SETSIGMASK chronos/osdefs.html#POSIX_SPAWN_SETSIGMASK osdefs: POSIX_SPAWN_SETSIGMASK
SchedParam chronos/osdefs.html#SchedParam osdefs: SchedParam
PosixSpawnAttr chronos/osdefs.html#PosixSpawnAttr osdefs: PosixSpawnAttr
PosixSpawnFileActions chronos/osdefs.html#PosixSpawnFileActions osdefs: PosixSpawnFileActions
posixSpawn chronos/osdefs.html#posixSpawn,Pid,cstring,PosixSpawnFileActions,PosixSpawnAttr,cstringArray,cstringArray osdefs: posixSpawn(a1: var Pid; a2: cstring; a3: var PosixSpawnFileActions;\n a4: var PosixSpawnAttr; a5, a6: cstringArray): cint
posixSpawnp chronos/osdefs.html#posixSpawnp,Pid,cstring,PosixSpawnFileActions,PosixSpawnAttr,cstringArray,cstringArray osdefs: posixSpawnp(a1: var Pid; a2: cstring; a3: var PosixSpawnFileActions;\n a4: var PosixSpawnAttr; a5, a6: cstringArray): cint
posixSpawnFileActionsInit chronos/osdefs.html#posixSpawnFileActionsInit,PosixSpawnFileActions osdefs: posixSpawnFileActionsInit(a1: var PosixSpawnFileActions): cint
posixSpawnFileActionsDestroy chronos/osdefs.html#posixSpawnFileActionsDestroy,PosixSpawnFileActions osdefs: posixSpawnFileActionsDestroy(a1: var PosixSpawnFileActions): cint
posixSpawnFileActionsAddClose chronos/osdefs.html#posixSpawnFileActionsAddClose,PosixSpawnFileActions,cint osdefs: posixSpawnFileActionsAddClose(a1: var PosixSpawnFileActions; a2: cint): cint
posixSpawnFileActionsAddDup2 chronos/osdefs.html#posixSpawnFileActionsAddDup2,PosixSpawnFileActions,cint,cint osdefs: posixSpawnFileActionsAddDup2(a1: var PosixSpawnFileActions; a2, a3: cint): cint
posixSpawnFileActionsAddOpen chronos/osdefs.html#posixSpawnFileActionsAddOpen,PosixSpawnFileActions,cint,cstring,cint,Mode osdefs: posixSpawnFileActionsAddOpen(a1: var PosixSpawnFileActions; a2: cint;\n a3: cstring; a4: cint; a5: Mode): cint
posixSpawnAttrInit chronos/osdefs.html#posixSpawnAttrInit,PosixSpawnAttr osdefs: posixSpawnAttrInit(a1: var PosixSpawnAttr): cint
posixSpawnAttrDestroy chronos/osdefs.html#posixSpawnAttrDestroy,PosixSpawnAttr osdefs: posixSpawnAttrDestroy(a1: var PosixSpawnAttr): cint
posixSpawnAttrGetSigDefault chronos/osdefs.html#posixSpawnAttrGetSigDefault,PosixSpawnAttr,Sigset osdefs: posixSpawnAttrGetSigDefault(a1: var PosixSpawnAttr; a2: var Sigset): cint
posixSpawnAttrSetSigDefault chronos/osdefs.html#posixSpawnAttrSetSigDefault,PosixSpawnAttr,Sigset osdefs: posixSpawnAttrSetSigDefault(a1: var PosixSpawnAttr; a2: var Sigset): cint
posixSpawnAttrGetFlags chronos/osdefs.html#posixSpawnAttrGetFlags,PosixSpawnAttr,cshort osdefs: posixSpawnAttrGetFlags(a1: var PosixSpawnAttr; a2: var cshort): cint
posixSpawnAttrSetFlags chronos/osdefs.html#posixSpawnAttrSetFlags,PosixSpawnAttr,cint osdefs: posixSpawnAttrSetFlags(a1: var PosixSpawnAttr; a2: cint): cint
posixSpawnAttrGetPgroup chronos/osdefs.html#posixSpawnAttrGetPgroup,PosixSpawnAttr,Pid osdefs: posixSpawnAttrGetPgroup(a1: var PosixSpawnAttr; a2: var Pid): cint
posixSpawnAttrSetPgroup chronos/osdefs.html#posixSpawnAttrSetPgroup,PosixSpawnAttr,Pid osdefs: posixSpawnAttrSetPgroup(a1: var PosixSpawnAttr; a2: Pid): cint
posixSpawnAttrGetSchedParam chronos/osdefs.html#posixSpawnAttrGetSchedParam,PosixSpawnAttr,SchedParam osdefs: posixSpawnAttrGetSchedParam(a1: var PosixSpawnAttr; a2: var SchedParam): cint
posixSpawnAttrSetSchedParam chronos/osdefs.html#posixSpawnAttrSetSchedParam,PosixSpawnAttr,SchedParam osdefs: posixSpawnAttrSetSchedParam(a1: var PosixSpawnAttr; a2: var SchedParam): cint
posixSpawnAttrGetSchedPolicy chronos/osdefs.html#posixSpawnAttrGetSchedPolicy,PosixSpawnAttr,cint osdefs: posixSpawnAttrGetSchedPolicy(a1: var PosixSpawnAttr; a2: var cint): cint
posixSpawnAttrSetSchedPolicy chronos/osdefs.html#posixSpawnAttrSetSchedPolicy,PosixSpawnAttr,cint osdefs: posixSpawnAttrSetSchedPolicy(a1: var PosixSpawnAttr; a2: cint): cint
posixSpawnAttrGetSigMask chronos/osdefs.html#posixSpawnAttrGetSigMask,PosixSpawnAttr,Sigset osdefs: posixSpawnAttrGetSigMask(a1: var PosixSpawnAttr; a2: var Sigset): cint
posixSpawnAttrSetSigMask chronos/osdefs.html#posixSpawnAttrSetSigMask,PosixSpawnAttr,Sigset osdefs: posixSpawnAttrSetSigMask(a1: var PosixSpawnAttr; a2: var Sigset): cint
P_PID chronos/osdefs.html#P_PID osdefs: P_PID
WNOHANG chronos/osdefs.html#WNOHANG osdefs: WNOHANG
WSTOPPED chronos/osdefs.html#WSTOPPED osdefs: WSTOPPED
WEXITED chronos/osdefs.html#WEXITED osdefs: WEXITED
WNOWAIT chronos/osdefs.html#WNOWAIT osdefs: WNOWAIT
WAITEXITSTATUS chronos/osdefs.html#WAITEXITSTATUS.t,cint osdefs: WAITEXITSTATUS(s: cint): cint
WAITTERMSIG chronos/osdefs.html#WAITTERMSIG.t,cint osdefs: WAITTERMSIG(s: cint): cint
WAITSTOPSIG chronos/osdefs.html#WAITSTOPSIG.t,cint osdefs: WAITSTOPSIG(s: cint): cint
WAITIFEXITED chronos/osdefs.html#WAITIFEXITED.t,cint osdefs: WAITIFEXITED(s: cint): bool
WAITIFSIGNALED chronos/osdefs.html#WAITIFSIGNALED.t,cint osdefs: WAITIFSIGNALED(s: cint): bool
WAITIFSTOPPED chronos/osdefs.html#WAITIFSTOPPED.t,cint osdefs: WAITIFSTOPPED(s: cint): bool
WAITIFCONTINUED chronos/osdefs.html#WAITIFCONTINUED.t,cint osdefs: WAITIFCONTINUED(s: cint): bool
INVALID_SOCKET chronos/osdefs.html#INVALID_SOCKET osdefs: INVALID_SOCKET
INVALID_HANDLE_VALUE chronos/osdefs.html#INVALID_HANDLE_VALUE osdefs: INVALID_HANDLE_VALUE
`==` chronos/osdefs.html#==,SocketHandle,int osdefs: `==`(x: SocketHandle; y: int): bool
`==` chronos/osdefs.html#==,SocketHandle,SocketHandle osdefs: `==`(x: SocketHandle; y: SocketHandle): bool
AF_NETLINK chronos/osdefs.html#AF_NETLINK osdefs: AF_NETLINK
AF_PACKET chronos/osdefs.html#AF_PACKET osdefs: AF_PACKET
NETLINK_ROUTE chronos/osdefs.html#NETLINK_ROUTE osdefs: NETLINK_ROUTE
NLMSG_ALIGNTO chronos/osdefs.html#NLMSG_ALIGNTO osdefs: NLMSG_ALIGNTO
RTA_ALIGNTO chronos/osdefs.html#RTA_ALIGNTO osdefs: RTA_ALIGNTO
RTA_DST chronos/osdefs.html#RTA_DST osdefs: RTA_DST
RTA_OIF chronos/osdefs.html#RTA_OIF osdefs: RTA_OIF
RTA_GATEWAY chronos/osdefs.html#RTA_GATEWAY osdefs: RTA_GATEWAY
RTA_PREFSRC chronos/osdefs.html#RTA_PREFSRC osdefs: RTA_PREFSRC
RTM_NEWLINK chronos/osdefs.html#RTM_NEWLINK osdefs: RTM_NEWLINK
RTM_NEWROUTE chronos/osdefs.html#RTM_NEWROUTE osdefs: RTM_NEWROUTE
RTM_F_LOOKUP_TABLE chronos/osdefs.html#RTM_F_LOOKUP_TABLE osdefs: RTM_F_LOOKUP_TABLE
RTM_GETLINK chronos/osdefs.html#RTM_GETLINK osdefs: RTM_GETLINK
RTM_GETADDR chronos/osdefs.html#RTM_GETADDR osdefs: RTM_GETADDR
RTM_GETROUTE chronos/osdefs.html#RTM_GETROUTE osdefs: RTM_GETROUTE
NLM_F_REQUEST chronos/osdefs.html#NLM_F_REQUEST osdefs: NLM_F_REQUEST
NLM_F_ROOT chronos/osdefs.html#NLM_F_ROOT osdefs: NLM_F_ROOT
NLM_F_MATCH chronos/osdefs.html#NLM_F_MATCH osdefs: NLM_F_MATCH
NLM_F_DUMP chronos/osdefs.html#NLM_F_DUMP osdefs: NLM_F_DUMP
IFLIST_REPLY_BUFFER chronos/osdefs.html#IFLIST_REPLY_BUFFER osdefs: IFLIST_REPLY_BUFFER
InvalidSocketHandle chronos/osdefs.html#InvalidSocketHandle osdefs: InvalidSocketHandle
NLMSG_DONE chronos/osdefs.html#NLMSG_DONE osdefs: NLMSG_DONE
NLMSG_ERROR chronos/osdefs.html#NLMSG_ERROR osdefs: NLMSG_ERROR
IFLA_ADDRESS chronos/osdefs.html#IFLA_ADDRESS osdefs: IFLA_ADDRESS
IFLA_IFNAME chronos/osdefs.html#IFLA_IFNAME osdefs: IFLA_IFNAME
IFLA_MTU chronos/osdefs.html#IFLA_MTU osdefs: IFLA_MTU
IFLA_OPERSTATE chronos/osdefs.html#IFLA_OPERSTATE osdefs: IFLA_OPERSTATE
IFA_ADDRESS chronos/osdefs.html#IFA_ADDRESS osdefs: IFA_ADDRESS
IFA_LOCAL chronos/osdefs.html#IFA_LOCAL osdefs: IFA_LOCAL
ARPHRD_ETHER chronos/osdefs.html#ARPHRD_ETHER osdefs: ARPHRD_ETHER
ARPHRD_EETHER chronos/osdefs.html#ARPHRD_EETHER osdefs: ARPHRD_EETHER
ARPHRD_ARCNET chronos/osdefs.html#ARPHRD_ARCNET osdefs: ARPHRD_ARCNET
ARPHRD_ATM chronos/osdefs.html#ARPHRD_ATM osdefs: ARPHRD_ATM
ARPHRD_IEEE1394 chronos/osdefs.html#ARPHRD_IEEE1394 osdefs: ARPHRD_IEEE1394
ARPHRD_SLIP chronos/osdefs.html#ARPHRD_SLIP osdefs: ARPHRD_SLIP
ARPHRD_CSLIP chronos/osdefs.html#ARPHRD_CSLIP osdefs: ARPHRD_CSLIP
ARPHRD_SLIP6 chronos/osdefs.html#ARPHRD_SLIP6 osdefs: ARPHRD_SLIP6
ARPHRD_CSLIP6 chronos/osdefs.html#ARPHRD_CSLIP6 osdefs: ARPHRD_CSLIP6
ARPHRD_PPP chronos/osdefs.html#ARPHRD_PPP osdefs: ARPHRD_PPP
ARPHRD_CISCO chronos/osdefs.html#ARPHRD_CISCO osdefs: ARPHRD_CISCO
ARPHRD_HDLC chronos/osdefs.html#ARPHRD_HDLC osdefs: ARPHRD_HDLC
ARPHRD_LAPB chronos/osdefs.html#ARPHRD_LAPB osdefs: ARPHRD_LAPB
ARPHRD_FRAD chronos/osdefs.html#ARPHRD_FRAD osdefs: ARPHRD_FRAD
ARPHRD_LOOPBACK chronos/osdefs.html#ARPHRD_LOOPBACK osdefs: ARPHRD_LOOPBACK
ARPHRD_HIPPI chronos/osdefs.html#ARPHRD_HIPPI osdefs: ARPHRD_HIPPI
ARPHRD_IEEE80211 chronos/osdefs.html#ARPHRD_IEEE80211 osdefs: ARPHRD_IEEE80211
ARPHRD_IEEE80211_PRISM chronos/osdefs.html#ARPHRD_IEEE80211_PRISM osdefs: ARPHRD_IEEE80211_PRISM
ARPHRD_IEEE80211_RADIOTAP chronos/osdefs.html#ARPHRD_IEEE80211_RADIOTAP osdefs: ARPHRD_IEEE80211_RADIOTAP
Sockaddr_nl chronos/osdefs.html#Sockaddr_nl osdefs: Sockaddr_nl
NlMsgHeader chronos/osdefs.html#NlMsgHeader osdefs: NlMsgHeader
IfInfoMessage chronos/osdefs.html#IfInfoMessage osdefs: IfInfoMessage
IfAddrMessage chronos/osdefs.html#IfAddrMessage osdefs: IfAddrMessage
RtMessage chronos/osdefs.html#RtMessage osdefs: RtMessage
RtAttr chronos/osdefs.html#RtAttr osdefs: RtAttr
RtGenMsg chronos/osdefs.html#RtGenMsg osdefs: RtGenMsg
NLReq chronos/osdefs.html#NLReq osdefs: NLReq
NLRouteReq chronos/osdefs.html#NLRouteReq osdefs: NLRouteReq

2005
api/chronos/oserrno.html Normal file

File diff suppressed because it is too large Load Diff

133
api/chronos/oserrno.idx Normal file
View File

@ -0,0 +1,133 @@
EPERM chronos/oserrno.html#EPERM oserrno: EPERM
ENOENT chronos/oserrno.html#ENOENT oserrno: ENOENT
ESRCH chronos/oserrno.html#ESRCH oserrno: ESRCH
EINTR chronos/oserrno.html#EINTR oserrno: EINTR
EIO chronos/oserrno.html#EIO oserrno: EIO
ENXIO chronos/oserrno.html#ENXIO oserrno: ENXIO
E2BIG chronos/oserrno.html#E2BIG oserrno: E2BIG
ENOEXEC chronos/oserrno.html#ENOEXEC oserrno: ENOEXEC
EBADF chronos/oserrno.html#EBADF oserrno: EBADF
ECHILD chronos/oserrno.html#ECHILD oserrno: ECHILD
EAGAIN chronos/oserrno.html#EAGAIN oserrno: EAGAIN
ENOMEM chronos/oserrno.html#ENOMEM oserrno: ENOMEM
EACCES chronos/oserrno.html#EACCES oserrno: EACCES
EFAULT chronos/oserrno.html#EFAULT oserrno: EFAULT
ENOTBLK chronos/oserrno.html#ENOTBLK oserrno: ENOTBLK
EBUSY chronos/oserrno.html#EBUSY oserrno: EBUSY
EEXIST chronos/oserrno.html#EEXIST oserrno: EEXIST
EXDEV chronos/oserrno.html#EXDEV oserrno: EXDEV
ENODEV chronos/oserrno.html#ENODEV oserrno: ENODEV
ENOTDIR chronos/oserrno.html#ENOTDIR oserrno: ENOTDIR
EISDIR chronos/oserrno.html#EISDIR oserrno: EISDIR
EINVAL chronos/oserrno.html#EINVAL oserrno: EINVAL
ENFILE chronos/oserrno.html#ENFILE oserrno: ENFILE
EMFILE chronos/oserrno.html#EMFILE oserrno: EMFILE
ENOTTY chronos/oserrno.html#ENOTTY oserrno: ENOTTY
ETXTBSY chronos/oserrno.html#ETXTBSY oserrno: ETXTBSY
EFBIG chronos/oserrno.html#EFBIG oserrno: EFBIG
ENOSPC chronos/oserrno.html#ENOSPC oserrno: ENOSPC
ESPIPE chronos/oserrno.html#ESPIPE oserrno: ESPIPE
EROFS chronos/oserrno.html#EROFS oserrno: EROFS
EMLINK chronos/oserrno.html#EMLINK oserrno: EMLINK
EPIPE chronos/oserrno.html#EPIPE oserrno: EPIPE
EDOM chronos/oserrno.html#EDOM oserrno: EDOM
ERANGE chronos/oserrno.html#ERANGE oserrno: ERANGE
EDEADLK chronos/oserrno.html#EDEADLK oserrno: EDEADLK
ENAMETOOLONG chronos/oserrno.html#ENAMETOOLONG oserrno: ENAMETOOLONG
ENOLCK chronos/oserrno.html#ENOLCK oserrno: ENOLCK
ENOSYS chronos/oserrno.html#ENOSYS oserrno: ENOSYS
ENOTEMPTY chronos/oserrno.html#ENOTEMPTY oserrno: ENOTEMPTY
ELOOP chronos/oserrno.html#ELOOP oserrno: ELOOP
EWOULDBLOCK chronos/oserrno.html#EWOULDBLOCK oserrno: EWOULDBLOCK
ENOMSG chronos/oserrno.html#ENOMSG oserrno: ENOMSG
EIDRM chronos/oserrno.html#EIDRM oserrno: EIDRM
ECHRNG chronos/oserrno.html#ECHRNG oserrno: ECHRNG
EL2NSYNC chronos/oserrno.html#EL2NSYNC oserrno: EL2NSYNC
EL3HLT chronos/oserrno.html#EL3HLT oserrno: EL3HLT
EL3RST chronos/oserrno.html#EL3RST oserrno: EL3RST
ELNRNG chronos/oserrno.html#ELNRNG oserrno: ELNRNG
EUNATCH chronos/oserrno.html#EUNATCH oserrno: EUNATCH
ENOCSI chronos/oserrno.html#ENOCSI oserrno: ENOCSI
EL2HLT chronos/oserrno.html#EL2HLT oserrno: EL2HLT
EBADE chronos/oserrno.html#EBADE oserrno: EBADE
EBADR chronos/oserrno.html#EBADR oserrno: EBADR
EXFULL chronos/oserrno.html#EXFULL oserrno: EXFULL
ENOANO chronos/oserrno.html#ENOANO oserrno: ENOANO
EBADRQC chronos/oserrno.html#EBADRQC oserrno: EBADRQC
EBADSLT chronos/oserrno.html#EBADSLT oserrno: EBADSLT
EDEADLOCK chronos/oserrno.html#EDEADLOCK oserrno: EDEADLOCK
EBFONT chronos/oserrno.html#EBFONT oserrno: EBFONT
ENOSTR chronos/oserrno.html#ENOSTR oserrno: ENOSTR
ENODATA chronos/oserrno.html#ENODATA oserrno: ENODATA
ETIME chronos/oserrno.html#ETIME oserrno: ETIME
ENOSR chronos/oserrno.html#ENOSR oserrno: ENOSR
ENONET chronos/oserrno.html#ENONET oserrno: ENONET
ENOPKG chronos/oserrno.html#ENOPKG oserrno: ENOPKG
EREMOTE chronos/oserrno.html#EREMOTE oserrno: EREMOTE
ENOLINK chronos/oserrno.html#ENOLINK oserrno: ENOLINK
EADV chronos/oserrno.html#EADV oserrno: EADV
ESRMNT chronos/oserrno.html#ESRMNT oserrno: ESRMNT
ECOMM chronos/oserrno.html#ECOMM oserrno: ECOMM
EPROTO chronos/oserrno.html#EPROTO oserrno: EPROTO
EMULTIHOP chronos/oserrno.html#EMULTIHOP oserrno: EMULTIHOP
EDOTDOT chronos/oserrno.html#EDOTDOT oserrno: EDOTDOT
EBADMSG chronos/oserrno.html#EBADMSG oserrno: EBADMSG
EOVERFLOW chronos/oserrno.html#EOVERFLOW oserrno: EOVERFLOW
ENOTUNIQ chronos/oserrno.html#ENOTUNIQ oserrno: ENOTUNIQ
EBADFD chronos/oserrno.html#EBADFD oserrno: EBADFD
EREMCHG chronos/oserrno.html#EREMCHG oserrno: EREMCHG
ELIBACC chronos/oserrno.html#ELIBACC oserrno: ELIBACC
ELIBBAD chronos/oserrno.html#ELIBBAD oserrno: ELIBBAD
ELIBSCN chronos/oserrno.html#ELIBSCN oserrno: ELIBSCN
ELIBMAX chronos/oserrno.html#ELIBMAX oserrno: ELIBMAX
ELIBEXEC chronos/oserrno.html#ELIBEXEC oserrno: ELIBEXEC
EILSEQ chronos/oserrno.html#EILSEQ oserrno: EILSEQ
ERESTART chronos/oserrno.html#ERESTART oserrno: ERESTART
ESTRPIPE chronos/oserrno.html#ESTRPIPE oserrno: ESTRPIPE
EUSERS chronos/oserrno.html#EUSERS oserrno: EUSERS
ENOTSOCK chronos/oserrno.html#ENOTSOCK oserrno: ENOTSOCK
EDESTADDRREQ chronos/oserrno.html#EDESTADDRREQ oserrno: EDESTADDRREQ
EMSGSIZE chronos/oserrno.html#EMSGSIZE oserrno: EMSGSIZE
EPROTOTYPE chronos/oserrno.html#EPROTOTYPE oserrno: EPROTOTYPE
ENOPROTOOPT chronos/oserrno.html#ENOPROTOOPT oserrno: ENOPROTOOPT
EPROTONOSUPPORT chronos/oserrno.html#EPROTONOSUPPORT oserrno: EPROTONOSUPPORT
ESOCKTNOSUPPORT chronos/oserrno.html#ESOCKTNOSUPPORT oserrno: ESOCKTNOSUPPORT
EOPNOTSUPP chronos/oserrno.html#EOPNOTSUPP oserrno: EOPNOTSUPP
EPFNOSUPPORT chronos/oserrno.html#EPFNOSUPPORT oserrno: EPFNOSUPPORT
EAFNOSUPPORT chronos/oserrno.html#EAFNOSUPPORT oserrno: EAFNOSUPPORT
EADDRINUSE chronos/oserrno.html#EADDRINUSE oserrno: EADDRINUSE
EADDRNOTAVAIL chronos/oserrno.html#EADDRNOTAVAIL oserrno: EADDRNOTAVAIL
ENETDOWN chronos/oserrno.html#ENETDOWN oserrno: ENETDOWN
ENETUNREACH chronos/oserrno.html#ENETUNREACH oserrno: ENETUNREACH
ENETRESET chronos/oserrno.html#ENETRESET oserrno: ENETRESET
ECONNABORTED chronos/oserrno.html#ECONNABORTED oserrno: ECONNABORTED
ECONNRESET chronos/oserrno.html#ECONNRESET oserrno: ECONNRESET
ENOBUFS chronos/oserrno.html#ENOBUFS oserrno: ENOBUFS
EISCONN chronos/oserrno.html#EISCONN oserrno: EISCONN
ENOTCONN chronos/oserrno.html#ENOTCONN oserrno: ENOTCONN
ESHUTDOWN chronos/oserrno.html#ESHUTDOWN oserrno: ESHUTDOWN
ETOOMANYREFS chronos/oserrno.html#ETOOMANYREFS oserrno: ETOOMANYREFS
ETIMEDOUT chronos/oserrno.html#ETIMEDOUT oserrno: ETIMEDOUT
ECONNREFUSED chronos/oserrno.html#ECONNREFUSED oserrno: ECONNREFUSED
EHOSTDOWN chronos/oserrno.html#EHOSTDOWN oserrno: EHOSTDOWN
EHOSTUNREACH chronos/oserrno.html#EHOSTUNREACH oserrno: EHOSTUNREACH
EALREADY chronos/oserrno.html#EALREADY oserrno: EALREADY
EINPROGRESS chronos/oserrno.html#EINPROGRESS oserrno: EINPROGRESS
ESTALE chronos/oserrno.html#ESTALE oserrno: ESTALE
EUCLEAN chronos/oserrno.html#EUCLEAN oserrno: EUCLEAN
ENOTNAM chronos/oserrno.html#ENOTNAM oserrno: ENOTNAM
ENAVAIL chronos/oserrno.html#ENAVAIL oserrno: ENAVAIL
EISNAM chronos/oserrno.html#EISNAM oserrno: EISNAM
EREMOTEIO chronos/oserrno.html#EREMOTEIO oserrno: EREMOTEIO
EDQUOT chronos/oserrno.html#EDQUOT oserrno: EDQUOT
ENOMEDIUM chronos/oserrno.html#ENOMEDIUM oserrno: ENOMEDIUM
EMEDIUMTYPE chronos/oserrno.html#EMEDIUMTYPE oserrno: EMEDIUMTYPE
ECANCELED chronos/oserrno.html#ECANCELED oserrno: ECANCELED
ENOKEY chronos/oserrno.html#ENOKEY oserrno: ENOKEY
EKEYEXPIRED chronos/oserrno.html#EKEYEXPIRED oserrno: EKEYEXPIRED
EKEYREVOKED chronos/oserrno.html#EKEYREVOKED oserrno: EKEYREVOKED
EKEYREJECTED chronos/oserrno.html#EKEYREJECTED oserrno: EKEYREJECTED
EOWNERDEAD chronos/oserrno.html#EOWNERDEAD oserrno: EOWNERDEAD
ENOTRECOVERABLE chronos/oserrno.html#ENOTRECOVERABLE oserrno: ENOTRECOVERABLE
ERFKILL chronos/oserrno.html#ERFKILL oserrno: ERFKILL
EHWPOISON chronos/oserrno.html#EHWPOISON oserrno: EHWPOISON

446
api/chronos/osutils.html Normal file
View File

@ -0,0 +1,446 @@
<?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>chronos/osutils</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">chronos/osutils</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>
&nbsp;&nbsp;&nbsp; <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>
<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="#DescriptorFlag"
title="DescriptorFlag {.pure.} = enum
CloseOnExec, NonBlock">DescriptorFlag</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="#AsyncDescriptorDefault"
title="AsyncDescriptorDefault = {DescriptorFlag.CloseOnExec, DescriptorFlag.NonBlock}">AsyncDescriptorDefault</a></li>
<li><a class="reference" href="#MaxSignalEventLength"
title="MaxSignalEventLength = 64">MaxSignalEventLength</a></li>
<li><a class="reference" href="#MaxSignalSuffixLength"
title="MaxSignalSuffixLength = 21">MaxSignalSuffixLength</a></li>
<li><a class="reference" href="#PipeHeaderName"
title="PipeHeaderName = r&quot;\\.\pipe\LOCAL\chronos\&quot;">PipeHeaderName</a></li>
<li><a class="reference" href="#SignalPrefixName"
title="SignalPrefixName = r&quot;Local\chronos-events-&quot;">SignalPrefixName</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">acceptConn
<li><a class="reference" href="#acceptConn%2Ccint%2Cptr.SockAddr%2Cptr.SockLen%2Cset%5BDescriptorFlag%5D"
title="acceptConn(a1: cint; a2: ptr SockAddr; a3: ptr SockLen; a4: set[DescriptorFlag]): Result[
cint, OSErrorCode]">acceptConn(a1: cint; a2: ptr SockAddr; a3: ptr SockLen; a4: set[DescriptorFlag]): Result[
cint, OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">closeFd
<li><a class="reference" href="#closeFd%2Ccint"
title="closeFd(s: cint): int">closeFd(s: cint): int</a></li>
<li><a class="reference" href="#closeFd%2CSocketHandle"
title="closeFd(s: SocketHandle): int">closeFd(s: SocketHandle): int</a></li>
</ul>
<ul class="simple nested-toc-section">createOsPipe
<li><a class="reference" href="#createOsPipe%2Cset%5BDescriptorFlag%5D%2Cset%5BDescriptorFlag%5D"
title="createOsPipe(readset, writeset: set[DescriptorFlag]): Result[
tuple[read: cint, write: cint], OSErrorCode]">createOsPipe(readset, writeset: set[DescriptorFlag]): Result[
tuple[read: cint, write: cint], OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">getDescriptorInheritance
<li><a class="reference" href="#getDescriptorInheritance%2Ccint"
title="getDescriptorInheritance(s: cint): Result[bool, OSErrorCode]">getDescriptorInheritance(s: cint): Result[bool, OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">setDescriptorBlocking
<li><a class="reference" href="#setDescriptorBlocking%2Ccint%2Cbool"
title="setDescriptorBlocking(s: cint; value: bool): Result[void, OSErrorCode]">setDescriptorBlocking(s: cint; value: bool): Result[void, OSErrorCode]</a></li>
<li><a class="reference" href="#setDescriptorBlocking%2CSocketHandle%2Cbool"
title="setDescriptorBlocking(s: SocketHandle; value: bool): Result[void, OSErrorCode]">setDescriptorBlocking(s: SocketHandle; value: bool): Result[void, OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">setDescriptorFlags
<li><a class="reference" href="#setDescriptorFlags%2Ccint%2Cbool%2Cbool"
title="setDescriptorFlags(s: cint; nonblock, cloexec: bool): Result[void, OSErrorCode]">setDescriptorFlags(s: cint; nonblock, cloexec: bool): Result[void, OSErrorCode]</a></li>
</ul>
<ul class="simple nested-toc-section">setDescriptorInheritance
<li><a class="reference" href="#setDescriptorInheritance%2Ccint%2Cbool"
title="setDescriptorInheritance(s: cint; value: bool): Result[void, OSErrorCode]">setDescriptorInheritance(s: cint; value: bool): Result[void, OSErrorCode]</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">handleEintr
<li><a class="reference" href="#handleEintr.t%2Cuntyped"
title="handleEintr(body: untyped): untyped">handleEintr(body: untyped): untyped</a></li>
</ul>
</ul>
</li>
</ul>
</div>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L1"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="6">
<h1><a class="toc-backref" href="#6">Imports</a></h1>
<dl class="item">
<a class="reference external" href="osdefs.html">osdefs</a>, <a class="reference external" href="oserrno.html">oserrno</a>
</dl></div>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="DescriptorFlag">
<dt><pre><a href="osutils.html#DescriptorFlag"><span class="Identifier">DescriptorFlag</span></a> {.<span class="Identifier">pure</span>.} <span class="Other">=</span> <span class="Keyword">enum</span>
<span class="Identifier">CloseOnExec</span><span class="Other">,</span> <span class="Identifier">NonBlock</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L26"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L26" 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="AsyncDescriptorDefault">
<dt><pre><a href="osutils.html#AsyncDescriptorDefault"><span class="Identifier">AsyncDescriptorDefault</span></a> <span class="Other">=</span> <span class="Other">{</span><span class="DecNumber">DescriptorFlag.CloseOnExec</span><span class="Other">,</span> <span class="DecNumber">DescriptorFlag.NonBlock</span><span class="Other">}</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L30"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L30" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="MaxSignalEventLength">
<dt><pre><a href="osutils.html#MaxSignalEventLength"><span class="Identifier">MaxSignalEventLength</span></a> <span class="Other">=</span> <span class="DecNumber">64</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L21"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L21" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="MaxSignalSuffixLength">
<dt><pre><a href="osutils.html#MaxSignalSuffixLength"><span class="Identifier">MaxSignalSuffixLength</span></a> <span class="Other">=</span> <span class="DecNumber">21</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L22"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L22" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="PipeHeaderName">
<dt><pre><a href="osutils.html#PipeHeaderName"><span class="Identifier">PipeHeaderName</span></a> <span class="Other">=</span> <span class="StringLit">r&quot;\\.\pipe\LOCAL\chronos\&quot;</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L19"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L19" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="SignalPrefixName">
<dt><pre><a href="osutils.html#SignalPrefixName"><span class="Identifier">SignalPrefixName</span></a> <span class="Other">=</span> <span class="StringLit">r&quot;Local\chronos-events-&quot;</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L20"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L20" 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="acceptConn,cint,ptr.SockAddr,ptr.SockLen,set[DescriptorFlag]">
<dt><pre><span class="Keyword">proc</span> <a href="#acceptConn%2Ccint%2Cptr.SockAddr%2Cptr.SockLen%2Cset%5BDescriptorFlag%5D"><span class="Identifier">acceptConn</span></a><span class="Other">(</span><span class="Identifier">a1</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">;</span> <span class="Identifier">a2</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">SockAddr</span><span class="Other">;</span> <span class="Identifier">a3</span><span class="Other">:</span> <span class="Keyword">ptr</span> <span class="Identifier">SockLen</span><span class="Other">;</span>
<span class="Identifier">a4</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="osutils.html#DescriptorFlag"><span class="Identifier">DescriptorFlag</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">cint</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L386"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L386" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="closeFd,cint">
<dt><pre><span class="Keyword">proc</span> <a href="#closeFd%2Ccint"><span class="Identifier">closeFd</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L380"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L380" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="closeFd,SocketHandle">
<dt><pre><span class="Keyword">proc</span> <a href="#closeFd%2CSocketHandle"><span class="Identifier">closeFd</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">SocketHandle</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L383"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L383" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="createOsPipe,set[DescriptorFlag],set[DescriptorFlag]">
<dt><pre><span class="Keyword">proc</span> <a href="#createOsPipe%2Cset%5BDescriptorFlag%5D%2Cset%5BDescriptorFlag%5D"><span class="Identifier">createOsPipe</span></a><span class="Other">(</span><span class="Identifier">readset</span><span class="Other">,</span> <span class="Identifier">writeset</span><span class="Other">:</span> <span class="Identifier">set</span><span class="Other">[</span><a href="osutils.html#DescriptorFlag"><span class="Identifier">DescriptorFlag</span></a><span class="Other">]</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span>
<span class="Keyword">tuple</span><span class="Other">[</span><span class="Identifier">read</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">,</span> <span class="Identifier">write</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">]</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L414"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L414" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="getDescriptorInheritance,cint">
<dt><pre><span class="Keyword">proc</span> <a href="#getDescriptorInheritance%2Ccint"><span class="Identifier">getDescriptorInheritance</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">bool</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L368"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L368" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="setDescriptorBlocking,cint,bool">
<dt><pre><span class="Keyword">proc</span> <a href="#setDescriptorBlocking%2Ccint%2Cbool"><span class="Identifier">setDescriptorBlocking</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">bool</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L334"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L334" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="setDescriptorBlocking,SocketHandle,bool">
<dt><pre><span class="Keyword">proc</span> <a href="#setDescriptorBlocking%2CSocketHandle%2Cbool"><span class="Identifier">setDescriptorBlocking</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">SocketHandle</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">bool</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span>
<span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L349"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L349" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="setDescriptorFlags,cint,bool,bool">
<dt><pre><span class="Keyword">proc</span> <a href="#setDescriptorFlags%2Ccint%2Cbool%2Cbool"><span class="Identifier">setDescriptorFlags</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">;</span> <span class="Identifier">nonblock</span><span class="Other">,</span> <span class="Identifier">cloexec</span><span class="Other">:</span> <span class="Identifier">bool</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span>
<span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L374"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L374" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
<div id="setDescriptorInheritance,cint,bool">
<dt><pre><span class="Keyword">proc</span> <a href="#setDescriptorInheritance%2Ccint%2Cbool"><span class="Identifier">setDescriptorInheritance</span></a><span class="Other">(</span><span class="Identifier">s</span><span class="Other">:</span> <span class="Identifier">cint</span><span class="Other">;</span> <span class="Identifier">value</span><span class="Other">:</span> <span class="Identifier">bool</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">Result</span><span class="Other">[</span><span class="Identifier">void</span><span class="Other">,</span> <span class="Identifier">OSErrorCode</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L353"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L353" 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="handleEintr.t,untyped">
<dt><pre><span class="Keyword">template</span> <a href="#handleEintr.t%2Cuntyped"><span class="Identifier">handleEintr</span></a><span class="Other">(</span><span class="Identifier">body</span><span class="Other">:</span> <span class="Identifier">untyped</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">untyped</span></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/osutils.nim#L326"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/osutils.nim#L326" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</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-11-28 08:22:46 UTC</small>
</div>
</div>
</div>
</div>
</body>
</html>

16
api/chronos/osutils.idx Normal file
View File

@ -0,0 +1,16 @@
PipeHeaderName chronos/osutils.html#PipeHeaderName osutils: PipeHeaderName
SignalPrefixName chronos/osutils.html#SignalPrefixName osutils: SignalPrefixName
MaxSignalEventLength chronos/osutils.html#MaxSignalEventLength osutils: MaxSignalEventLength
MaxSignalSuffixLength chronos/osutils.html#MaxSignalSuffixLength osutils: MaxSignalSuffixLength
DescriptorFlag chronos/osutils.html#DescriptorFlag osutils: DescriptorFlag
AsyncDescriptorDefault chronos/osutils.html#AsyncDescriptorDefault osutils: AsyncDescriptorDefault
handleEintr chronos/osutils.html#handleEintr.t,untyped osutils: handleEintr(body: untyped): untyped
setDescriptorBlocking chronos/osutils.html#setDescriptorBlocking,cint,bool osutils: setDescriptorBlocking(s: cint; value: bool): Result[void, OSErrorCode]
setDescriptorBlocking chronos/osutils.html#setDescriptorBlocking,SocketHandle,bool osutils: setDescriptorBlocking(s: SocketHandle; value: bool): Result[void, OSErrorCode]
setDescriptorInheritance chronos/osutils.html#setDescriptorInheritance,cint,bool osutils: setDescriptorInheritance(s: cint; value: bool): Result[void, OSErrorCode]
getDescriptorInheritance chronos/osutils.html#getDescriptorInheritance,cint osutils: getDescriptorInheritance(s: cint): Result[bool, OSErrorCode]
setDescriptorFlags chronos/osutils.html#setDescriptorFlags,cint,bool,bool osutils: setDescriptorFlags(s: cint; nonblock, cloexec: bool): Result[void, OSErrorCode]
closeFd chronos/osutils.html#closeFd,cint osutils: closeFd(s: cint): int
closeFd chronos/osutils.html#closeFd,SocketHandle osutils: closeFd(s: SocketHandle): int
acceptConn chronos/osutils.html#acceptConn,cint,ptr.SockAddr,ptr.SockLen,set[DescriptorFlag] osutils: acceptConn(a1: cint; a2: ptr SockAddr; a3: ptr SockLen; a4: set[DescriptorFlag]): Result[\n cint, OSErrorCode]
createOsPipe chronos/osutils.html#createOsPipe,set[DescriptorFlag],set[DescriptorFlag] osutils: createOsPipe(readset, writeset: set[DescriptorFlag]): Result[\n tuple[read: cint, write: cint], OSErrorCode]

724
api/chronos/selectors2.html Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,28 @@
Selector chronos/selectors2.html#Selector selectors2: Selector
Event chronos/selectors2.html#Event selectors2: Event
IOSelectorsException chronos/selectors2.html#IOSelectorsException selectors2: IOSelectorsException
ReadyKey chronos/selectors2.html#ReadyKey selectors2: ReadyKey
SelectEvent chronos/selectors2.html#SelectEvent selectors2: SelectEvent
newSelector chronos/selectors2.html#newSelector selectors2: newSelector[T](): Selector[T]
close chronos/selectors2.html#close,Selector[T] selectors2: close[T](s: Selector[T])
registerHandle chronos/selectors2.html#registerHandle,Selector[T],,set[Event],T selectors2: registerHandle[T](s: Selector[T]; fd: int | SocketHandle; events: set[Event];\n data: T)
updateHandle chronos/selectors2.html#updateHandle,Selector[T],,set[Event] selectors2: updateHandle[T](s: Selector[T]; fd: int | SocketHandle; events: set[Event])
registerTimer chronos/selectors2.html#registerTimer,Selector[T],int,bool,T selectors2: registerTimer[T](s: Selector[T]; timeout: int; oneshot: bool; data: T): int
registerSignal chronos/selectors2.html#registerSignal,Selector[T],int,T selectors2: registerSignal[T](s: Selector[T]; signal: int; data: T): int
registerProcess chronos/selectors2.html#registerProcess,Selector[T],int,T selectors2: registerProcess[T](s: Selector[T]; pid: int; data: T): int
registerEvent chronos/selectors2.html#registerEvent,Selector[T],SelectEvent,T selectors2: registerEvent[T](s: Selector[T]; ev: SelectEvent; data: T)
registerVnode chronos/selectors2.html#registerVnode,Selector[T],cint,set[Event],T selectors2: registerVnode[T](s: Selector[T]; fd: cint; events: set[Event]; data: T)
newSelectEvent chronos/selectors2.html#newSelectEvent selectors2: newSelectEvent(): SelectEvent
trigger chronos/selectors2.html#trigger,SelectEvent selectors2: trigger(ev: SelectEvent)
close chronos/selectors2.html#close,SelectEvent selectors2: close(ev: SelectEvent)
unregister chronos/selectors2.html#unregister,Selector[T],SelectEvent selectors2: unregister[T](s: Selector[T]; ev: SelectEvent)
unregister chronos/selectors2.html#unregister,Selector[T], selectors2: unregister[T](s: Selector[T]; fd: int | SocketHandle | cint)
selectInto chronos/selectors2.html#selectInto,Selector[T],int,openArray[ReadyKey] selectors2: selectInto[T](s: Selector[T]; timeout: int; results: var openArray[ReadyKey]): int
select chronos/selectors2.html#select,Selector[T],int selectors2: select[T](s: Selector[T]; timeout: int): seq[ReadyKey]
getData chronos/selectors2.html#getData,Selector[T], selectors2: getData[T](s: Selector[T]; fd: SocketHandle | int): var T
setData chronos/selectors2.html#setData,Selector[T],,T selectors2: setData[T](s: Selector[T]; fd: SocketHandle | int; data: var T): bool
isEmpty chronos/selectors2.html#isEmpty.t,Selector[T] selectors2: isEmpty[T](s: Selector[T]): bool
withData chronos/selectors2.html#withData.t,Selector[T],,untyped,untyped selectors2: withData[T](s: Selector[T]; fd: SocketHandle | int; value, body: untyped)
withData chronos/selectors2.html#withData.t,Selector[T],,untyped,untyped,untyped selectors2: withData[T](s: Selector[T]; fd: SocketHandle | int; value, body1, body2: untyped)
contains chronos/selectors2.html#contains,Selector[T], selectors2: contains[T](s: Selector[T]; fd: SocketHandle | int): bool
getFd chronos/selectors2.html#getFd,Selector[T] selectors2: getFd[T](s: Selector[T]): int

165
api/chronos/sendfile.html Normal file
View File

@ -0,0 +1,165 @@
<?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>chronos/sendfile</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">chronos/sendfile</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>
&nbsp;&nbsp;&nbsp; <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>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#12" id="62">Procs</a>
<ul class="simple simple-toc-section">
<ul class="simple nested-toc-section">sendfile
<li><a class="reference" href="#sendfile%2Cint%2Cint%2Cint%2Cint"
title="sendfile(outfd, infd: int; offset: int; count: var int): int">sendfile(outfd, infd: int; offset: int; count: var int): int</a></li>
</ul>
</ul>
</li>
</ul>
</div>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/sendfile.nim#L1"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/sendfile.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 provides cross-platform wrapper for <tt class="docutils literal"><span class="pre">sendfile()</span></tt> syscall.</p>
<div class="section" id="12">
<h1><a class="toc-backref" href="#12">Procs</a></h1>
<dl class="item">
<div id="sendfile,int,int,int,int">
<dt><pre><span class="Keyword">proc</span> <a href="#sendfile%2Cint%2Cint%2Cint%2Cint"><span class="Identifier">sendfile</span></a><span class="Other">(</span><span class="Identifier">outfd</span><span class="Other">,</span> <span class="Identifier">infd</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">offset</span><span class="Other">:</span> <span class="Identifier">int</span><span class="Other">;</span> <span class="Identifier">count</span><span class="Other">:</span> <span class="Keyword">var</span> <span class="Identifier">int</span><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">int</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
<p>Copies data between file descriptor <tt class="docutils literal"><span class="pre">infd</span></tt> and <tt class="docutils literal"><span class="pre">outfd</span></tt>. Because this copying is done within the kernel, <tt class="docutils literal"><span class="pre">sendfile()</span></tt> is more efficient than the combination of <tt class="docutils literal"><span class="pre">read(2)</span></tt> and <tt class="docutils literal"><span class="pre">write(2)</span></tt>, which would require transferring data to and from user space.</p>
<p><tt class="docutils literal"><span class="pre">infd</span></tt> should be a file descriptor opened for reading and <tt class="docutils literal"><span class="pre">outfd</span></tt> should be a descriptor opened for writing.</p>
<p>The <tt class="docutils literal"><span class="pre">infd</span></tt> argument must correspond to a file which supports <tt class="docutils literal"><span class="pre">mmap(2)</span></tt>-like operations (i.e., it cannot be a socket).</p>
<p><tt class="docutils literal"><span class="pre">offset</span></tt> the file offset from which <tt class="docutils literal"><span class="pre">sendfile()</span></tt> will start reading data from <tt class="docutils literal"><span class="pre">infd</span></tt>.</p>
<p><tt class="docutils literal"><span class="pre">count</span></tt> is the number of bytes to copy between the file descriptors. On exit <tt class="docutils literal"><span class="pre">count</span></tt> will hold number of bytes actually transferred between file descriptors. May be &gt;0 even in the case of error return, if some bytes were sent before the error occurred.</p>
<p>If the transfer was successful, the number of bytes written to <tt class="docutils literal"><span class="pre">outfd</span></tt> is stored in <tt class="docutils literal"><span class="pre">count</span></tt>, and <tt class="docutils literal"><span class="pre">0</span></tt> returned. Note that a successful call to <tt class="docutils literal"><span class="pre">sendfile()</span></tt> may write fewer bytes than requested; the caller should be prepared to retry the call if there were unsent bytes.</p>
<p>On error, <tt class="docutils literal"><span class="pre">-1</span></tt> is returned.</p>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/sendfile.nim#L15"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/sendfile.nim#L15" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</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-11-28 08:22:46 UTC</small>
</div>
</div>
</div>
</div>
</body>
</html>

1
api/chronos/sendfile.idx Normal file
View File

@ -0,0 +1 @@
sendfile chronos/sendfile.html#sendfile,int,int,int,int sendfile: sendfile(outfd, infd: int; offset: int; count: var int): int

217
api/chronos/srcloc.html Normal file
View File

@ -0,0 +1,217 @@
<?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>chronos/srcloc</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">chronos/srcloc</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>
&nbsp;&nbsp;&nbsp; <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>
<ul class="simple simple-toc" id="toc-list">
<li>
<a class="reference reference-toplevel" href="#7" id="57">Types</a>
<ul class="simple simple-toc-section">
<li><a class="reference" href="#SrcLoc"
title="SrcLoc = object
procedure*: cstring
file*: cstring
line*: int">SrcLoc</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">$
<li><a class="reference" href="#%24%2Cptr.SrcLoc"
title="`$`(loc: ptr SrcLoc): string">`$`(loc: ptr SrcLoc): string</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">getSrcLocation
<li><a class="reference" href="#getSrcLocation.t%2Cstaticstring"
title="getSrcLocation(procedure: static string = &quot;&quot;): ptr SrcLoc">getSrcLocation(procedure: static string = &quot;&quot;): ptr SrcLoc</a></li>
</ul>
</ul>
</li>
</ul>
</div>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/srcloc.nim#L1"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/srcloc.nim#L1" class="link-seesrc" target="_blank" >Edit</a>
<div class="nine columns" id="content">
<div id="tocRoot"></div>
<p class="module-desc"></p>
<div class="section" id="7">
<h1><a class="toc-backref" href="#7">Types</a></h1>
<dl class="item">
<div id="SrcLoc">
<dt><pre><a href="srcloc.html#SrcLoc"><span class="Identifier">SrcLoc</span></a> <span class="Other">=</span> <span class="Keyword">object</span>
<span class="Identifier">procedure</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cstring</span>
<span class="Identifier">file</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">cstring</span>
<span class="Identifier">line</span><span class="Operator">*</span><span class="Other">:</span> <span class="Identifier">int</span>
</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/srcloc.nim#L15"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/srcloc.nim#L15" 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="$,ptr.SrcLoc">
<dt><pre><span class="Keyword">proc</span> <a href="#%24%2Cptr.SrcLoc"><span class="Identifier">`$`</span></a><span class="Other">(</span><span class="Identifier">loc</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="srcloc.html#SrcLoc"><span class="Identifier">SrcLoc</span></a><span class="Other">)</span><span class="Other">:</span> <span class="Identifier">string</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 class="Identifier">tags</span><span class="Other">:</span> <span class="Other">[</span><span class="Other">]</span></span>.}</pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/srcloc.nim#L20"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/srcloc.nim#L20" 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="getSrcLocation.t,staticstring">
<dt><pre><span class="Keyword">template</span> <a href="#getSrcLocation.t%2Cstaticstring"><span class="Identifier">getSrcLocation</span></a><span class="Other">(</span><span class="Identifier">procedure</span><span class="Other">:</span> <span class="Identifier">static</span> <span class="Identifier">string</span> <span class="Other">=</span> <span class="StringLit">&quot;&quot;</span><span class="Other">)</span><span class="Other">:</span> <span class="Keyword">ptr</span> <a href="srcloc.html#SrcLoc"><span class="Identifier">SrcLoc</span></a></pre></dt>
<dd>
&nbsp;&nbsp;<a
href="https://github.com/status-im/nim-chronos/tree/master/chronos/srcloc.nim#L39"
class="link-seesrc" target="_blank">Source</a>
&nbsp;&nbsp;<a href="https://github.com/status-im/nim-chronos/edit/devel/chronos/srcloc.nim#L39" class="link-seesrc" target="_blank" >Edit</a>
</dd>
</div>
</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-11-28 08:22:46 UTC</small>
</div>
</div>
</div>
</div>
</body>
</html>

3
api/chronos/srcloc.idx Normal file
View File

@ -0,0 +1,3 @@
SrcLoc chronos/srcloc.html#SrcLoc srcloc: SrcLoc
`$` chronos/srcloc.html#$,ptr.SrcLoc srcloc: `$`(loc: ptr SrcLoc): string
getSrcLocation chronos/srcloc.html#getSrcLocation.t,staticstring srcloc: getSrcLocation(procedure: static string = &quot;&quot;): ptr SrcLoc

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,96 @@
AsyncStreamDefaultBufferSize chronos/streams/asyncstream.html#AsyncStreamDefaultBufferSize asyncstream: AsyncStreamDefaultBufferSize
AsyncStreamDefaultQueueSize chronos/streams/asyncstream.html#AsyncStreamDefaultQueueSize asyncstream: AsyncStreamDefaultQueueSize
AsyncStreamReaderTrackerName chronos/streams/asyncstream.html#AsyncStreamReaderTrackerName asyncstream: AsyncStreamReaderTrackerName
AsyncStreamWriterTrackerName chronos/streams/asyncstream.html#AsyncStreamWriterTrackerName asyncstream: AsyncStreamWriterTrackerName
AsyncStreamError chronos/streams/asyncstream.html#AsyncStreamError asyncstream: AsyncStreamError
AsyncStreamIncorrectDefect chronos/streams/asyncstream.html#AsyncStreamIncorrectDefect asyncstream: AsyncStreamIncorrectDefect
AsyncStreamIncompleteError chronos/streams/asyncstream.html#AsyncStreamIncompleteError asyncstream: AsyncStreamIncompleteError
AsyncStreamLimitError chronos/streams/asyncstream.html#AsyncStreamLimitError asyncstream: AsyncStreamLimitError
AsyncStreamUseClosedError chronos/streams/asyncstream.html#AsyncStreamUseClosedError asyncstream: AsyncStreamUseClosedError
AsyncStreamReadError chronos/streams/asyncstream.html#AsyncStreamReadError asyncstream: AsyncStreamReadError
AsyncStreamWriteError chronos/streams/asyncstream.html#AsyncStreamWriteError asyncstream: AsyncStreamWriteError
AsyncStreamWriteEOFError chronos/streams/asyncstream.html#AsyncStreamWriteEOFError asyncstream: AsyncStreamWriteEOFError
AsyncBuffer chronos/streams/asyncstream.html#AsyncBuffer asyncstream: AsyncBuffer
AsyncBufferRef chronos/streams/asyncstream.html#AsyncBufferRef asyncstream: AsyncBufferRef
Pointer chronos/streams/asyncstream.html#Pointer WriteType.Pointer
Sequence chronos/streams/asyncstream.html#Sequence WriteType.Sequence
String chronos/streams/asyncstream.html#String WriteType.String
WriteType chronos/streams/asyncstream.html#WriteType asyncstream: WriteType
WriteItem chronos/streams/asyncstream.html#WriteItem asyncstream: WriteItem
Running chronos/streams/asyncstream.html#Running AsyncStreamState.Running
Error chronos/streams/asyncstream.html#Error AsyncStreamState.Error
Stopped chronos/streams/asyncstream.html#Stopped AsyncStreamState.Stopped
Finished chronos/streams/asyncstream.html#Finished AsyncStreamState.Finished
Closing chronos/streams/asyncstream.html#Closing AsyncStreamState.Closing
Closed chronos/streams/asyncstream.html#Closed AsyncStreamState.Closed
AsyncStreamState chronos/streams/asyncstream.html#AsyncStreamState asyncstream: AsyncStreamState
StreamReaderLoop chronos/streams/asyncstream.html#StreamReaderLoop asyncstream: StreamReaderLoop
StreamWriterLoop chronos/streams/asyncstream.html#StreamWriterLoop asyncstream: StreamWriterLoop
AsyncStreamReader chronos/streams/asyncstream.html#AsyncStreamReader asyncstream: AsyncStreamReader
AsyncStreamWriter chronos/streams/asyncstream.html#AsyncStreamWriter asyncstream: AsyncStreamWriter
AsyncStream chronos/streams/asyncstream.html#AsyncStream asyncstream: AsyncStream
AsyncStreamRW chronos/streams/asyncstream.html#AsyncStreamRW asyncstream: AsyncStreamRW
new chronos/streams/asyncstream.html#new,typedesc[AsyncBufferRef],int asyncstream: new(t: typedesc[AsyncBufferRef]; size: int): AsyncBufferRef
wait chronos/streams/asyncstream.html#wait.t,AsyncBufferRef asyncstream: wait(sb: AsyncBufferRef): untyped
transfer chronos/streams/asyncstream.html#transfer.t,AsyncBufferRef asyncstream: transfer(sb: AsyncBufferRef): untyped
forget chronos/streams/asyncstream.html#forget,AsyncBufferRef asyncstream: forget(sb: AsyncBufferRef)
upload chronos/streams/asyncstream.html#upload,AsyncBufferRef,ptr.byte,int asyncstream: upload(sb: AsyncBufferRef; pbytes: ptr byte; nbytes: int): InternalRaisesFuture[\n void, (CancelledError,)]
copyOut chronos/streams/asyncstream.html#copyOut.t,pointer,WriteItem,int asyncstream: copyOut(dest: pointer; item: WriteItem; length: int)
newAsyncStreamIncompleteError chronos/streams/asyncstream.html#newAsyncStreamIncompleteError asyncstream: newAsyncStreamIncompleteError(): ref AsyncStreamIncompleteError
newAsyncStreamLimitError chronos/streams/asyncstream.html#newAsyncStreamLimitError asyncstream: newAsyncStreamLimitError(): ref AsyncStreamLimitError
newAsyncStreamUseClosedError chronos/streams/asyncstream.html#newAsyncStreamUseClosedError asyncstream: newAsyncStreamUseClosedError(): ref AsyncStreamUseClosedError
raiseAsyncStreamUseClosedError chronos/streams/asyncstream.html#raiseAsyncStreamUseClosedError asyncstream: raiseAsyncStreamUseClosedError()
raiseAsyncStreamLimitError chronos/streams/asyncstream.html#raiseAsyncStreamLimitError asyncstream: raiseAsyncStreamLimitError()
raiseAsyncStreamIncompleteError chronos/streams/asyncstream.html#raiseAsyncStreamIncompleteError asyncstream: raiseAsyncStreamIncompleteError()
raiseEmptyMessageDefect chronos/streams/asyncstream.html#raiseEmptyMessageDefect asyncstream: raiseEmptyMessageDefect()
raiseAsyncStreamWriteEOFError chronos/streams/asyncstream.html#raiseAsyncStreamWriteEOFError asyncstream: raiseAsyncStreamWriteEOFError()
atEof chronos/streams/asyncstream.html#atEof,AsyncStreamReader asyncstream: atEof(rstream: AsyncStreamReader): bool
atEof chronos/streams/asyncstream.html#atEof,AsyncStreamWriter asyncstream: atEof(wstream: AsyncStreamWriter): bool
closed chronos/streams/asyncstream.html#closed,AsyncStreamRW asyncstream: closed(rw: AsyncStreamRW): bool
finished chronos/streams/asyncstream.html#finished,AsyncStreamRW asyncstream: finished(rw: AsyncStreamRW): bool
stopped chronos/streams/asyncstream.html#stopped,AsyncStreamRW asyncstream: stopped(rw: AsyncStreamRW): bool
running chronos/streams/asyncstream.html#running,AsyncStreamRW asyncstream: running(rw: AsyncStreamRW): bool
failed chronos/streams/asyncstream.html#failed,AsyncStreamRW asyncstream: failed(rw: AsyncStreamRW): bool
checkStreamClosed chronos/streams/asyncstream.html#checkStreamClosed.t,untyped asyncstream: checkStreamClosed(t: untyped)
checkStreamFinished chronos/streams/asyncstream.html#checkStreamFinished.t,untyped asyncstream: checkStreamFinished(t: untyped)
readExactly chronos/streams/asyncstream.html#readExactly,AsyncStreamReader,pointer,int asyncstream: readExactly(rstream: AsyncStreamReader; pbytes: pointer; nbytes: int): InternalRaisesFuture[\n void, (CancelledError, AsyncStreamError)]
readOnce chronos/streams/asyncstream.html#readOnce,AsyncStreamReader,pointer,int asyncstream: readOnce(rstream: AsyncStreamReader; pbytes: pointer; nbytes: int): InternalRaisesFuture[\n int, (CancelledError, AsyncStreamError)]
readUntil chronos/streams/asyncstream.html#readUntil,AsyncStreamReader,pointer,int,seq[byte] asyncstream: readUntil(rstream: AsyncStreamReader; pbytes: pointer; nbytes: int;\n sep: seq[byte]): InternalRaisesFuture[int,\n (CancelledError, AsyncStreamError)]
readLine chronos/streams/asyncstream.html#readLine,AsyncStreamReader,int,string asyncstream: readLine(rstream: AsyncStreamReader; limit = 0; sep = &quot;\r\n&quot;): InternalRaisesFuture[\n string, (CancelledError, AsyncStreamError)]
read chronos/streams/asyncstream.html#read,AsyncStreamReader asyncstream: read(rstream: AsyncStreamReader): InternalRaisesFuture[seq[byte],\n (CancelledError, AsyncStreamError)]
read chronos/streams/asyncstream.html#read,AsyncStreamReader,int asyncstream: read(rstream: AsyncStreamReader; n: int): InternalRaisesFuture[seq[byte],\n (CancelledError, AsyncStreamError)]
consume chronos/streams/asyncstream.html#consume,AsyncStreamReader asyncstream: consume(rstream: AsyncStreamReader): InternalRaisesFuture[int,\n (CancelledError, AsyncStreamError)]
consume chronos/streams/asyncstream.html#consume,AsyncStreamReader,int asyncstream: consume(rstream: AsyncStreamReader; n: int): InternalRaisesFuture[int,\n (CancelledError, AsyncStreamError)]
readMessage chronos/streams/asyncstream.html#readMessage,AsyncStreamReader,ReadMessagePredicate asyncstream: readMessage(rstream: AsyncStreamReader; pred: ReadMessagePredicate): InternalRaisesFuture[\n void, (CancelledError, AsyncStreamError)]
write chronos/streams/asyncstream.html#write,AsyncStreamWriter,pointer,int asyncstream: write(wstream: AsyncStreamWriter; pbytes: pointer; nbytes: int): InternalRaisesFuture[\n void, (CancelledError, AsyncStreamError)]
write chronos/streams/asyncstream.html#write,AsyncStreamWriter,seq[byte],int asyncstream: write(wstream: AsyncStreamWriter; sbytes: seq[byte]; msglen = -1): InternalRaisesFuture[\n void, (CancelledError, AsyncStreamError)]
write chronos/streams/asyncstream.html#write,AsyncStreamWriter,string,int asyncstream: write(wstream: AsyncStreamWriter; sbytes: string; msglen = -1): InternalRaisesFuture[\n void, (CancelledError, AsyncStreamError)]
finish chronos/streams/asyncstream.html#finish,AsyncStreamWriter asyncstream: finish(wstream: AsyncStreamWriter): InternalRaisesFuture[void,\n (CancelledError, AsyncStreamError)]
join chronos/streams/asyncstream.html#join,AsyncStreamRW asyncstream: join(rw: AsyncStreamRW): InternalRaisesFuture[void, (CancelledError,)]
close chronos/streams/asyncstream.html#close,AsyncStreamRW asyncstream: close(rw: AsyncStreamRW)
closeWait chronos/streams/asyncstream.html#closeWait,AsyncStreamRW asyncstream: closeWait(rw: AsyncStreamRW): InternalRaisesFuture[void, void]
init chronos/streams/asyncstream.html#init,AsyncStreamWriter,AsyncStreamWriter,StreamWriterLoop asyncstream: init(child, wsource: AsyncStreamWriter; loop: StreamWriterLoop;\n queueSize = AsyncStreamDefaultQueueSize)
init chronos/streams/asyncstream.html#init,AsyncStreamWriter,AsyncStreamWriter,StreamWriterLoop,ref.T asyncstream: init[T](child, wsource: AsyncStreamWriter; loop: StreamWriterLoop;\n queueSize = AsyncStreamDefaultQueueSize; udata: ref T)
init chronos/streams/asyncstream.html#init,AsyncStreamReader,AsyncStreamReader,StreamReaderLoop asyncstream: init(child, rsource: AsyncStreamReader; loop: StreamReaderLoop;\n bufferSize = AsyncStreamDefaultBufferSize)
init chronos/streams/asyncstream.html#init,AsyncStreamReader,AsyncStreamReader,StreamReaderLoop,ref.T asyncstream: init[T](child, rsource: AsyncStreamReader; loop: StreamReaderLoop;\n bufferSize = AsyncStreamDefaultBufferSize; udata: ref T)
init chronos/streams/asyncstream.html#init,AsyncStreamWriter,StreamTransport asyncstream: init(child: AsyncStreamWriter; tsource: StreamTransport)
init chronos/streams/asyncstream.html#init,AsyncStreamWriter,StreamTransport,ref.T asyncstream: init[T](child: AsyncStreamWriter; tsource: StreamTransport; udata: ref T)
init chronos/streams/asyncstream.html#init,AsyncStreamWriter,AsyncStreamWriter asyncstream: init(child, wsource: AsyncStreamWriter)
init chronos/streams/asyncstream.html#init,AsyncStreamWriter,AsyncStreamWriter,ref.T asyncstream: init[T](child, wsource: AsyncStreamWriter; udata: ref T)
init chronos/streams/asyncstream.html#init,AsyncStreamReader,StreamTransport asyncstream: init(child: AsyncStreamReader; tsource: StreamTransport)
init chronos/streams/asyncstream.html#init,AsyncStreamReader,StreamTransport,ref.T asyncstream: init[T](child: AsyncStreamReader; tsource: StreamTransport; udata: ref T)
init chronos/streams/asyncstream.html#init,AsyncStreamReader,AsyncStreamReader asyncstream: init(child, rsource: AsyncStreamReader)
init chronos/streams/asyncstream.html#init,AsyncStreamReader,AsyncStreamReader,ref.T asyncstream: init[T](child, rsource: AsyncStreamReader; udata: ref T)
newAsyncStreamReader chronos/streams/asyncstream.html#newAsyncStreamReader,AsyncStreamReader,StreamReaderLoop,ref.T asyncstream: newAsyncStreamReader[T](rsource: AsyncStreamReader; loop: StreamReaderLoop;\n bufferSize = AsyncStreamDefaultBufferSize; udata: ref T): AsyncStreamReader
newAsyncStreamReader chronos/streams/asyncstream.html#newAsyncStreamReader,AsyncStreamReader,StreamReaderLoop asyncstream: newAsyncStreamReader(rsource: AsyncStreamReader; loop: StreamReaderLoop;\n bufferSize = AsyncStreamDefaultBufferSize): AsyncStreamReader
newAsyncStreamReader chronos/streams/asyncstream.html#newAsyncStreamReader,StreamTransport,ref.T asyncstream: newAsyncStreamReader[T](tsource: StreamTransport; udata: ref T): AsyncStreamReader
newAsyncStreamReader chronos/streams/asyncstream.html#newAsyncStreamReader,StreamTransport asyncstream: newAsyncStreamReader(tsource: StreamTransport): AsyncStreamReader
newAsyncStreamReader chronos/streams/asyncstream.html#newAsyncStreamReader,AsyncStreamReader,ref.T asyncstream: newAsyncStreamReader[T](rsource: AsyncStreamReader; udata: ref T): AsyncStreamReader
newAsyncStreamReader chronos/streams/asyncstream.html#newAsyncStreamReader,AsyncStreamReader asyncstream: newAsyncStreamReader(rsource: AsyncStreamReader): AsyncStreamReader
newAsyncStreamWriter chronos/streams/asyncstream.html#newAsyncStreamWriter,AsyncStreamWriter,StreamWriterLoop,ref.T asyncstream: newAsyncStreamWriter[T](wsource: AsyncStreamWriter; loop: StreamWriterLoop;\n queueSize = AsyncStreamDefaultQueueSize; udata: ref T): AsyncStreamWriter
newAsyncStreamWriter chronos/streams/asyncstream.html#newAsyncStreamWriter,AsyncStreamWriter,StreamWriterLoop asyncstream: newAsyncStreamWriter(wsource: AsyncStreamWriter; loop: StreamWriterLoop;\n queueSize = AsyncStreamDefaultQueueSize): AsyncStreamWriter
newAsyncStreamWriter chronos/streams/asyncstream.html#newAsyncStreamWriter,StreamTransport,ref.T asyncstream: newAsyncStreamWriter[T](tsource: StreamTransport; udata: ref T): AsyncStreamWriter
newAsyncStreamWriter chronos/streams/asyncstream.html#newAsyncStreamWriter,StreamTransport asyncstream: newAsyncStreamWriter(tsource: StreamTransport): AsyncStreamWriter
newAsyncStreamWriter chronos/streams/asyncstream.html#newAsyncStreamWriter,AsyncStreamWriter,ref.T asyncstream: newAsyncStreamWriter[T](wsource: AsyncStreamWriter; udata: ref T): AsyncStreamWriter
newAsyncStreamWriter chronos/streams/asyncstream.html#newAsyncStreamWriter,AsyncStreamWriter asyncstream: newAsyncStreamWriter(wsource: AsyncStreamWriter): AsyncStreamWriter
getUserData chronos/streams/asyncstream.html#getUserData,AsyncStreamRW asyncstream: getUserData[T](rw: AsyncStreamRW): T

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,14 @@
ChunkedStreamReader chronos/streams/chunkstream.html#ChunkedStreamReader chunkstream: ChunkedStreamReader
ChunkedStreamWriter chronos/streams/chunkstream.html#ChunkedStreamWriter chunkstream: ChunkedStreamWriter
ChunkedStreamError chronos/streams/chunkstream.html#ChunkedStreamError chunkstream: ChunkedStreamError
ChunkedStreamProtocolError chronos/streams/chunkstream.html#ChunkedStreamProtocolError chunkstream: ChunkedStreamProtocolError
ChunkedStreamIncompleteError chronos/streams/chunkstream.html#ChunkedStreamIncompleteError chunkstream: ChunkedStreamIncompleteError
hexValue chronos/streams/chunkstream.html#hexValue,byte chunkstream: hexValue(c: byte): int
init chronos/streams/chunkstream.html#init,ChunkedStreamReader,AsyncStreamReader,ref.T chunkstream: init[T](child: ChunkedStreamReader; rsource: AsyncStreamReader;\n bufferSize = ChunkBufferSize; udata: ref T)
init chronos/streams/chunkstream.html#init,ChunkedStreamReader,AsyncStreamReader chunkstream: init(child: ChunkedStreamReader; rsource: AsyncStreamReader;\n bufferSize = ChunkBufferSize)
newChunkedStreamReader chronos/streams/chunkstream.html#newChunkedStreamReader,AsyncStreamReader,ref.T chunkstream: newChunkedStreamReader[T](rsource: AsyncStreamReader;\n bufferSize = AsyncStreamDefaultBufferSize;\n udata: ref T): ChunkedStreamReader
newChunkedStreamReader chronos/streams/chunkstream.html#newChunkedStreamReader,AsyncStreamReader chunkstream: newChunkedStreamReader(rsource: AsyncStreamReader;\n bufferSize = AsyncStreamDefaultBufferSize): ChunkedStreamReader
init chronos/streams/chunkstream.html#init,ChunkedStreamWriter,AsyncStreamWriter,ref.T chunkstream: init[T](child: ChunkedStreamWriter; wsource: AsyncStreamWriter;\n queueSize = AsyncStreamDefaultQueueSize; udata: ref T)
init chronos/streams/chunkstream.html#init,ChunkedStreamWriter,AsyncStreamWriter chunkstream: init(child: ChunkedStreamWriter; wsource: AsyncStreamWriter;\n queueSize = AsyncStreamDefaultQueueSize)
newChunkedStreamWriter chronos/streams/chunkstream.html#newChunkedStreamWriter,AsyncStreamWriter,ref.T chunkstream: newChunkedStreamWriter[T](wsource: AsyncStreamWriter;\n queueSize = AsyncStreamDefaultQueueSize; udata: ref T): ChunkedStreamWriter
newChunkedStreamWriter chronos/streams/chunkstream.html#newChunkedStreamWriter,AsyncStreamWriter chunkstream: newChunkedStreamWriter(wsource: AsyncStreamWriter;\n queueSize = AsyncStreamDefaultQueueSize): ChunkedStreamWriter

1376
api/chronos/timer.html Normal file

File diff suppressed because it is too large Load Diff

76
api/chronos/timer.idx Normal file
View File

@ -0,0 +1,76 @@
asyncTimer chronos/timer.html#asyncTimer timer: asyncTimer
fastEpochTime chronos/timer.html#fastEpochTime timer: fastEpochTime(): uint64
Moment chronos/timer.html#Moment timer: Moment
Duration chronos/timer.html#Duration timer: Duration
SomeIntegerI64 chronos/timer.html#SomeIntegerI64 timer: SomeIntegerI64
`+` chronos/timer.html#+,Duration,Duration timer: `+`(a: Duration; b: Duration): Duration
`+` chronos/timer.html#+,Duration,Moment timer: `+`(a: Duration; b: Moment): Moment
`+` chronos/timer.html#+,Moment,Duration timer: `+`(a: Moment; b: Duration): Moment
`+=` chronos/timer.html#+=,Moment,Duration timer: `+=`(a: var Moment; b: Duration)
`+=` chronos/timer.html#+=,Duration,Duration timer: `+=`(a: var Duration; b: Duration)
`-` chronos/timer.html#-,Moment,Moment timer: `-`(a, b: Moment): Duration
`-` chronos/timer.html#-,Moment,Duration timer: `-`(a: Moment; b: Duration): Moment
`-` chronos/timer.html#-,Duration,Duration timer: `-`(a: Duration; b: Duration): Duration
`-=` chronos/timer.html#-=,Duration,Duration timer: `-=`(a: var Duration; b: Duration)
`-=` chronos/timer.html#-=,Moment,Duration timer: `-=`(a: var Moment; b: Duration)
`==` chronos/timer.html#==,Duration,Duration timer: `==`(a, b: Duration): bool
`==` chronos/timer.html#==,Moment,Moment timer: `==`(a, b: Moment): bool
`&lt;` chronos/timer.html#<,Duration,Duration timer: `&lt;`(a, b: Duration): bool
`&lt;` chronos/timer.html#<,Moment,Moment timer: `&lt;`(a, b: Moment): bool
`&lt;=` chronos/timer.html#<=,Duration,Duration timer: `&lt;=`(a, b: Duration): bool
`&lt;=` chronos/timer.html#<=,Moment,Moment timer: `&lt;=`(a, b: Moment): bool
`&gt;` chronos/timer.html#>,Duration,Duration timer: `&gt;`(a, b: Duration): bool
`&gt;` chronos/timer.html#>,Moment,Moment timer: `&gt;`(a, b: Moment): bool
`&gt;=` chronos/timer.html#>=,Duration,Duration timer: `&gt;=`(a, b: Duration): bool
`&gt;=` chronos/timer.html#>=,Moment,Moment timer: `&gt;=`(a, b: Moment): bool
`*` chronos/timer.html#*,Duration,SomeIntegerI64 timer: `*`(a: Duration; b: SomeIntegerI64): Duration
`*` chronos/timer.html#*,SomeIntegerI64,Duration timer: `*`(a: SomeIntegerI64; b: Duration): Duration
`div` chronos/timer.html#div,Duration,SomeIntegerI64 timer: `div`(a: Duration; b: SomeIntegerI64): Duration
Nanosecond chronos/timer.html#Nanosecond timer: Nanosecond
Microsecond chronos/timer.html#Microsecond timer: Microsecond
Millisecond chronos/timer.html#Millisecond timer: Millisecond
Second chronos/timer.html#Second timer: Second
Minute chronos/timer.html#Minute timer: Minute
Hour chronos/timer.html#Hour timer: Hour
Day chronos/timer.html#Day timer: Day
Week chronos/timer.html#Week timer: Week
ZeroDuration chronos/timer.html#ZeroDuration timer: ZeroDuration
InfiniteDuration chronos/timer.html#InfiniteDuration timer: InfiniteDuration
high chronos/timer.html#high.t,typedesc[Moment] timer: high(T: typedesc[Moment]): Moment
low chronos/timer.html#low.t,typedesc[Moment] timer: low(T: typedesc[Moment]): Moment
high chronos/timer.html#high.t,typedesc[Duration] timer: high(T: typedesc[Duration]): Duration
low chronos/timer.html#low.t,typedesc[Duration] timer: low(T: typedesc[Duration]): Duration
nanoseconds chronos/timer.html#nanoseconds,SomeIntegerI64 timer: nanoseconds(v: SomeIntegerI64): Duration
microseconds chronos/timer.html#microseconds,SomeIntegerI64 timer: microseconds(v: SomeIntegerI64): Duration
milliseconds chronos/timer.html#milliseconds,SomeIntegerI64 timer: milliseconds(v: SomeIntegerI64): Duration
seconds chronos/timer.html#seconds,SomeIntegerI64 timer: seconds(v: SomeIntegerI64): Duration
minutes chronos/timer.html#minutes,SomeIntegerI64 timer: minutes(v: SomeIntegerI64): Duration
hours chronos/timer.html#hours,SomeIntegerI64 timer: hours(v: SomeIntegerI64): Duration
days chronos/timer.html#days,SomeIntegerI64 timer: days(v: SomeIntegerI64): Duration
weeks chronos/timer.html#weeks,SomeIntegerI64 timer: weeks(v: SomeIntegerI64): Duration
nanoseconds chronos/timer.html#nanoseconds,Duration timer: nanoseconds(v: Duration): int64
microseconds chronos/timer.html#microseconds,Duration timer: microseconds(v: Duration): int64
milliseconds chronos/timer.html#milliseconds,Duration timer: milliseconds(v: Duration): int64
seconds chronos/timer.html#seconds,Duration timer: seconds(v: Duration): int64
minutes chronos/timer.html#minutes,Duration timer: minutes(v: Duration): int64
hours chronos/timer.html#hours,Duration timer: hours(v: Duration): int64
days chronos/timer.html#days,Duration timer: days(v: Duration): int64
weeks chronos/timer.html#weeks,Duration timer: weeks(v: Duration): int64
nanos chronos/timer.html#nanos,SomeIntegerI64 timer: nanos(v: SomeIntegerI64): Duration
micros chronos/timer.html#micros,SomeIntegerI64 timer: micros(v: SomeIntegerI64): Duration
millis chronos/timer.html#millis,SomeIntegerI64 timer: millis(v: SomeIntegerI64): Duration
secs chronos/timer.html#secs,SomeIntegerI64 timer: secs(v: SomeIntegerI64): Duration
nanos chronos/timer.html#nanos,Duration timer: nanos(v: Duration): int64
micros chronos/timer.html#micros,Duration timer: micros(v: Duration): int64
millis chronos/timer.html#millis,Duration timer: millis(v: Duration): int64
secs chronos/timer.html#secs,Duration timer: secs(v: Duration): int64
toString chronos/timer.html#toString timer: toString(a: timer.Duration; parts = int.high): string
`$` chronos/timer.html#$,Duration timer: `$`(a: Duration): string
`$` chronos/timer.html#$,Moment timer: `$`(a: Moment): string
isZero chronos/timer.html#isZero,Duration timer: isZero(a: Duration): bool
isInfinite chronos/timer.html#isInfinite,Duration timer: isInfinite(a: Duration): bool
now chronos/timer.html#now,typedesc[Moment] timer: now(t: typedesc[Moment]): Moment
init chronos/timer.html#init,typedesc[Moment],int64,Duration timer: init(t: typedesc[Moment]; value: int64; precision: Duration): Moment
epochSeconds chronos/timer.html#epochSeconds,Moment timer: epochSeconds(moment: Moment): int64
epochNanoSeconds chronos/timer.html#epochNanoSeconds,Moment timer: epochNanoSeconds(moment: Moment): int64
fromNow chronos/timer.html#fromNow,typedesc[Moment],Duration timer: fromNow(t: typedesc[Moment]; a: Duration): Moment

151
api/chronos/transport.html Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,90 @@
DefaultStreamBufferSize chronos/transports/common.html#DefaultStreamBufferSize common: DefaultStreamBufferSize
DefaultDatagramBufferSize chronos/transports/common.html#DefaultDatagramBufferSize common: DefaultDatagramBufferSize
ReuseAddr chronos/transports/common.html#ReuseAddr ServerFlags.ReuseAddr
ReusePort chronos/transports/common.html#ReusePort ServerFlags.ReusePort
TcpNoDelay chronos/transports/common.html#TcpNoDelay ServerFlags.TcpNoDelay
NoAutoRead chronos/transports/common.html#NoAutoRead ServerFlags.NoAutoRead
GCUserData chronos/transports/common.html#GCUserData ServerFlags.GCUserData
FirstPipe chronos/transports/common.html#FirstPipe ServerFlags.FirstPipe
NoPipeFlash chronos/transports/common.html#NoPipeFlash ServerFlags.NoPipeFlash
Broadcast chronos/transports/common.html#Broadcast ServerFlags.Broadcast
V4Mapped chronos/transports/common.html#V4Mapped ServerFlags.V4Mapped
ServerFlags chronos/transports/common.html#ServerFlags common: ServerFlags
DualStackType chronos/transports/common.html#DualStackType common: DualStackType
AddressFamily chronos/transports/common.html#AddressFamily common: AddressFamily
TransportAddress chronos/transports/common.html#TransportAddress common: TransportAddress
Start chronos/transports/common.html#Start ServerCommand.Start
Pause chronos/transports/common.html#Pause ServerCommand.Pause
Stop chronos/transports/common.html#Stop ServerCommand.Stop
ServerCommand chronos/transports/common.html#ServerCommand common: ServerCommand
Starting chronos/transports/common.html#Starting ServerStatus.Starting
Stopped chronos/transports/common.html#Stopped ServerStatus.Stopped
Running chronos/transports/common.html#Running ServerStatus.Running
Closed chronos/transports/common.html#Closed ServerStatus.Closed
ServerStatus chronos/transports/common.html#ServerStatus common: ServerStatus
SocketServer chronos/transports/common.html#SocketServer common: SocketServer
TransportError chronos/transports/common.html#TransportError common: TransportError
TransportOsError chronos/transports/common.html#TransportOsError common: TransportOsError
TransportIncompleteError chronos/transports/common.html#TransportIncompleteError common: TransportIncompleteError
TransportLimitError chronos/transports/common.html#TransportLimitError common: TransportLimitError
TransportAddressError chronos/transports/common.html#TransportAddressError common: TransportAddressError
TransportNoSupport chronos/transports/common.html#TransportNoSupport common: TransportNoSupport
TransportUseClosedError chronos/transports/common.html#TransportUseClosedError common: TransportUseClosedError
TransportUseEofError chronos/transports/common.html#TransportUseEofError common: TransportUseEofError
TransportTooManyError chronos/transports/common.html#TransportTooManyError common: TransportTooManyError
TransportAbortedError chronos/transports/common.html#TransportAbortedError common: TransportAbortedError
ReadPending chronos/transports/common.html#ReadPending TransportState.ReadPending
ReadPaused chronos/transports/common.html#ReadPaused TransportState.ReadPaused
ReadClosed chronos/transports/common.html#ReadClosed TransportState.ReadClosed
ReadEof chronos/transports/common.html#ReadEof TransportState.ReadEof
ReadError chronos/transports/common.html#ReadError TransportState.ReadError
WritePending chronos/transports/common.html#WritePending TransportState.WritePending
WritePaused chronos/transports/common.html#WritePaused TransportState.WritePaused
WriteClosed chronos/transports/common.html#WriteClosed TransportState.WriteClosed
WriteEof chronos/transports/common.html#WriteEof TransportState.WriteEof
WriteError chronos/transports/common.html#WriteError TransportState.WriteError
TransportState chronos/transports/common.html#TransportState common: TransportState
AnyAddress chronos/transports/common.html#AnyAddress common: AnyAddress
AnyAddress6 chronos/transports/common.html#AnyAddress6 common: AnyAddress6
`==` chronos/transports/common.html#==,TransportAddress,TransportAddress common: `==`(lhs, rhs: TransportAddress): bool
getDomain chronos/transports/common.html#getDomain,TransportAddress common: getDomain(address: TransportAddress): Domain
`$` chronos/transports/common.html#$,TransportAddress common: `$`(address: TransportAddress): string
toIpAddress chronos/transports/common.html#toIpAddress,TransportAddress common: toIpAddress(address: TransportAddress): IpAddress
toHex chronos/transports/common.html#toHex,TransportAddress common: toHex(address: TransportAddress): string
initTAddress chronos/transports/common.html#initTAddress,string common: initTAddress(address: string): TransportAddress
initTAddress chronos/transports/common.html#initTAddress,string,Port common: initTAddress(address: string; port: Port): TransportAddress
initTAddress chronos/transports/common.html#initTAddress,string,int common: initTAddress(address: string; port: int): TransportAddress
initTAddress chronos/transports/common.html#initTAddress,IpAddress,Port common: initTAddress(address: IpAddress; port: Port): TransportAddress
fromSAddr chronos/transports/common.html#fromSAddr,ptr.Sockaddr_storage,SockLen,TransportAddress common: fromSAddr(sa: ptr Sockaddr_storage; sl: SockLen; address: var TransportAddress)
toSAddr chronos/transports/common.html#toSAddr,TransportAddress,Sockaddr_storage,SockLen common: toSAddr(address: TransportAddress; sa: var Sockaddr_storage; sl: var SockLen)
address chronos/transports/common.html#address,TransportAddress common: address(ta: TransportAddress): IpAddress
host chronos/transports/common.html#host,TransportAddress common: host(ta: TransportAddress): string
resolveTAddress chronos/transports/common.html#resolveTAddress,string,Port,Domain common: resolveTAddress(address: string; port: Port; domain: Domain): seq[\n TransportAddress]
resolveTAddress chronos/transports/common.html#resolveTAddress,string,Domain common: resolveTAddress(address: string; domain: Domain): seq[TransportAddress]
resolveTAddress chronos/transports/common.html#resolveTAddress,string common: resolveTAddress(address: string): seq[TransportAddress]
resolveTAddress chronos/transports/common.html#resolveTAddress,string,Port common: resolveTAddress(address: string; port: Port): seq[TransportAddress]
resolveTAddress chronos/transports/common.html#resolveTAddress,string,AddressFamily common: resolveTAddress(address: string; family: AddressFamily): seq[TransportAddress]
resolveTAddress chronos/transports/common.html#resolveTAddress,string,Port,AddressFamily common: resolveTAddress(address: string; port: Port; family: AddressFamily): seq[\n TransportAddress]
resolveTAddress chronos/transports/common.html#resolveTAddress,string,IpAddressFamily common: resolveTAddress(address: string; family: IpAddressFamily): seq[TransportAddress]
resolveTAddress chronos/transports/common.html#resolveTAddress,string,Port,IpAddressFamily common: resolveTAddress(address: string; port: Port; family: IpAddressFamily): seq[\n TransportAddress]
windowsAnyAddressFix chronos/transports/common.html#windowsAnyAddressFix,TransportAddress common: windowsAnyAddressFix(a: TransportAddress): TransportAddress
checkClosed chronos/transports/common.html#checkClosed.t,untyped common: checkClosed(t: untyped)
checkClosed chronos/transports/common.html#checkClosed.t,untyped,untyped common: checkClosed(t: untyped; future: untyped)
checkWriteEof chronos/transports/common.html#checkWriteEof.t,untyped,untyped common: checkWriteEof(t: untyped; future: untyped)
getError chronos/transports/common.html#getError.t,untyped common: getError(t: untyped): ref TransportError
getServerUseClosedError chronos/transports/common.html#getServerUseClosedError.t common: getServerUseClosedError(): ref TransportUseClosedError
getTransportUseClosedError chronos/transports/common.html#getTransportUseClosedError.t common: getTransportUseClosedError(): ref TransportUseClosedError
getTransportOsError chronos/transports/common.html#getTransportOsError.t,OSErrorCode common: getTransportOsError(err: OSErrorCode): ref TransportOsError
getTransportOsError chronos/transports/common.html#getTransportOsError.t,cint common: getTransportOsError(err: cint): ref TransportOsError
raiseTransportOsError chronos/transports/common.html#raiseTransportOsError,OSErrorCode common: raiseTransportOsError(err: OSErrorCode)
getTransportTooManyError chronos/transports/common.html#getTransportTooManyError.t common: getTransportTooManyError(code = OSErrorCode(0)): ref TransportTooManyError
getConnectionAbortedError chronos/transports/common.html#getConnectionAbortedError.t,string common: getConnectionAbortedError(m: string = &quot;&quot;): ref TransportAbortedError
getConnectionAbortedError chronos/transports/common.html#getConnectionAbortedError.t,OSErrorCode common: getConnectionAbortedError(code: OSErrorCode): ref TransportAbortedError
getTransportError chronos/transports/common.html#getTransportError.t,OSErrorCode common: getTransportError(ecode: OSErrorCode): untyped
raiseTransportError chronos/transports/common.html#raiseTransportError,OSErrorCode common: raiseTransportError(ecode: OSErrorCode)
isAvailable chronos/transports/common.html#isAvailable,AddressFamily common: isAvailable(family: AddressFamily): bool
getDomain chronos/transports/common.html#getDomain,AsyncFD common: getDomain(socket: AsyncFD): Result[AddressFamily, OSErrorCode]
setDualstack chronos/transports/common.html#setDualstack,AsyncFD,AddressFamily,DualStackType common: setDualstack(socket: AsyncFD; family: AddressFamily; flag: DualStackType): Result[\n void, OSErrorCode]
setDualstack chronos/transports/common.html#setDualstack,AsyncFD,DualStackType common: setDualstack(socket: AsyncFD; flag: DualStackType): Result[void, OSErrorCode]
getAutoAddress chronos/transports/common.html#getAutoAddress,Port common: getAutoAddress(port: Port): TransportAddress
getAutoAddresses chronos/transports/common.html#getAutoAddresses,Port,Port common: getAutoAddresses(localPort: Port; remotePort: Port): tuple[\n local: TransportAddress, remote: TransportAddress]

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,33 @@
DatagramCallback chronos/transports/datagram.html#DatagramCallback datagram: DatagramCallback
UnsafeDatagramCallback chronos/transports/datagram.html#UnsafeDatagramCallback datagram: UnsafeDatagramCallback
DatagramTransport chronos/transports/datagram.html#DatagramTransport datagram: DatagramTransport
DgramTransportTrackerName chronos/transports/datagram.html#DgramTransportTrackerName datagram: DgramTransportTrackerName
remoteAddress2 chronos/transports/datagram.html#remoteAddress2,DatagramTransport datagram: remoteAddress2(transp: DatagramTransport): Result[TransportAddress, OSErrorCode]
localAddress2 chronos/transports/datagram.html#localAddress2,DatagramTransport datagram: localAddress2(transp: DatagramTransport): Result[TransportAddress, OSErrorCode]
remoteAddress chronos/transports/datagram.html#remoteAddress,DatagramTransport datagram: remoteAddress(transp: DatagramTransport): TransportAddress
localAddress chronos/transports/datagram.html#localAddress,DatagramTransport datagram: localAddress(transp: DatagramTransport): TransportAddress
close chronos/transports/datagram.html#close,DatagramTransport datagram: close(transp: DatagramTransport)
newDatagramTransport chronos/transports/datagram.html#newDatagramTransport,DatagramCallback,TransportAddress,TransportAddress,AsyncFD,set[ServerFlags],pointer,DatagramTransport,int,int datagram: newDatagramTransport(cbproc: DatagramCallback;\n remote: TransportAddress = AnyAddress;\n local: TransportAddress = AnyAddress;\n sock: AsyncFD = asyncInvalidSocket;\n flags: set[ServerFlags] = {}; udata: pointer = nil;\n child: DatagramTransport = nil;\n bufSize: int = DefaultDatagramBufferSize; ttl: int = 0;\n dualstack = DualStackType.Auto): DatagramTransport
newDatagramTransport chronos/transports/datagram.html#newDatagramTransport,DatagramCallback,ref.T,TransportAddress,TransportAddress,AsyncFD,set[ServerFlags],DatagramTransport,int,int datagram: newDatagramTransport[T](cbproc: DatagramCallback; udata: ref T;\n remote: TransportAddress = AnyAddress;\n local: TransportAddress = AnyAddress;\n sock: AsyncFD = asyncInvalidSocket;\n flags: set[ServerFlags] = {};\n child: DatagramTransport = nil;\n bufSize: int = DefaultDatagramBufferSize; ttl: int = 0;\n dualstack = DualStackType.Auto): DatagramTransport
newDatagramTransport6 chronos/transports/datagram.html#newDatagramTransport6,DatagramCallback,TransportAddress,TransportAddress,AsyncFD,set[ServerFlags],pointer,DatagramTransport,int,int datagram: newDatagramTransport6(cbproc: DatagramCallback;\n remote: TransportAddress = AnyAddress6;\n local: TransportAddress = AnyAddress6;\n sock: AsyncFD = asyncInvalidSocket;\n flags: set[ServerFlags] = {}; udata: pointer = nil;\n child: DatagramTransport = nil;\n bufSize: int = DefaultDatagramBufferSize; ttl: int = 0;\n dualstack = DualStackType.Auto): DatagramTransport
newDatagramTransport6 chronos/transports/datagram.html#newDatagramTransport6,DatagramCallback,ref.T,TransportAddress,TransportAddress,AsyncFD,set[ServerFlags],DatagramTransport,int,int datagram: newDatagramTransport6[T](cbproc: DatagramCallback; udata: ref T;\n remote: TransportAddress = AnyAddress6;\n local: TransportAddress = AnyAddress6;\n sock: AsyncFD = asyncInvalidSocket;\n flags: set[ServerFlags] = {};\n child: DatagramTransport = nil;\n bufSize: int = DefaultDatagramBufferSize; ttl: int = 0;\n dualstack = DualStackType.Auto): DatagramTransport
newDatagramTransport chronos/transports/datagram.html#newDatagramTransport,UnsafeDatagramCallback,TransportAddress,TransportAddress,AsyncFD,set[ServerFlags],pointer,DatagramTransport,int,int datagram: newDatagramTransport(cbproc: UnsafeDatagramCallback;\n remote: TransportAddress = AnyAddress;\n local: TransportAddress = AnyAddress;\n sock: AsyncFD = asyncInvalidSocket;\n flags: set[ServerFlags] = {}; udata: pointer = nil;\n child: DatagramTransport = nil;\n bufSize: int = DefaultDatagramBufferSize; ttl: int = 0;\n dualstack = DualStackType.Auto): DatagramTransport
newDatagramTransport chronos/transports/datagram.html#newDatagramTransport,UnsafeDatagramCallback,ref.T,TransportAddress,TransportAddress,AsyncFD,set[ServerFlags],DatagramTransport,int,int datagram: newDatagramTransport[T](cbproc: UnsafeDatagramCallback; udata: ref T;\n remote: TransportAddress = AnyAddress;\n local: TransportAddress = AnyAddress;\n sock: AsyncFD = asyncInvalidSocket;\n flags: set[ServerFlags] = {};\n child: DatagramTransport = nil;\n bufSize: int = DefaultDatagramBufferSize; ttl: int = 0;\n dualstack = DualStackType.Auto): DatagramTransport
newDatagramTransport6 chronos/transports/datagram.html#newDatagramTransport6,UnsafeDatagramCallback,TransportAddress,TransportAddress,AsyncFD,set[ServerFlags],pointer,DatagramTransport,int,int datagram: newDatagramTransport6(cbproc: UnsafeDatagramCallback;\n remote: TransportAddress = AnyAddress6;\n local: TransportAddress = AnyAddress6;\n sock: AsyncFD = asyncInvalidSocket;\n flags: set[ServerFlags] = {}; udata: pointer = nil;\n child: DatagramTransport = nil;\n bufSize: int = DefaultDatagramBufferSize; ttl: int = 0;\n dualstack = DualStackType.Auto): DatagramTransport
newDatagramTransport6 chronos/transports/datagram.html#newDatagramTransport6,UnsafeDatagramCallback,ref.T,TransportAddress,TransportAddress,AsyncFD,set[ServerFlags],DatagramTransport,int,int datagram: newDatagramTransport6[T](cbproc: UnsafeDatagramCallback; udata: ref T;\n remote: TransportAddress = AnyAddress6;\n local: TransportAddress = AnyAddress6;\n sock: AsyncFD = asyncInvalidSocket;\n flags: set[ServerFlags] = {};\n child: DatagramTransport = nil;\n bufSize: int = DefaultDatagramBufferSize; ttl: int = 0;\n dualstack = DualStackType.Auto): DatagramTransport
newDatagramTransport chronos/transports/datagram.html#newDatagramTransport,DatagramCallback,Port,Port,Opt[IpAddress],Opt[IpAddress],set[ServerFlags],pointer,DatagramTransport,int,int datagram: newDatagramTransport(cbproc: DatagramCallback; localPort: Port;\n remotePort: Port;\n local: Opt[IpAddress] = Opt.none(IpAddress);\n remote: Opt[IpAddress] = Opt.none(IpAddress);\n flags: set[ServerFlags] = {}; udata: pointer = nil;\n child: DatagramTransport = nil;\n bufSize: int = DefaultDatagramBufferSize; ttl: int = 0;\n dualstack = DualStackType.Auto): DatagramTransport
newDatagramTransport chronos/transports/datagram.html#newDatagramTransport,DatagramCallback,Port,Opt[IpAddress],set[ServerFlags],pointer,DatagramTransport,int,int datagram: newDatagramTransport(cbproc: DatagramCallback; localPort: Port;\n local: Opt[IpAddress] = Opt.none(IpAddress);\n flags: set[ServerFlags] = {}; udata: pointer = nil;\n child: DatagramTransport = nil;\n bufSize: int = DefaultDatagramBufferSize; ttl: int = 0;\n dualstack = DualStackType.Auto): DatagramTransport
newDatagramTransport chronos/transports/datagram.html#newDatagramTransport,DatagramCallback,Port,Port,Opt[IpAddress],Opt[IpAddress],set[ServerFlags],ref.T,DatagramTransport,int,int datagram: newDatagramTransport[T](cbproc: DatagramCallback; localPort: Port;\n remotePort: Port;\n local: Opt[IpAddress] = Opt.none(IpAddress);\n remote: Opt[IpAddress] = Opt.none(IpAddress);\n flags: set[ServerFlags] = {}; udata: ref T;\n child: DatagramTransport = nil;\n bufSize: int = DefaultDatagramBufferSize; ttl: int = 0;\n dualstack = DualStackType.Auto): DatagramTransport
newDatagramTransport chronos/transports/datagram.html#newDatagramTransport,DatagramCallback,Port,Opt[IpAddress],set[ServerFlags],ref.T,DatagramTransport,int,int datagram: newDatagramTransport[T](cbproc: DatagramCallback; localPort: Port;\n local: Opt[IpAddress] = Opt.none(IpAddress);\n flags: set[ServerFlags] = {}; udata: ref T;\n child: DatagramTransport = nil;\n bufSize: int = DefaultDatagramBufferSize; ttl: int = 0;\n dualstack = DualStackType.Auto): DatagramTransport
join chronos/transports/datagram.html#join,DatagramTransport datagram: join(transp: DatagramTransport): InternalRaisesFuture[void, (CancelledError,)]
closed chronos/transports/datagram.html#closed,DatagramTransport datagram: closed(transp: DatagramTransport): bool
closeWait chronos/transports/datagram.html#closeWait,DatagramTransport datagram: closeWait(transp: DatagramTransport): InternalRaisesFuture[void, void]
send chronos/transports/datagram.html#send,DatagramTransport,pointer,int datagram: send(transp: DatagramTransport; pbytes: pointer; nbytes: int): InternalRaisesFuture[\n void, (TransportError, CancelledError)]
send chronos/transports/datagram.html#send,DatagramTransport,string,int datagram: send(transp: DatagramTransport; msg: string; msglen = -1): InternalRaisesFuture[\n void, (TransportError, CancelledError)]
send chronos/transports/datagram.html#send,DatagramTransport,seq[T],int datagram: send[T](transp: DatagramTransport; msg: seq[T]; msglen = -1): InternalRaisesFuture[\n void, (TransportError, CancelledError)]
sendTo chronos/transports/datagram.html#sendTo,DatagramTransport,TransportAddress,pointer,int datagram: sendTo(transp: DatagramTransport; remote: TransportAddress; pbytes: pointer;\n nbytes: int): InternalRaisesFuture[void,\n (TransportError, CancelledError)]
sendTo chronos/transports/datagram.html#sendTo,DatagramTransport,TransportAddress,string,int datagram: sendTo(transp: DatagramTransport; remote: TransportAddress; msg: string;\n msglen = -1): InternalRaisesFuture[void,\n (TransportError, CancelledError)]
sendTo chronos/transports/datagram.html#sendTo,DatagramTransport,TransportAddress,seq[T],int datagram: sendTo[T](transp: DatagramTransport; remote: TransportAddress; msg: seq[T];\n msglen = -1): InternalRaisesFuture[void,\n (TransportError, CancelledError)]
peekMessage chronos/transports/datagram.html#peekMessage,DatagramTransport,seq[byte],int datagram: peekMessage(transp: DatagramTransport; msg: var seq[byte]; msglen: var int)
getMessage chronos/transports/datagram.html#getMessage,DatagramTransport datagram: getMessage(transp: DatagramTransport): seq[byte]
getUserData chronos/transports/datagram.html#getUserData,DatagramTransport datagram: getUserData[T](transp: DatagramTransport): T

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,54 @@
IpMask chronos/transports/ipnet.html#IpMask ipnet: IpMask
IpNet chronos/transports/ipnet.html#IpNet ipnet: IpNet
`==` chronos/transports/ipnet.html#==,IpMask,IpMask ipnet: `==`(m1, m2: IpMask): bool
init chronos/transports/ipnet.html#init,typedesc[IpMask],AddressFamily,int ipnet: init(t: typedesc[IpMask]; family: AddressFamily; prefix: int): IpMask
init chronos/transports/ipnet.html#init,typedesc[IpMask],TransportAddress ipnet: init(t: typedesc[IpMask]; netmask: TransportAddress): IpMask
initIp chronos/transports/ipnet.html#initIp,typedesc[IpMask],string ipnet: initIp(t: typedesc[IpMask]; netmask: string): IpMask
init chronos/transports/ipnet.html#init,typedesc[IpMask],string ipnet: init(t: typedesc[IpMask]; netmask: string): IpMask
toIPv6 chronos/transports/ipnet.html#toIPv6,TransportAddress ipnet: toIPv6(address: TransportAddress): TransportAddress
isV4Mapped chronos/transports/ipnet.html#isV4Mapped,TransportAddress ipnet: isV4Mapped(address: TransportAddress): bool
toIPv4 chronos/transports/ipnet.html#toIPv4,TransportAddress ipnet: toIPv4(address: TransportAddress): TransportAddress
mask chronos/transports/ipnet.html#mask,TransportAddress,IpMask ipnet: mask(a: TransportAddress; m: IpMask): TransportAddress
prefix chronos/transports/ipnet.html#prefix,IpMask ipnet: prefix(mask: IpMask): int
subnetMask chronos/transports/ipnet.html#subnetMask,IpMask ipnet: subnetMask(mask: IpMask): TransportAddress
`$` chronos/transports/ipnet.html#$,IpMask ipnet: `$`(mask: IpMask; include0x = false): string
ip chronos/transports/ipnet.html#ip,IpMask ipnet: ip(mask: IpMask): string
init chronos/transports/ipnet.html#init,typedesc[IpNet],TransportAddress,int ipnet: init(t: typedesc[IpNet]; host: TransportAddress; prefix: int): IpNet
init chronos/transports/ipnet.html#init,typedesc[IpNet],TransportAddress,TransportAddress ipnet: init(t: typedesc[IpNet]; host, mask: TransportAddress): IpNet
init chronos/transports/ipnet.html#init,typedesc[IpNet],TransportAddress,IpMask ipnet: init(t: typedesc[IpNet]; host: TransportAddress; mask: IpMask): IpNet
init chronos/transports/ipnet.html#init,typedesc[IpNet],string ipnet: init(t: typedesc[IpNet]; network: string): IpNet
`==` chronos/transports/ipnet.html#==,IpNet,IpNet ipnet: `==`(n1, n2: IpNet): bool
contains chronos/transports/ipnet.html#contains,IpNet,TransportAddress ipnet: contains(net: IpNet; address: TransportAddress): bool
broadcast chronos/transports/ipnet.html#broadcast,IpNet ipnet: broadcast(net: IpNet): TransportAddress
subnetMask chronos/transports/ipnet.html#subnetMask,IpNet ipnet: subnetMask(net: IpNet): TransportAddress
network chronos/transports/ipnet.html#network,IpNet ipnet: network(net: IpNet): TransportAddress
`and` chronos/transports/ipnet.html#and,TransportAddress,TransportAddress ipnet: `and`(address1, address2: TransportAddress): TransportAddress
`or` chronos/transports/ipnet.html#or,TransportAddress,TransportAddress ipnet: `or`(address1, address2: TransportAddress): TransportAddress
`not` chronos/transports/ipnet.html#not,TransportAddress ipnet: `not`(address: TransportAddress): TransportAddress
`+` chronos/transports/ipnet.html#+,TransportAddress, ipnet: `+`(address: TransportAddress; v: int | uint): TransportAddress
`-` chronos/transports/ipnet.html#-,TransportAddress, ipnet: `-`(address: TransportAddress; v: int | uint): TransportAddress
inc chronos/transports/ipnet.html#inc,TransportAddress,int ipnet: inc(address: var TransportAddress; v: int = 1)
dec chronos/transports/ipnet.html#dec,TransportAddress,int ipnet: dec(address: var TransportAddress; v: int = 1)
`$` chronos/transports/ipnet.html#$,IpNet ipnet: `$`(net: IpNet): string
isNone chronos/transports/ipnet.html#isNone,TransportAddress ipnet: isNone(address: TransportAddress): bool
isZero chronos/transports/ipnet.html#isZero,TransportAddress ipnet: isZero(address: TransportAddress): bool
isUnspecified chronos/transports/ipnet.html#isUnspecified,TransportAddress ipnet: isUnspecified(address: TransportAddress): bool
isMulticast chronos/transports/ipnet.html#isMulticast,TransportAddress ipnet: isMulticast(address: TransportAddress): bool
isUnicast chronos/transports/ipnet.html#isUnicast,TransportAddress ipnet: isUnicast(address: TransportAddress): bool
isInterfaceLocalMulticast chronos/transports/ipnet.html#isInterfaceLocalMulticast,TransportAddress ipnet: isInterfaceLocalMulticast(address: TransportAddress): bool
isLinkLocalMulticast chronos/transports/ipnet.html#isLinkLocalMulticast,TransportAddress ipnet: isLinkLocalMulticast(address: TransportAddress): bool
isUniqueLocal chronos/transports/ipnet.html#isUniqueLocal,TransportAddress ipnet: isUniqueLocal(address: TransportAddress): bool
isUnicastLinkLocal chronos/transports/ipnet.html#isUnicastLinkLocal,TransportAddress ipnet: isUnicastLinkLocal(address: TransportAddress): bool
isLoopback chronos/transports/ipnet.html#isLoopback,TransportAddress ipnet: isLoopback(address: TransportAddress): bool
isAnyLocal chronos/transports/ipnet.html#isAnyLocal,TransportAddress ipnet: isAnyLocal(address: TransportAddress): bool
isLinkLocal chronos/transports/ipnet.html#isLinkLocal,TransportAddress ipnet: isLinkLocal(address: TransportAddress): bool
isLinkLocalUnicast chronos/transports/ipnet.html#isLinkLocalUnicast,TransportAddress ipnet: isLinkLocalUnicast(address: TransportAddress): bool
isSiteLocal chronos/transports/ipnet.html#isSiteLocal,TransportAddress ipnet: isSiteLocal(address: TransportAddress): bool
isPrivate chronos/transports/ipnet.html#isPrivate,TransportAddress ipnet: isPrivate(address: TransportAddress): bool
isGlobalMulticast chronos/transports/ipnet.html#isGlobalMulticast,TransportAddress ipnet: isGlobalMulticast(address: TransportAddress): bool
isShared chronos/transports/ipnet.html#isShared,TransportAddress ipnet: isShared(address: TransportAddress): bool
isBroadcast chronos/transports/ipnet.html#isBroadcast,TransportAddress ipnet: isBroadcast(address: TransportAddress): bool
isBenchmarking chronos/transports/ipnet.html#isBenchmarking,TransportAddress ipnet: isBenchmarking(address: TransportAddress): bool
isDocumentation chronos/transports/ipnet.html#isDocumentation,TransportAddress ipnet: isDocumentation(address: TransportAddress): bool
isReserved chronos/transports/ipnet.html#isReserved,TransportAddress ipnet: isReserved(address: TransportAddress): bool
isGlobal chronos/transports/ipnet.html#isGlobal,TransportAddress ipnet: isGlobal(address: TransportAddress): bool

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,228 @@
MaxAdapterAddressLength chronos/transports/osnet.html#MaxAdapterAddressLength osnet: MaxAdapterAddressLength
IfError chronos/transports/osnet.html#IfError InterfaceType.IfError
IfOther chronos/transports/osnet.html#IfOther InterfaceType.IfOther
IfRegular1822 chronos/transports/osnet.html#IfRegular1822 InterfaceType.IfRegular1822
IfHdh1822 chronos/transports/osnet.html#IfHdh1822 InterfaceType.IfHdh1822
IfDdnX25 chronos/transports/osnet.html#IfDdnX25 InterfaceType.IfDdnX25
IfRfc877X25 chronos/transports/osnet.html#IfRfc877X25 InterfaceType.IfRfc877X25
IfEthernetCsmacd chronos/transports/osnet.html#IfEthernetCsmacd InterfaceType.IfEthernetCsmacd
IfIso88023Csmacd chronos/transports/osnet.html#IfIso88023Csmacd InterfaceType.IfIso88023Csmacd
IfIso88024TokenBus chronos/transports/osnet.html#IfIso88024TokenBus InterfaceType.IfIso88024TokenBus
IfIso88025TokenRing chronos/transports/osnet.html#IfIso88025TokenRing InterfaceType.IfIso88025TokenRing
IfIso88026MAN chronos/transports/osnet.html#IfIso88026MAN InterfaceType.IfIso88026MAN
IfStarlan chronos/transports/osnet.html#IfStarlan InterfaceType.IfStarlan
IfProteon10Mbit chronos/transports/osnet.html#IfProteon10Mbit InterfaceType.IfProteon10Mbit
IfProteon80Mbit chronos/transports/osnet.html#IfProteon80Mbit InterfaceType.IfProteon80Mbit
IfHyperChannel chronos/transports/osnet.html#IfHyperChannel InterfaceType.IfHyperChannel
IfFddi chronos/transports/osnet.html#IfFddi InterfaceType.IfFddi
IfLapB chronos/transports/osnet.html#IfLapB InterfaceType.IfLapB
IfSdlc chronos/transports/osnet.html#IfSdlc InterfaceType.IfSdlc
IfDs1 chronos/transports/osnet.html#IfDs1 InterfaceType.IfDs1
IfE1 chronos/transports/osnet.html#IfE1 InterfaceType.IfE1
IfBasicIsdn chronos/transports/osnet.html#IfBasicIsdn InterfaceType.IfBasicIsdn
IfPrimaryIsdn chronos/transports/osnet.html#IfPrimaryIsdn InterfaceType.IfPrimaryIsdn
IfPropPoint2PointSerial chronos/transports/osnet.html#IfPropPoint2PointSerial InterfaceType.IfPropPoint2PointSerial
IfPpp chronos/transports/osnet.html#IfPpp InterfaceType.IfPpp
IfSoftwareLoopback chronos/transports/osnet.html#IfSoftwareLoopback InterfaceType.IfSoftwareLoopback
IfEon chronos/transports/osnet.html#IfEon InterfaceType.IfEon
IfEthernet3Mbit chronos/transports/osnet.html#IfEthernet3Mbit InterfaceType.IfEthernet3Mbit
IfNsip chronos/transports/osnet.html#IfNsip InterfaceType.IfNsip
IfSlip chronos/transports/osnet.html#IfSlip InterfaceType.IfSlip
IfUltra chronos/transports/osnet.html#IfUltra InterfaceType.IfUltra
IfDs3 chronos/transports/osnet.html#IfDs3 InterfaceType.IfDs3
IfSip chronos/transports/osnet.html#IfSip InterfaceType.IfSip
IfFrameRelay chronos/transports/osnet.html#IfFrameRelay InterfaceType.IfFrameRelay
IfRs232 chronos/transports/osnet.html#IfRs232 InterfaceType.IfRs232
IfPara chronos/transports/osnet.html#IfPara InterfaceType.IfPara
IfArcNet chronos/transports/osnet.html#IfArcNet InterfaceType.IfArcNet
IfArcNetPlus chronos/transports/osnet.html#IfArcNetPlus InterfaceType.IfArcNetPlus
IfAtm chronos/transports/osnet.html#IfAtm InterfaceType.IfAtm
IfMioX25 chronos/transports/osnet.html#IfMioX25 InterfaceType.IfMioX25
IfSonet chronos/transports/osnet.html#IfSonet InterfaceType.IfSonet
IfX25Ple chronos/transports/osnet.html#IfX25Ple InterfaceType.IfX25Ple
IfIso88022Llc chronos/transports/osnet.html#IfIso88022Llc InterfaceType.IfIso88022Llc
IfLocalTalk chronos/transports/osnet.html#IfLocalTalk InterfaceType.IfLocalTalk
IfSmdsDxi chronos/transports/osnet.html#IfSmdsDxi InterfaceType.IfSmdsDxi
IfFrameRelayService chronos/transports/osnet.html#IfFrameRelayService InterfaceType.IfFrameRelayService
IfV35 chronos/transports/osnet.html#IfV35 InterfaceType.IfV35
IfHssi chronos/transports/osnet.html#IfHssi InterfaceType.IfHssi
IfHippi chronos/transports/osnet.html#IfHippi InterfaceType.IfHippi
IfModem chronos/transports/osnet.html#IfModem InterfaceType.IfModem
IfAal5 chronos/transports/osnet.html#IfAal5 InterfaceType.IfAal5
IfSonetPath chronos/transports/osnet.html#IfSonetPath InterfaceType.IfSonetPath
IfSonetVt chronos/transports/osnet.html#IfSonetVt InterfaceType.IfSonetVt
IfSmdsIcip chronos/transports/osnet.html#IfSmdsIcip InterfaceType.IfSmdsIcip
IfPropVirtual chronos/transports/osnet.html#IfPropVirtual InterfaceType.IfPropVirtual
IfPropMultiplexor chronos/transports/osnet.html#IfPropMultiplexor InterfaceType.IfPropMultiplexor
IfIeee80212 chronos/transports/osnet.html#IfIeee80212 InterfaceType.IfIeee80212
IfFibreChannel chronos/transports/osnet.html#IfFibreChannel InterfaceType.IfFibreChannel
IfHippiInterface chronos/transports/osnet.html#IfHippiInterface InterfaceType.IfHippiInterface
IfFrameRelayInterconnect chronos/transports/osnet.html#IfFrameRelayInterconnect InterfaceType.IfFrameRelayInterconnect
IfAflane8023 chronos/transports/osnet.html#IfAflane8023 InterfaceType.IfAflane8023
IfAflane8025 chronos/transports/osnet.html#IfAflane8025 InterfaceType.IfAflane8025
IfCctemul chronos/transports/osnet.html#IfCctemul InterfaceType.IfCctemul
IfFastEther chronos/transports/osnet.html#IfFastEther InterfaceType.IfFastEther
IfIsdn chronos/transports/osnet.html#IfIsdn InterfaceType.IfIsdn
IfV11 chronos/transports/osnet.html#IfV11 InterfaceType.IfV11
IfV36 chronos/transports/osnet.html#IfV36 InterfaceType.IfV36
IfG70364K chronos/transports/osnet.html#IfG70364K InterfaceType.IfG70364K
IfG7032MB chronos/transports/osnet.html#IfG7032MB InterfaceType.IfG7032MB
IfQllc chronos/transports/osnet.html#IfQllc InterfaceType.IfQllc
IfFastEtherFx chronos/transports/osnet.html#IfFastEtherFx InterfaceType.IfFastEtherFx
IfChannel chronos/transports/osnet.html#IfChannel InterfaceType.IfChannel
IfIeee80211 chronos/transports/osnet.html#IfIeee80211 InterfaceType.IfIeee80211
IfIbm370Parchan chronos/transports/osnet.html#IfIbm370Parchan InterfaceType.IfIbm370Parchan
IfEscon chronos/transports/osnet.html#IfEscon InterfaceType.IfEscon
IfDlsw chronos/transports/osnet.html#IfDlsw InterfaceType.IfDlsw
IfIsdnS chronos/transports/osnet.html#IfIsdnS InterfaceType.IfIsdnS
IfIsdnU chronos/transports/osnet.html#IfIsdnU InterfaceType.IfIsdnU
IfLapD chronos/transports/osnet.html#IfLapD InterfaceType.IfLapD
IfIpSwitch chronos/transports/osnet.html#IfIpSwitch InterfaceType.IfIpSwitch
IfRsrb chronos/transports/osnet.html#IfRsrb InterfaceType.IfRsrb
IfAtmLogical chronos/transports/osnet.html#IfAtmLogical InterfaceType.IfAtmLogical
IfDs0 chronos/transports/osnet.html#IfDs0 InterfaceType.IfDs0
IfDs0Bundle chronos/transports/osnet.html#IfDs0Bundle InterfaceType.IfDs0Bundle
IfBsc chronos/transports/osnet.html#IfBsc InterfaceType.IfBsc
IfAsync chronos/transports/osnet.html#IfAsync InterfaceType.IfAsync
IfCnr chronos/transports/osnet.html#IfCnr InterfaceType.IfCnr
IfIso88025rDtr chronos/transports/osnet.html#IfIso88025rDtr InterfaceType.IfIso88025rDtr
IfEplrs chronos/transports/osnet.html#IfEplrs InterfaceType.IfEplrs
IfArap chronos/transports/osnet.html#IfArap InterfaceType.IfArap
IfPropCnls chronos/transports/osnet.html#IfPropCnls InterfaceType.IfPropCnls
IfHostPad chronos/transports/osnet.html#IfHostPad InterfaceType.IfHostPad
IfTermPad chronos/transports/osnet.html#IfTermPad InterfaceType.IfTermPad
IfFrameRelayMpi chronos/transports/osnet.html#IfFrameRelayMpi InterfaceType.IfFrameRelayMpi
IfX213 chronos/transports/osnet.html#IfX213 InterfaceType.IfX213
IfAdsl chronos/transports/osnet.html#IfAdsl InterfaceType.IfAdsl
IfRadsl chronos/transports/osnet.html#IfRadsl InterfaceType.IfRadsl
IfSdsl chronos/transports/osnet.html#IfSdsl InterfaceType.IfSdsl
IfVdsl chronos/transports/osnet.html#IfVdsl InterfaceType.IfVdsl
IfIso88025Crfprint chronos/transports/osnet.html#IfIso88025Crfprint InterfaceType.IfIso88025Crfprint
IfMyrInet chronos/transports/osnet.html#IfMyrInet InterfaceType.IfMyrInet
IfVoiceEm chronos/transports/osnet.html#IfVoiceEm InterfaceType.IfVoiceEm
IfVoiceFxo chronos/transports/osnet.html#IfVoiceFxo InterfaceType.IfVoiceFxo
IfVoiceFxs chronos/transports/osnet.html#IfVoiceFxs InterfaceType.IfVoiceFxs
IfVoiceEncap chronos/transports/osnet.html#IfVoiceEncap InterfaceType.IfVoiceEncap
IfVoiceOverip chronos/transports/osnet.html#IfVoiceOverip InterfaceType.IfVoiceOverip
IfAtmDxi chronos/transports/osnet.html#IfAtmDxi InterfaceType.IfAtmDxi
IfAtmFuni chronos/transports/osnet.html#IfAtmFuni InterfaceType.IfAtmFuni
IfAtmIma chronos/transports/osnet.html#IfAtmIma InterfaceType.IfAtmIma
IfPppMultilinkBundle chronos/transports/osnet.html#IfPppMultilinkBundle InterfaceType.IfPppMultilinkBundle
IfIpoverCdlc chronos/transports/osnet.html#IfIpoverCdlc InterfaceType.IfIpoverCdlc
IfIpoverClaw chronos/transports/osnet.html#IfIpoverClaw InterfaceType.IfIpoverClaw
IfStackToStack chronos/transports/osnet.html#IfStackToStack InterfaceType.IfStackToStack
IfVirtualIpAddress chronos/transports/osnet.html#IfVirtualIpAddress InterfaceType.IfVirtualIpAddress
IfMpc chronos/transports/osnet.html#IfMpc InterfaceType.IfMpc
IfIpoverAtm chronos/transports/osnet.html#IfIpoverAtm InterfaceType.IfIpoverAtm
IfIso88025Fiber chronos/transports/osnet.html#IfIso88025Fiber InterfaceType.IfIso88025Fiber
IfTdlc chronos/transports/osnet.html#IfTdlc InterfaceType.IfTdlc
IfGigabitEthernet chronos/transports/osnet.html#IfGigabitEthernet InterfaceType.IfGigabitEthernet
IfHdlc chronos/transports/osnet.html#IfHdlc InterfaceType.IfHdlc
IfLapF chronos/transports/osnet.html#IfLapF InterfaceType.IfLapF
IfV37 chronos/transports/osnet.html#IfV37 InterfaceType.IfV37
IfX25Mlp chronos/transports/osnet.html#IfX25Mlp InterfaceType.IfX25Mlp
IfX25HuntGroup chronos/transports/osnet.html#IfX25HuntGroup InterfaceType.IfX25HuntGroup
IfTransPhdlc chronos/transports/osnet.html#IfTransPhdlc InterfaceType.IfTransPhdlc
IfInterleave chronos/transports/osnet.html#IfInterleave InterfaceType.IfInterleave
IfFast chronos/transports/osnet.html#IfFast InterfaceType.IfFast
IfIp chronos/transports/osnet.html#IfIp InterfaceType.IfIp
IfDocScableMaclayer chronos/transports/osnet.html#IfDocScableMaclayer InterfaceType.IfDocScableMaclayer
IfDocScableDownstream chronos/transports/osnet.html#IfDocScableDownstream InterfaceType.IfDocScableDownstream
IfDocScableUpstream chronos/transports/osnet.html#IfDocScableUpstream InterfaceType.IfDocScableUpstream
IfA12MppSwitch chronos/transports/osnet.html#IfA12MppSwitch InterfaceType.IfA12MppSwitch
IfTunnel chronos/transports/osnet.html#IfTunnel InterfaceType.IfTunnel
IfCoffee chronos/transports/osnet.html#IfCoffee InterfaceType.IfCoffee
IfCes chronos/transports/osnet.html#IfCes InterfaceType.IfCes
IfAtmSubInterface chronos/transports/osnet.html#IfAtmSubInterface InterfaceType.IfAtmSubInterface
IfL2Vlan chronos/transports/osnet.html#IfL2Vlan InterfaceType.IfL2Vlan
IfL3IpVlan chronos/transports/osnet.html#IfL3IpVlan InterfaceType.IfL3IpVlan
IfL3IpxVlan chronos/transports/osnet.html#IfL3IpxVlan InterfaceType.IfL3IpxVlan
IfDigitalPowerline chronos/transports/osnet.html#IfDigitalPowerline InterfaceType.IfDigitalPowerline
IfMediaMailOverIp chronos/transports/osnet.html#IfMediaMailOverIp InterfaceType.IfMediaMailOverIp
IfDtm chronos/transports/osnet.html#IfDtm InterfaceType.IfDtm
IfDcn chronos/transports/osnet.html#IfDcn InterfaceType.IfDcn
IfIpForward chronos/transports/osnet.html#IfIpForward InterfaceType.IfIpForward
IfMsdsl chronos/transports/osnet.html#IfMsdsl InterfaceType.IfMsdsl
IfIeee1394 chronos/transports/osnet.html#IfIeee1394 InterfaceType.IfIeee1394
IfIfGsn chronos/transports/osnet.html#IfIfGsn InterfaceType.IfIfGsn
IfDvbrccMaclayer chronos/transports/osnet.html#IfDvbrccMaclayer InterfaceType.IfDvbrccMaclayer
IfDvbrccDownstream chronos/transports/osnet.html#IfDvbrccDownstream InterfaceType.IfDvbrccDownstream
IfDvbrccUpstream chronos/transports/osnet.html#IfDvbrccUpstream InterfaceType.IfDvbrccUpstream
IfAtmVirtual chronos/transports/osnet.html#IfAtmVirtual InterfaceType.IfAtmVirtual
IfMplsTunnel chronos/transports/osnet.html#IfMplsTunnel InterfaceType.IfMplsTunnel
IfSrp chronos/transports/osnet.html#IfSrp InterfaceType.IfSrp
IfVoiceOverAtm chronos/transports/osnet.html#IfVoiceOverAtm InterfaceType.IfVoiceOverAtm
IfVoiceOverFrameRelay chronos/transports/osnet.html#IfVoiceOverFrameRelay InterfaceType.IfVoiceOverFrameRelay
IfIdsl chronos/transports/osnet.html#IfIdsl InterfaceType.IfIdsl
IfCompositeLink chronos/transports/osnet.html#IfCompositeLink InterfaceType.IfCompositeLink
IfSs7SigLink chronos/transports/osnet.html#IfSs7SigLink InterfaceType.IfSs7SigLink
IfPropWirelessP2p chronos/transports/osnet.html#IfPropWirelessP2p InterfaceType.IfPropWirelessP2p
IfFrForward chronos/transports/osnet.html#IfFrForward InterfaceType.IfFrForward
IfRfc1483 chronos/transports/osnet.html#IfRfc1483 InterfaceType.IfRfc1483
IfUsb chronos/transports/osnet.html#IfUsb InterfaceType.IfUsb
IfIeee8023AdLag chronos/transports/osnet.html#IfIeee8023AdLag InterfaceType.IfIeee8023AdLag
IfBgpPolicyAccounting chronos/transports/osnet.html#IfBgpPolicyAccounting InterfaceType.IfBgpPolicyAccounting
IfFrf16MfrBundle chronos/transports/osnet.html#IfFrf16MfrBundle InterfaceType.IfFrf16MfrBundle
IfH323Gatekeeper chronos/transports/osnet.html#IfH323Gatekeeper InterfaceType.IfH323Gatekeeper
IfH323Proxy chronos/transports/osnet.html#IfH323Proxy InterfaceType.IfH323Proxy
IfMpls chronos/transports/osnet.html#IfMpls InterfaceType.IfMpls
IfMfSigLink chronos/transports/osnet.html#IfMfSigLink InterfaceType.IfMfSigLink
IfHdsl2 chronos/transports/osnet.html#IfHdsl2 InterfaceType.IfHdsl2
IfShdsl chronos/transports/osnet.html#IfShdsl InterfaceType.IfShdsl
IfDs1Fdl chronos/transports/osnet.html#IfDs1Fdl InterfaceType.IfDs1Fdl
IfPos chronos/transports/osnet.html#IfPos InterfaceType.IfPos
IfDvbAsiIn chronos/transports/osnet.html#IfDvbAsiIn InterfaceType.IfDvbAsiIn
IfDvbAsiOut chronos/transports/osnet.html#IfDvbAsiOut InterfaceType.IfDvbAsiOut
IfPlc chronos/transports/osnet.html#IfPlc InterfaceType.IfPlc
IfNfas chronos/transports/osnet.html#IfNfas InterfaceType.IfNfas
IfTr008 chronos/transports/osnet.html#IfTr008 InterfaceType.IfTr008
IfGr303Rdt chronos/transports/osnet.html#IfGr303Rdt InterfaceType.IfGr303Rdt
IfGr303Idt chronos/transports/osnet.html#IfGr303Idt InterfaceType.IfGr303Idt
IfIsup chronos/transports/osnet.html#IfIsup InterfaceType.IfIsup
IfPropDocsWirelessMaclayer chronos/transports/osnet.html#IfPropDocsWirelessMaclayer InterfaceType.IfPropDocsWirelessMaclayer
IfPropDocsWirelessDownstream chronos/transports/osnet.html#IfPropDocsWirelessDownstream InterfaceType.IfPropDocsWirelessDownstream
IfPropDocsWirelessUpstream chronos/transports/osnet.html#IfPropDocsWirelessUpstream InterfaceType.IfPropDocsWirelessUpstream
IfHiperLan2 chronos/transports/osnet.html#IfHiperLan2 InterfaceType.IfHiperLan2
IfPropBwaP2mp chronos/transports/osnet.html#IfPropBwaP2mp InterfaceType.IfPropBwaP2mp
IfSonetOverheadChannel chronos/transports/osnet.html#IfSonetOverheadChannel InterfaceType.IfSonetOverheadChannel
IfDigitalWrapperOverheadChannel chronos/transports/osnet.html#IfDigitalWrapperOverheadChannel InterfaceType.IfDigitalWrapperOverheadChannel
IfAal2 chronos/transports/osnet.html#IfAal2 InterfaceType.IfAal2
IfRadioMac chronos/transports/osnet.html#IfRadioMac InterfaceType.IfRadioMac
IfAtmRadio chronos/transports/osnet.html#IfAtmRadio InterfaceType.IfAtmRadio
IfImt chronos/transports/osnet.html#IfImt InterfaceType.IfImt
IfMvl chronos/transports/osnet.html#IfMvl InterfaceType.IfMvl
IfReachDsl chronos/transports/osnet.html#IfReachDsl InterfaceType.IfReachDsl
IfFrDlciEndpt chronos/transports/osnet.html#IfFrDlciEndpt InterfaceType.IfFrDlciEndpt
IfAtmVciEndpt chronos/transports/osnet.html#IfAtmVciEndpt InterfaceType.IfAtmVciEndpt
IfOpticalChannel chronos/transports/osnet.html#IfOpticalChannel InterfaceType.IfOpticalChannel
IfOpticalTransport chronos/transports/osnet.html#IfOpticalTransport InterfaceType.IfOpticalTransport
IfIeee80216Wman chronos/transports/osnet.html#IfIeee80216Wman InterfaceType.IfIeee80216Wman
IfWwanPp chronos/transports/osnet.html#IfWwanPp InterfaceType.IfWwanPp
IfWwanPp2 chronos/transports/osnet.html#IfWwanPp2 InterfaceType.IfWwanPp2
IfIeee802154 chronos/transports/osnet.html#IfIeee802154 InterfaceType.IfIeee802154
IfXboxWireless chronos/transports/osnet.html#IfXboxWireless InterfaceType.IfXboxWireless
InterfaceType chronos/transports/osnet.html#InterfaceType osnet: InterfaceType
StatusError chronos/transports/osnet.html#StatusError InterfaceState.StatusError
StatusUp chronos/transports/osnet.html#StatusUp InterfaceState.StatusUp
StatusDown chronos/transports/osnet.html#StatusDown InterfaceState.StatusDown
StatusTesting chronos/transports/osnet.html#StatusTesting InterfaceState.StatusTesting
StatusUnknown chronos/transports/osnet.html#StatusUnknown InterfaceState.StatusUnknown
StatusDormant chronos/transports/osnet.html#StatusDormant InterfaceState.StatusDormant
StatusNotPresent chronos/transports/osnet.html#StatusNotPresent InterfaceState.StatusNotPresent
StatusLowerLayerDown chronos/transports/osnet.html#StatusLowerLayerDown InterfaceState.StatusLowerLayerDown
InterfaceState chronos/transports/osnet.html#InterfaceState osnet: InterfaceState
InterfaceAddress chronos/transports/osnet.html#InterfaceAddress osnet: InterfaceAddress
NetworkInterface chronos/transports/osnet.html#NetworkInterface osnet: NetworkInterface
Route chronos/transports/osnet.html#Route osnet: Route
broadcast chronos/transports/osnet.html#broadcast,InterfaceAddress osnet: broadcast(ifa: InterfaceAddress): TransportAddress
network chronos/transports/osnet.html#network,InterfaceAddress osnet: network(ifa: InterfaceAddress): TransportAddress
netmask chronos/transports/osnet.html#netmask,InterfaceAddress osnet: netmask(ifa: InterfaceAddress): TransportAddress
init chronos/transports/osnet.html#init,typedesc[InterfaceAddress],TransportAddress,int osnet: init(ift: typedesc[InterfaceAddress]; address: TransportAddress; prefix: int): InterfaceAddress
`$` chronos/transports/osnet.html#$,InterfaceAddress osnet: `$`(ifa: InterfaceAddress): string
`$` chronos/transports/osnet.html#$,NetworkInterface osnet: `$`(iface: NetworkInterface): string
`$` chronos/transports/osnet.html#$,Route osnet: `$`(route: Route): string
cmp chronos/transports/osnet.html#cmp,NetworkInterface,NetworkInterface osnet: cmp(a, b: NetworkInterface): int
RTA_ALIGN chronos/transports/osnet.html#RTA_ALIGN.t,uint osnet: RTA_ALIGN(length: uint): uint
RTA_PAYLOAD chronos/transports/osnet.html#RTA_PAYLOAD.t,uint osnet: RTA_PAYLOAD(length: uint): uint
getInterfaces chronos/transports/osnet.html#getInterfaces osnet: getInterfaces(): seq[NetworkInterface]
getBestRoute chronos/transports/osnet.html#getBestRoute,TransportAddress osnet: getBestRoute(address: TransportAddress): Route

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,70 @@
TransportKind chronos/transports/stream.html#TransportKind stream: TransportKind
None chronos/transports/stream.html#None TransportFlags.None
WinServerPipe chronos/transports/stream.html#WinServerPipe TransportFlags.WinServerPipe
WinNoPipeFlash chronos/transports/stream.html#WinNoPipeFlash TransportFlags.WinNoPipeFlash
TcpNoDelay chronos/transports/stream.html#TcpNoDelay TransportFlags.TcpNoDelay
V4Mapped chronos/transports/stream.html#V4Mapped TransportFlags.V4Mapped
TransportFlags chronos/transports/stream.html#TransportFlags stream: TransportFlags
SocketFlags chronos/transports/stream.html#SocketFlags stream: SocketFlags
ReadMessagePredicate chronos/transports/stream.html#ReadMessagePredicate stream: ReadMessagePredicate
StreamTransportTrackerName chronos/transports/stream.html#StreamTransportTrackerName stream: StreamTransportTrackerName
StreamServerTrackerName chronos/transports/stream.html#StreamServerTrackerName stream: StreamServerTrackerName
DefaultBacklogSize chronos/transports/stream.html#DefaultBacklogSize stream: DefaultBacklogSize
StreamTransport chronos/transports/stream.html#StreamTransport stream: StreamTransport
StreamCallback2 chronos/transports/stream.html#StreamCallback2 stream: StreamCallback2
StreamCallback chronos/transports/stream.html#StreamCallback stream: StreamCallback
TransportInitCallback chronos/transports/stream.html#TransportInitCallback stream: TransportInitCallback
StreamServer chronos/transports/stream.html#StreamServer stream: StreamServer
remoteAddress2 chronos/transports/stream.html#remoteAddress2,StreamTransport stream: remoteAddress2(transp: StreamTransport): Result[TransportAddress, OSErrorCode]
localAddress2 chronos/transports/stream.html#localAddress2,StreamTransport stream: localAddress2(transp: StreamTransport): Result[TransportAddress, OSErrorCode]
toException chronos/transports/stream.html#toException,OSErrorCode stream: toException(v: OSErrorCode): ref TransportOsError
remoteAddress chronos/transports/stream.html#remoteAddress,StreamTransport stream: remoteAddress(transp: StreamTransport): TransportAddress
localAddress chronos/transports/stream.html#localAddress,StreamTransport stream: localAddress(transp: StreamTransport): TransportAddress
localAddress chronos/transports/stream.html#localAddress,StreamServer stream: localAddress(server: StreamServer): TransportAddress
toUnchecked chronos/transports/stream.html#toUnchecked.t,untyped stream: toUnchecked(a: untyped): untyped
connect chronos/transports/stream.html#connect,TransportAddress,StreamTransport,set[SocketFlags] stream: connect(address: TransportAddress; bufferSize = DefaultStreamBufferSize;\n child: StreamTransport = nil; localAddress = TransportAddress();\n flags: set[SocketFlags] = {}; dualstack = DualStackType.Auto): InternalRaisesFuture[\n StreamTransport, (TransportError, CancelledError)]
accept chronos/transports/stream.html#accept,StreamServer stream: accept(server: StreamServer): InternalRaisesFuture[StreamTransport, (\n TransportUseClosedError, TransportTooManyError, TransportAbortedError,\n TransportOsError, CancelledError)]
start2 chronos/transports/stream.html#start2,StreamServer stream: start2(server: StreamServer): Result[void, OSErrorCode]
stop2 chronos/transports/stream.html#stop2,StreamServer stream: stop2(server: StreamServer): Result[void, OSErrorCode]
start chronos/transports/stream.html#start,StreamServer stream: start(server: StreamServer)
stop chronos/transports/stream.html#stop,StreamServer stream: stop(server: StreamServer)
join chronos/transports/stream.html#join,StreamServer stream: join(server: StreamServer): InternalRaisesFuture[void, (CancelledError,)]
connect chronos/transports/stream.html#connect,TransportAddress,StreamTransport,set[TransportFlags] stream: connect(address: TransportAddress; bufferSize = DefaultStreamBufferSize;\n child: StreamTransport = nil; flags: set[TransportFlags];\n localAddress = TransportAddress(); dualstack = DualStackType.Auto): InternalRaisesFuture[\n StreamTransport, (TransportError, CancelledError)]
closed chronos/transports/stream.html#closed,StreamServer stream: closed(server: StreamServer): bool
close chronos/transports/stream.html#close,StreamServer stream: close(server: StreamServer)
closeWait chronos/transports/stream.html#closeWait,StreamServer stream: closeWait(server: StreamServer): InternalRaisesFuture[void, void]
createStreamServer chronos/transports/stream.html#createStreamServer,TransportAddress,StreamCallback2,set[ServerFlags],AsyncFD,int,int,StreamServer,TransportInitCallback,pointer stream: createStreamServer(host: TransportAddress; cbproc: StreamCallback2;\n flags: set[ServerFlags] = {};\n sock: AsyncFD = asyncInvalidSocket;\n backlog: int = DefaultBacklogSize;\n bufferSize: int = DefaultStreamBufferSize;\n child: StreamServer = nil; init: TransportInitCallback = nil;\n udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer
createStreamServer chronos/transports/stream.html#createStreamServer,TransportAddress,StreamCallback,set[ServerFlags],AsyncFD,int,int,StreamServer,TransportInitCallback,pointer stream: createStreamServer(host: TransportAddress; cbproc: StreamCallback;\n flags: set[ServerFlags] = {};\n sock: AsyncFD = asyncInvalidSocket;\n backlog: int = DefaultBacklogSize;\n bufferSize: int = DefaultStreamBufferSize;\n child: StreamServer = nil; init: TransportInitCallback = nil;\n udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer
createStreamServer chronos/transports/stream.html#createStreamServer,TransportAddress,set[ServerFlags],AsyncFD,int,int,StreamServer,TransportInitCallback,pointer stream: createStreamServer(host: TransportAddress; flags: set[ServerFlags] = {};\n sock: AsyncFD = asyncInvalidSocket;\n backlog: int = DefaultBacklogSize;\n bufferSize: int = DefaultStreamBufferSize;\n child: StreamServer = nil; init: TransportInitCallback = nil;\n udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer
createStreamServer chronos/transports/stream.html#createStreamServer,Port,Opt[IpAddress],set[ServerFlags],AsyncFD,int,int,StreamServer,TransportInitCallback,pointer stream: createStreamServer(port: Port; host: Opt[IpAddress] = Opt.none(IpAddress);\n flags: set[ServerFlags] = {};\n sock: AsyncFD = asyncInvalidSocket;\n backlog: int = DefaultBacklogSize;\n bufferSize: int = DefaultStreamBufferSize;\n child: StreamServer = nil; init: TransportInitCallback = nil;\n udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer
createStreamServer chronos/transports/stream.html#createStreamServer,StreamCallback2,Port,Opt[IpAddress],set[ServerFlags],AsyncFD,int,int,StreamServer,TransportInitCallback,pointer stream: createStreamServer(cbproc: StreamCallback2; port: Port;\n host: Opt[IpAddress] = Opt.none(IpAddress);\n flags: set[ServerFlags] = {};\n sock: AsyncFD = asyncInvalidSocket;\n backlog: int = DefaultBacklogSize;\n bufferSize: int = DefaultStreamBufferSize;\n child: StreamServer = nil; init: TransportInitCallback = nil;\n udata: pointer = nil; dualstack = DualStackType.Auto): StreamServer
createStreamServer chronos/transports/stream.html#createStreamServer,TransportAddress,StreamCallback2,set[ServerFlags],ref.T,AsyncFD,int,int,StreamServer,TransportInitCallback stream: createStreamServer[T](host: TransportAddress; cbproc: StreamCallback2;\n flags: set[ServerFlags] = {}; udata: ref T;\n sock: AsyncFD = asyncInvalidSocket;\n backlog: int = DefaultBacklogSize;\n bufferSize: int = DefaultStreamBufferSize;\n child: StreamServer = nil;\n init: TransportInitCallback = nil;\n dualstack = DualStackType.Auto): StreamServer
createStreamServer chronos/transports/stream.html#createStreamServer,TransportAddress,StreamCallback,set[ServerFlags],ref.T,AsyncFD,int,int,StreamServer,TransportInitCallback stream: createStreamServer[T](host: TransportAddress; cbproc: StreamCallback;\n flags: set[ServerFlags] = {}; udata: ref T;\n sock: AsyncFD = asyncInvalidSocket;\n backlog: int = DefaultBacklogSize;\n bufferSize: int = DefaultStreamBufferSize;\n child: StreamServer = nil;\n init: TransportInitCallback = nil;\n dualstack = DualStackType.Auto): StreamServer
createStreamServer chronos/transports/stream.html#createStreamServer,TransportAddress,set[ServerFlags],ref.T,AsyncFD,int,int,StreamServer,TransportInitCallback stream: createStreamServer[T](host: TransportAddress; flags: set[ServerFlags] = {};\n udata: ref T; sock: AsyncFD = asyncInvalidSocket;\n backlog: int = DefaultBacklogSize;\n bufferSize: int = DefaultStreamBufferSize;\n child: StreamServer = nil;\n init: TransportInitCallback = nil;\n dualstack = DualStackType.Auto): StreamServer
createStreamServer chronos/transports/stream.html#createStreamServer,StreamCallback2,Port,Opt[IpAddress],set[ServerFlags],ref.T,AsyncFD,int,int,StreamServer,TransportInitCallback stream: createStreamServer[T](cbproc: StreamCallback2; port: Port;\n host: Opt[IpAddress] = Opt.none(IpAddress);\n flags: set[ServerFlags] = {}; udata: ref T;\n sock: AsyncFD = asyncInvalidSocket;\n backlog: int = DefaultBacklogSize;\n bufferSize: int = DefaultStreamBufferSize;\n child: StreamServer = nil;\n init: TransportInitCallback = nil;\n dualstack = DualStackType.Auto): StreamServer
createStreamServer chronos/transports/stream.html#createStreamServer,Port,Opt[IpAddress],set[ServerFlags],ref.T,AsyncFD,int,int,StreamServer,TransportInitCallback stream: createStreamServer[T](port: Port; host: Opt[IpAddress] = Opt.none(IpAddress);\n flags: set[ServerFlags] = {}; udata: ref T;\n sock: AsyncFD = asyncInvalidSocket;\n backlog: int = DefaultBacklogSize;\n bufferSize: int = DefaultStreamBufferSize;\n child: StreamServer = nil;\n init: TransportInitCallback = nil;\n dualstack = DualStackType.Auto): StreamServer
getUserData chronos/transports/stream.html#getUserData,StreamServer stream: getUserData[T](server: StreamServer): T
write chronos/transports/stream.html#write,StreamTransport,pointer,int stream: write(transp: StreamTransport; pbytes: pointer; nbytes: int): InternalRaisesFuture[\n int, (TransportError, CancelledError)]
write chronos/transports/stream.html#write,StreamTransport,string,int stream: write(transp: StreamTransport; msg: string; msglen = -1): InternalRaisesFuture[\n int, (TransportError, CancelledError)]
write chronos/transports/stream.html#write,StreamTransport,seq[T],int stream: write[T](transp: StreamTransport; msg: seq[T]; msglen = -1): InternalRaisesFuture[\n int, (TransportError, CancelledError)]
writeFile chronos/transports/stream.html#writeFile,StreamTransport,int,uint,int stream: writeFile(transp: StreamTransport; handle: int; offset: uint = 0; size: int = 0): InternalRaisesFuture[\n int, (TransportError, CancelledError)]
atEof chronos/transports/stream.html#atEof,StreamTransport stream: atEof(transp: StreamTransport): bool
readExactly chronos/transports/stream.html#readExactly,StreamTransport,pointer,int stream: readExactly(transp: StreamTransport; pbytes: pointer; nbytes: int): InternalRaisesFuture[\n void, (TransportError, CancelledError)]
readOnce chronos/transports/stream.html#readOnce,StreamTransport,pointer,int stream: readOnce(transp: StreamTransport; pbytes: pointer; nbytes: int): InternalRaisesFuture[\n int, (TransportError, CancelledError)]
readUntil chronos/transports/stream.html#readUntil,StreamTransport,pointer,int,seq[byte] stream: readUntil(transp: StreamTransport; pbytes: pointer; nbytes: int; sep: seq[byte]): InternalRaisesFuture[\n int, (TransportError, CancelledError)]
readLine chronos/transports/stream.html#readLine,StreamTransport,int,string stream: readLine(transp: StreamTransport; limit = 0; sep = &quot;\r\n&quot;): InternalRaisesFuture[\n string, (TransportError, CancelledError)]
read chronos/transports/stream.html#read,StreamTransport stream: read(transp: StreamTransport): InternalRaisesFuture[seq[byte],\n (TransportError, CancelledError)]
read chronos/transports/stream.html#read,StreamTransport,int stream: read(transp: StreamTransport; n: int): InternalRaisesFuture[seq[byte],\n (TransportError, CancelledError)]
consume chronos/transports/stream.html#consume,StreamTransport stream: consume(transp: StreamTransport): InternalRaisesFuture[int,\n (TransportError, CancelledError)]
consume chronos/transports/stream.html#consume,StreamTransport,int stream: consume(transp: StreamTransport; n: int): InternalRaisesFuture[int,\n (TransportError, CancelledError)]
readMessage chronos/transports/stream.html#readMessage,StreamTransport,ReadMessagePredicate stream: readMessage(transp: StreamTransport; predicate: ReadMessagePredicate): InternalRaisesFuture[\n void, (TransportError, CancelledError)]
join chronos/transports/stream.html#join,StreamTransport stream: join(transp: StreamTransport): InternalRaisesFuture[void, (CancelledError,)]
closed chronos/transports/stream.html#closed,StreamTransport stream: closed(transp: StreamTransport): bool
finished chronos/transports/stream.html#finished,StreamTransport stream: finished(transp: StreamTransport): bool
failed chronos/transports/stream.html#failed,StreamTransport stream: failed(transp: StreamTransport): bool
running chronos/transports/stream.html#running,StreamTransport stream: running(transp: StreamTransport): bool
close chronos/transports/stream.html#close,StreamTransport stream: close(transp: StreamTransport)
closeWait chronos/transports/stream.html#closeWait,StreamTransport stream: closeWait(transp: StreamTransport): InternalRaisesFuture[void, void]
shutdownWait chronos/transports/stream.html#shutdownWait,StreamTransport stream: shutdownWait(transp: StreamTransport): InternalRaisesFuture[void,\n (TransportError, CancelledError)]
fromPipe2 chronos/transports/stream.html#fromPipe2,AsyncFD,StreamTransport stream: fromPipe2(fd: AsyncFD; child: StreamTransport = nil;\n bufferSize = DefaultStreamBufferSize): Result[StreamTransport,\n OSErrorCode]
fromPipe chronos/transports/stream.html#fromPipe,AsyncFD,StreamTransport stream: fromPipe(fd: AsyncFD; child: StreamTransport = nil;\n bufferSize = DefaultStreamBufferSize): StreamTransport

2036
api/dochack.js Normal file

File diff suppressed because it is too large Load Diff

1016
api/nimdoc.out.css Normal file

File diff suppressed because one or more lines are too long

5238
api/theindex.html Normal file

File diff suppressed because it is too large Load Diff

326
async_procs.html Normal file
View File

@ -0,0 +1,326 @@
<!DOCTYPE HTML>
<html lang="en" class="light" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>async functions - Chronos</title>
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="open-in.css">
</head>
<body class="sidebar-visible no-js">
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('light')
html.classList.add(theme);
var body = document.querySelector('body');
body.classList.remove('no-js')
body.classList.add('js');
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var body = document.querySelector('body');
var sidebar = null;
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
body.classList.remove('sidebar-visible');
body.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="examples.html"><strong aria-hidden="true">2.</strong> Examples</a></li><li class="chapter-item expanded affix "><li class="part-title">User guide</li><li class="chapter-item expanded "><a href="concepts.html"><strong aria-hidden="true">3.</strong> Core concepts</a></li><li class="chapter-item expanded "><a href="async_procs.html" class="active"><strong aria-hidden="true">4.</strong> async functions</a></li><li class="chapter-item expanded "><a href="error_handling.html"><strong aria-hidden="true">5.</strong> Errors and exceptions</a></li><li class="chapter-item expanded "><a href="threads.html"><strong aria-hidden="true">6.</strong> Threads</a></li><li class="chapter-item expanded "><a href="tips.html"><strong aria-hidden="true">7.</strong> Tips, tricks and best practices</a></li><li class="chapter-item expanded "><a href="porting.html"><strong aria-hidden="true">8.</strong> Porting code to chronos</a></li><li class="chapter-item expanded "><a href="http_server_middleware.html"><strong aria-hidden="true">9.</strong> HTTP server middleware</a></li><li class="chapter-item expanded affix "><li class="part-title">Developer guide</li><li class="chapter-item expanded "><a href="book.html"><strong aria-hidden="true">10.</strong> Updating this book</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<!-- Track and set sidebar scroll position -->
<script>
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
sidebarScrollbox.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
sidebarScrollbox.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
</script>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Chronos</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/status-im/nim-chronos/" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h1 id="async-procedures"><a class="header" href="#async-procedures">Async procedures</a></h1>
<p>Async procedures are those that interact with <code>chronos</code> to cooperatively
suspend and resume their execution depending on the completion of other
async procedures, timers, tasks on other threads or asynchronous I/O scheduled
with the operating system.</p>
<p>Async procedures are marked with the <code>{.async.}</code> pragma and return a <code>Future</code>
indicating the state of the operation.</p>
<ul>
<li><a href="#the-async-pragma">The <code>async</code> pragma</a></li>
<li><a href="#await-keyword"><code>await</code> keyword</a></li>
<li><a href="#raw-async-procedures">Raw async procedures</a></li>
<li><a href="#callbacks-and-closures">Callbacks and closures</a></li>
</ul>
<h2 id="the-async-pragma"><a class="header" href="#the-async-pragma">The <code>async</code> pragma</a></h2>
<p>The <code>{.async.}</code> pragma will transform a procedure (or a method) returning a
<code>Future</code> into a closure iterator. If there is no return type specified,
<code>Future[void]</code> is returned.</p>
<pre><code class="language-nim">proc p() {.async.} =
await sleepAsync(100.milliseconds)
echo p().type # prints &quot;Future[system.void]&quot;
</code></pre>
<h2 id="await-keyword"><a class="header" href="#await-keyword"><code>await</code> keyword</a></h2>
<p>The <code>await</code> keyword operates on <code>Future</code> instances typically returned from an
<code>async</code> procedure.</p>
<p>Whenever <code>await</code> is encountered inside an async procedure, control is given
back to the dispatcher for as many steps as it's necessary for the awaited
future to complete, fail or be cancelled. <code>await</code> calls the
equivalent of <code>Future.read()</code> on the completed future to return the
encapsulated value when the operation finishes.</p>
<pre><code class="language-nim">proc p1() {.async.} =
await sleepAsync(1.seconds)
proc p2() {.async.} =
await sleepAsync(1.seconds)
proc p3() {.async.} =
let
fut1 = p1()
fut2 = p2()
# Just by executing the async procs, both resulting futures entered the
# dispatcher queue and their &quot;clocks&quot; started ticking.
await fut1
await fut2
# Only one second passed while awaiting them both, not two.
waitFor p3()
</code></pre>
<pre><code class="language-admonition warning">Because `async` procedures are executed concurrently, they are subject to many
of the same risks that typically accompany multithreaded programming.
In particular, if two `async` procedures have access to the same mutable state,
the value before and after `await` might not be the same as the order of execution is not guaranteed!
</code></pre>
<h2 id="raw-async-procedures"><a class="header" href="#raw-async-procedures">Raw async procedures</a></h2>
<p>Raw async procedures are those that interact with <code>chronos</code> via the <code>Future</code>
type but whose body does not go through the async transformation.</p>
<p>Such functions are created by adding <code>raw: true</code> to the <code>async</code> parameters:</p>
<pre><code class="language-nim">proc rawAsync(): Future[void] {.async: (raw: true).} =
let fut = newFuture[void](&quot;rawAsync&quot;)
fut.complete()
fut
</code></pre>
<p>Raw functions must not raise exceptions directly - they are implicitly declared
as <code>raises: []</code> - instead they should store exceptions in the returned <code>Future</code>:</p>
<pre><code class="language-nim">proc rawFailure(): Future[void] {.async: (raw: true).} =
let fut = newFuture[void](&quot;rawAsync&quot;)
fut.fail((ref ValueError)(msg: &quot;Oh no!&quot;))
fut
</code></pre>
<p>Raw procedures can also use checked exceptions:</p>
<pre><code class="language-nim">proc rawAsyncRaises(): Future[void] {.async: (raw: true, raises: [IOError]).} =
let fut = newFuture[void]()
assert not (compiles do: fut.fail((ref ValueError)(msg: &quot;uh-uh&quot;)))
fut.fail((ref IOError)(msg: &quot;IO&quot;))
fut
</code></pre>
<h2 id="callbacks-and-closures"><a class="header" href="#callbacks-and-closures">Callbacks and closures</a></h2>
<p>Callback/closure types are declared using the <code>async</code> annotation as usual:</p>
<pre><code class="language-nim">type MyCallback = proc(): Future[void] {.async.}
proc runCallback(cb: MyCallback) {.async: (raises: []).} =
try:
await cb()
except CatchableError:
discard # handle errors as usual
</code></pre>
<p>When calling a callback, it is important to remember that it may raise exceptions that need to be handled.</p>
<p>Checked exceptions can be used to limit the exceptions that a callback can
raise:</p>
<pre><code class="language-nim">type MyEasyCallback = proc(): Future[void] {.async: (raises: []).}
proc runCallback(cb: MyEasyCallback) {.async: (raises: [])} =
await cb()
</code></pre>
<footer id="open-on-gh">Found a bug? <a href="https://github.com/status-im/nim-chronos//edit/master/docs/src/async_procs.md">Edit this page on GitHub.</a></footer>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="concepts.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="error_handling.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="concepts.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="error_handling.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script>
window.playground_copyable = true;
</script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>

78
ayu-highlight.css Normal file
View File

@ -0,0 +1,78 @@
/*
Based off of the Ayu theme
Original by Dempfi (https://github.com/dempfi/ayu)
*/
.hljs {
display: block;
overflow-x: auto;
background: #191f26;
color: #e6e1cf;
}
.hljs-comment,
.hljs-quote {
color: #5c6773;
font-style: italic;
}
.hljs-variable,
.hljs-template-variable,
.hljs-attribute,
.hljs-attr,
.hljs-regexp,
.hljs-link,
.hljs-selector-id,
.hljs-selector-class {
color: #ff7733;
}
.hljs-number,
.hljs-meta,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-params {
color: #ffee99;
}
.hljs-string,
.hljs-bullet {
color: #b8cc52;
}
.hljs-title,
.hljs-built_in,
.hljs-section {
color: #ffb454;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-symbol {
color: #ff7733;
}
.hljs-name {
color: #36a3d9;
}
.hljs-tag {
color: #00568d;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
.hljs-addition {
color: #91b362;
}
.hljs-deletion {
color: #d96c75;
}

226
book.html Normal file
View File

@ -0,0 +1,226 @@
<!DOCTYPE HTML>
<html lang="en" class="light" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>Updating this book - Chronos</title>
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="open-in.css">
</head>
<body class="sidebar-visible no-js">
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('light')
html.classList.add(theme);
var body = document.querySelector('body');
body.classList.remove('no-js')
body.classList.add('js');
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var body = document.querySelector('body');
var sidebar = null;
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
body.classList.remove('sidebar-visible');
body.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="examples.html"><strong aria-hidden="true">2.</strong> Examples</a></li><li class="chapter-item expanded affix "><li class="part-title">User guide</li><li class="chapter-item expanded "><a href="concepts.html"><strong aria-hidden="true">3.</strong> Core concepts</a></li><li class="chapter-item expanded "><a href="async_procs.html"><strong aria-hidden="true">4.</strong> async functions</a></li><li class="chapter-item expanded "><a href="error_handling.html"><strong aria-hidden="true">5.</strong> Errors and exceptions</a></li><li class="chapter-item expanded "><a href="threads.html"><strong aria-hidden="true">6.</strong> Threads</a></li><li class="chapter-item expanded "><a href="tips.html"><strong aria-hidden="true">7.</strong> Tips, tricks and best practices</a></li><li class="chapter-item expanded "><a href="porting.html"><strong aria-hidden="true">8.</strong> Porting code to chronos</a></li><li class="chapter-item expanded "><a href="http_server_middleware.html"><strong aria-hidden="true">9.</strong> HTTP server middleware</a></li><li class="chapter-item expanded affix "><li class="part-title">Developer guide</li><li class="chapter-item expanded "><a href="book.html" class="active"><strong aria-hidden="true">10.</strong> Updating this book</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<!-- Track and set sidebar scroll position -->
<script>
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
sidebarScrollbox.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
sidebarScrollbox.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
</script>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Chronos</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/status-im/nim-chronos/" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h1 id="updating-this-book"><a class="header" href="#updating-this-book">Updating this book</a></h1>
<footer id="open-on-gh">Found a bug? <a href="https://github.com/status-im/nim-chronos//edit/master/docs/src/book.md">Edit this page on GitHub.</a></footer>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="http_server_middleware.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="http_server_middleware.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
</nav>
</div>
<script>
window.playground_copyable = true;
</script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>

697
book.js Normal file
View File

@ -0,0 +1,697 @@
"use strict";
// Fix back button cache problem
window.onunload = function () { };
// Global variable, shared between modules
function playground_text(playground, hidden = true) {
let code_block = playground.querySelector("code");
if (window.ace && code_block.classList.contains("editable")) {
let editor = window.ace.edit(code_block);
return editor.getValue();
} else if (hidden) {
return code_block.textContent;
} else {
return code_block.innerText;
}
}
(function codeSnippets() {
function fetch_with_timeout(url, options, timeout = 6000) {
return Promise.race([
fetch(url, options),
new Promise((_, reject) => setTimeout(() => reject(new Error('timeout')), timeout))
]);
}
var playgrounds = Array.from(document.querySelectorAll(".playground"));
if (playgrounds.length > 0) {
fetch_with_timeout("https://play.rust-lang.org/meta/crates", {
headers: {
'Content-Type': "application/json",
},
method: 'POST',
mode: 'cors',
})
.then(response => response.json())
.then(response => {
// get list of crates available in the rust playground
let playground_crates = response.crates.map(item => item["id"]);
playgrounds.forEach(block => handle_crate_list_update(block, playground_crates));
});
}
function handle_crate_list_update(playground_block, playground_crates) {
// update the play buttons after receiving the response
update_play_button(playground_block, playground_crates);
// and install on change listener to dynamically update ACE editors
if (window.ace) {
let code_block = playground_block.querySelector("code");
if (code_block.classList.contains("editable")) {
let editor = window.ace.edit(code_block);
editor.addEventListener("change", function (e) {
update_play_button(playground_block, playground_crates);
});
// add Ctrl-Enter command to execute rust code
editor.commands.addCommand({
name: "run",
bindKey: {
win: "Ctrl-Enter",
mac: "Ctrl-Enter"
},
exec: _editor => run_rust_code(playground_block)
});
}
}
}
// updates the visibility of play button based on `no_run` class and
// used crates vs ones available on https://play.rust-lang.org
function update_play_button(pre_block, playground_crates) {
var play_button = pre_block.querySelector(".play-button");
// skip if code is `no_run`
if (pre_block.querySelector('code').classList.contains("no_run")) {
play_button.classList.add("hidden");
return;
}
// get list of `extern crate`'s from snippet
var txt = playground_text(pre_block);
var re = /extern\s+crate\s+([a-zA-Z_0-9]+)\s*;/g;
var snippet_crates = [];
var item;
while (item = re.exec(txt)) {
snippet_crates.push(item[1]);
}
// check if all used crates are available on play.rust-lang.org
var all_available = snippet_crates.every(function (elem) {
return playground_crates.indexOf(elem) > -1;
});
if (all_available) {
play_button.classList.remove("hidden");
} else {
play_button.classList.add("hidden");
}
}
function run_rust_code(code_block) {
var result_block = code_block.querySelector(".result");
if (!result_block) {
result_block = document.createElement('code');
result_block.className = 'result hljs language-bash';
code_block.append(result_block);
}
let text = playground_text(code_block);
let classes = code_block.querySelector('code').classList;
let edition = "2015";
if(classes.contains("edition2018")) {
edition = "2018";
} else if(classes.contains("edition2021")) {
edition = "2021";
}
var params = {
version: "stable",
optimize: "0",
code: text,
edition: edition
};
if (text.indexOf("#![feature") !== -1) {
params.version = "nightly";
}
result_block.innerText = "Running...";
fetch_with_timeout("https://play.rust-lang.org/evaluate.json", {
headers: {
'Content-Type': "application/json",
},
method: 'POST',
mode: 'cors',
body: JSON.stringify(params)
})
.then(response => response.json())
.then(response => {
if (response.result.trim() === '') {
result_block.innerText = "No output";
result_block.classList.add("result-no-output");
} else {
result_block.innerText = response.result;
result_block.classList.remove("result-no-output");
}
})
.catch(error => result_block.innerText = "Playground Communication: " + error.message);
}
// Syntax highlighting Configuration
hljs.configure({
tabReplace: ' ', // 4 spaces
languages: [], // Languages used for auto-detection
});
let code_nodes = Array
.from(document.querySelectorAll('code'))
// Don't highlight `inline code` blocks in headers.
.filter(function (node) {return !node.parentElement.classList.contains("header"); });
if (window.ace) {
// language-rust class needs to be removed for editable
// blocks or highlightjs will capture events
code_nodes
.filter(function (node) {return node.classList.contains("editable"); })
.forEach(function (block) { block.classList.remove('language-rust'); });
code_nodes
.filter(function (node) {return !node.classList.contains("editable"); })
.forEach(function (block) { hljs.highlightBlock(block); });
} else {
code_nodes.forEach(function (block) { hljs.highlightBlock(block); });
}
// Adding the hljs class gives code blocks the color css
// even if highlighting doesn't apply
code_nodes.forEach(function (block) { block.classList.add('hljs'); });
Array.from(document.querySelectorAll("code.hljs")).forEach(function (block) {
var lines = Array.from(block.querySelectorAll('.boring'));
// If no lines were hidden, return
if (!lines.length) { return; }
block.classList.add("hide-boring");
var buttons = document.createElement('div');
buttons.className = 'buttons';
buttons.innerHTML = "<button class=\"fa fa-eye\" title=\"Show hidden lines\" aria-label=\"Show hidden lines\"></button>";
// add expand button
var pre_block = block.parentNode;
pre_block.insertBefore(buttons, pre_block.firstChild);
pre_block.querySelector('.buttons').addEventListener('click', function (e) {
if (e.target.classList.contains('fa-eye')) {
e.target.classList.remove('fa-eye');
e.target.classList.add('fa-eye-slash');
e.target.title = 'Hide lines';
e.target.setAttribute('aria-label', e.target.title);
block.classList.remove('hide-boring');
} else if (e.target.classList.contains('fa-eye-slash')) {
e.target.classList.remove('fa-eye-slash');
e.target.classList.add('fa-eye');
e.target.title = 'Show hidden lines';
e.target.setAttribute('aria-label', e.target.title);
block.classList.add('hide-boring');
}
});
});
if (window.playground_copyable) {
Array.from(document.querySelectorAll('pre code')).forEach(function (block) {
var pre_block = block.parentNode;
if (!pre_block.classList.contains('playground')) {
var buttons = pre_block.querySelector(".buttons");
if (!buttons) {
buttons = document.createElement('div');
buttons.className = 'buttons';
pre_block.insertBefore(buttons, pre_block.firstChild);
}
var clipButton = document.createElement('button');
clipButton.className = 'fa fa-copy clip-button';
clipButton.title = 'Copy to clipboard';
clipButton.setAttribute('aria-label', clipButton.title);
clipButton.innerHTML = '<i class=\"tooltiptext\"></i>';
buttons.insertBefore(clipButton, buttons.firstChild);
}
});
}
// Process playground code blocks
Array.from(document.querySelectorAll(".playground")).forEach(function (pre_block) {
// Add play button
var buttons = pre_block.querySelector(".buttons");
if (!buttons) {
buttons = document.createElement('div');
buttons.className = 'buttons';
pre_block.insertBefore(buttons, pre_block.firstChild);
}
var runCodeButton = document.createElement('button');
runCodeButton.className = 'fa fa-play play-button';
runCodeButton.hidden = true;
runCodeButton.title = 'Run this code';
runCodeButton.setAttribute('aria-label', runCodeButton.title);
buttons.insertBefore(runCodeButton, buttons.firstChild);
runCodeButton.addEventListener('click', function (e) {
run_rust_code(pre_block);
});
if (window.playground_copyable) {
var copyCodeClipboardButton = document.createElement('button');
copyCodeClipboardButton.className = 'fa fa-copy clip-button';
copyCodeClipboardButton.innerHTML = '<i class="tooltiptext"></i>';
copyCodeClipboardButton.title = 'Copy to clipboard';
copyCodeClipboardButton.setAttribute('aria-label', copyCodeClipboardButton.title);
buttons.insertBefore(copyCodeClipboardButton, buttons.firstChild);
}
let code_block = pre_block.querySelector("code");
if (window.ace && code_block.classList.contains("editable")) {
var undoChangesButton = document.createElement('button');
undoChangesButton.className = 'fa fa-history reset-button';
undoChangesButton.title = 'Undo changes';
undoChangesButton.setAttribute('aria-label', undoChangesButton.title);
buttons.insertBefore(undoChangesButton, buttons.firstChild);
undoChangesButton.addEventListener('click', function () {
let editor = window.ace.edit(code_block);
editor.setValue(editor.originalCode);
editor.clearSelection();
});
}
});
})();
(function themes() {
var html = document.querySelector('html');
var themeToggleButton = document.getElementById('theme-toggle');
var themePopup = document.getElementById('theme-list');
var themeColorMetaTag = document.querySelector('meta[name="theme-color"]');
var stylesheets = {
ayuHighlight: document.querySelector("[href$='ayu-highlight.css']"),
tomorrowNight: document.querySelector("[href$='tomorrow-night.css']"),
highlight: document.querySelector("[href$='highlight.css']"),
};
function showThemes() {
themePopup.style.display = 'block';
themeToggleButton.setAttribute('aria-expanded', true);
themePopup.querySelector("button#" + get_theme()).focus();
}
function updateThemeSelected() {
themePopup.querySelectorAll('.theme-selected').forEach(function (el) {
el.classList.remove('theme-selected');
});
themePopup.querySelector("button#" + get_theme()).classList.add('theme-selected');
}
function hideThemes() {
themePopup.style.display = 'none';
themeToggleButton.setAttribute('aria-expanded', false);
themeToggleButton.focus();
}
function get_theme() {
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch (e) { }
if (theme === null || theme === undefined) {
return default_theme;
} else {
return theme;
}
}
function set_theme(theme, store = true) {
let ace_theme;
if (theme == 'coal' || theme == 'navy') {
stylesheets.ayuHighlight.disabled = true;
stylesheets.tomorrowNight.disabled = false;
stylesheets.highlight.disabled = true;
ace_theme = "ace/theme/tomorrow_night";
} else if (theme == 'ayu') {
stylesheets.ayuHighlight.disabled = false;
stylesheets.tomorrowNight.disabled = true;
stylesheets.highlight.disabled = true;
ace_theme = "ace/theme/tomorrow_night";
} else {
stylesheets.ayuHighlight.disabled = true;
stylesheets.tomorrowNight.disabled = true;
stylesheets.highlight.disabled = false;
ace_theme = "ace/theme/dawn";
}
setTimeout(function () {
themeColorMetaTag.content = getComputedStyle(document.documentElement).backgroundColor;
}, 1);
if (window.ace && window.editors) {
window.editors.forEach(function (editor) {
editor.setTheme(ace_theme);
});
}
var previousTheme = get_theme();
if (store) {
try { localStorage.setItem('mdbook-theme', theme); } catch (e) { }
}
html.classList.remove(previousTheme);
html.classList.add(theme);
updateThemeSelected();
}
// Set theme
var theme = get_theme();
set_theme(theme, false);
themeToggleButton.addEventListener('click', function () {
if (themePopup.style.display === 'block') {
hideThemes();
} else {
showThemes();
}
});
themePopup.addEventListener('click', function (e) {
var theme;
if (e.target.className === "theme") {
theme = e.target.id;
} else if (e.target.parentElement.className === "theme") {
theme = e.target.parentElement.id;
} else {
return;
}
set_theme(theme);
});
themePopup.addEventListener('focusout', function(e) {
// e.relatedTarget is null in Safari and Firefox on macOS (see workaround below)
if (!!e.relatedTarget && !themeToggleButton.contains(e.relatedTarget) && !themePopup.contains(e.relatedTarget)) {
hideThemes();
}
});
// Should not be needed, but it works around an issue on macOS & iOS: https://github.com/rust-lang/mdBook/issues/628
document.addEventListener('click', function(e) {
if (themePopup.style.display === 'block' && !themeToggleButton.contains(e.target) && !themePopup.contains(e.target)) {
hideThemes();
}
});
document.addEventListener('keydown', function (e) {
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { return; }
if (!themePopup.contains(e.target)) { return; }
switch (e.key) {
case 'Escape':
e.preventDefault();
hideThemes();
break;
case 'ArrowUp':
e.preventDefault();
var li = document.activeElement.parentElement;
if (li && li.previousElementSibling) {
li.previousElementSibling.querySelector('button').focus();
}
break;
case 'ArrowDown':
e.preventDefault();
var li = document.activeElement.parentElement;
if (li && li.nextElementSibling) {
li.nextElementSibling.querySelector('button').focus();
}
break;
case 'Home':
e.preventDefault();
themePopup.querySelector('li:first-child button').focus();
break;
case 'End':
e.preventDefault();
themePopup.querySelector('li:last-child button').focus();
break;
}
});
})();
(function sidebar() {
var body = document.querySelector("body");
var sidebar = document.getElementById("sidebar");
var sidebarLinks = document.querySelectorAll('#sidebar a');
var sidebarToggleButton = document.getElementById("sidebar-toggle");
var sidebarResizeHandle = document.getElementById("sidebar-resize-handle");
var firstContact = null;
function showSidebar() {
body.classList.remove('sidebar-hidden')
body.classList.add('sidebar-visible');
Array.from(sidebarLinks).forEach(function (link) {
link.setAttribute('tabIndex', 0);
});
sidebarToggleButton.setAttribute('aria-expanded', true);
sidebar.setAttribute('aria-hidden', false);
try { localStorage.setItem('mdbook-sidebar', 'visible'); } catch (e) { }
}
var sidebarAnchorToggles = document.querySelectorAll('#sidebar a.toggle');
function toggleSection(ev) {
ev.currentTarget.parentElement.classList.toggle('expanded');
}
Array.from(sidebarAnchorToggles).forEach(function (el) {
el.addEventListener('click', toggleSection);
});
function hideSidebar() {
body.classList.remove('sidebar-visible')
body.classList.add('sidebar-hidden');
Array.from(sidebarLinks).forEach(function (link) {
link.setAttribute('tabIndex', -1);
});
sidebarToggleButton.setAttribute('aria-expanded', false);
sidebar.setAttribute('aria-hidden', true);
try { localStorage.setItem('mdbook-sidebar', 'hidden'); } catch (e) { }
}
// Toggle sidebar
sidebarToggleButton.addEventListener('click', function sidebarToggle() {
if (body.classList.contains("sidebar-hidden")) {
var current_width = parseInt(
document.documentElement.style.getPropertyValue('--sidebar-width'), 10);
if (current_width < 150) {
document.documentElement.style.setProperty('--sidebar-width', '150px');
}
showSidebar();
} else if (body.classList.contains("sidebar-visible")) {
hideSidebar();
} else {
if (getComputedStyle(sidebar)['transform'] === 'none') {
hideSidebar();
} else {
showSidebar();
}
}
});
sidebarResizeHandle.addEventListener('mousedown', initResize, false);
function initResize(e) {
window.addEventListener('mousemove', resize, false);
window.addEventListener('mouseup', stopResize, false);
body.classList.add('sidebar-resizing');
}
function resize(e) {
var pos = (e.clientX - sidebar.offsetLeft);
if (pos < 20) {
hideSidebar();
} else {
if (body.classList.contains("sidebar-hidden")) {
showSidebar();
}
pos = Math.min(pos, window.innerWidth - 100);
document.documentElement.style.setProperty('--sidebar-width', pos + 'px');
}
}
//on mouseup remove windows functions mousemove & mouseup
function stopResize(e) {
body.classList.remove('sidebar-resizing');
window.removeEventListener('mousemove', resize, false);
window.removeEventListener('mouseup', stopResize, false);
}
document.addEventListener('touchstart', function (e) {
firstContact = {
x: e.touches[0].clientX,
time: Date.now()
};
}, { passive: true });
document.addEventListener('touchmove', function (e) {
if (!firstContact)
return;
var curX = e.touches[0].clientX;
var xDiff = curX - firstContact.x,
tDiff = Date.now() - firstContact.time;
if (tDiff < 250 && Math.abs(xDiff) >= 150) {
if (xDiff >= 0 && firstContact.x < Math.min(document.body.clientWidth * 0.25, 300))
showSidebar();
else if (xDiff < 0 && curX < 300)
hideSidebar();
firstContact = null;
}
}, { passive: true });
})();
(function chapterNavigation() {
document.addEventListener('keydown', function (e) {
if (e.altKey || e.ctrlKey || e.metaKey || e.shiftKey) { return; }
if (window.search && window.search.hasFocus()) { return; }
var html = document.querySelector('html');
function next() {
var nextButton = document.querySelector('.nav-chapters.next');
if (nextButton) {
window.location.href = nextButton.href;
}
}
function prev() {
var previousButton = document.querySelector('.nav-chapters.previous');
if (previousButton) {
window.location.href = previousButton.href;
}
}
switch (e.key) {
case 'ArrowRight':
e.preventDefault();
if (html.dir == 'rtl') {
prev();
} else {
next();
}
break;
case 'ArrowLeft':
e.preventDefault();
if (html.dir == 'rtl') {
next();
} else {
prev();
}
break;
}
});
})();
(function clipboard() {
var clipButtons = document.querySelectorAll('.clip-button');
function hideTooltip(elem) {
elem.firstChild.innerText = "";
elem.className = 'fa fa-copy clip-button';
}
function showTooltip(elem, msg) {
elem.firstChild.innerText = msg;
elem.className = 'fa fa-copy tooltipped';
}
var clipboardSnippets = new ClipboardJS('.clip-button', {
text: function (trigger) {
hideTooltip(trigger);
let playground = trigger.closest("pre");
return playground_text(playground, false);
}
});
Array.from(clipButtons).forEach(function (clipButton) {
clipButton.addEventListener('mouseout', function (e) {
hideTooltip(e.currentTarget);
});
});
clipboardSnippets.on('success', function (e) {
e.clearSelection();
showTooltip(e.trigger, "Copied!");
});
clipboardSnippets.on('error', function (e) {
showTooltip(e.trigger, "Clipboard error!");
});
})();
(function scrollToTop () {
var menuTitle = document.querySelector('.menu-title');
menuTitle.addEventListener('click', function () {
document.scrollingElement.scrollTo({ top: 0, behavior: 'smooth' });
});
})();
(function controllMenu() {
var menu = document.getElementById('menu-bar');
(function controllPosition() {
var scrollTop = document.scrollingElement.scrollTop;
var prevScrollTop = scrollTop;
var minMenuY = -menu.clientHeight - 50;
// When the script loads, the page can be at any scroll (e.g. if you reforesh it).
menu.style.top = scrollTop + 'px';
// Same as parseInt(menu.style.top.slice(0, -2), but faster
var topCache = menu.style.top.slice(0, -2);
menu.classList.remove('sticky');
var stickyCache = false; // Same as menu.classList.contains('sticky'), but faster
document.addEventListener('scroll', function () {
scrollTop = Math.max(document.scrollingElement.scrollTop, 0);
// `null` means that it doesn't need to be updated
var nextSticky = null;
var nextTop = null;
var scrollDown = scrollTop > prevScrollTop;
var menuPosAbsoluteY = topCache - scrollTop;
if (scrollDown) {
nextSticky = false;
if (menuPosAbsoluteY > 0) {
nextTop = prevScrollTop;
}
} else {
if (menuPosAbsoluteY > 0) {
nextSticky = true;
} else if (menuPosAbsoluteY < minMenuY) {
nextTop = prevScrollTop + minMenuY;
}
}
if (nextSticky === true && stickyCache === false) {
menu.classList.add('sticky');
stickyCache = true;
} else if (nextSticky === false && stickyCache === true) {
menu.classList.remove('sticky');
stickyCache = false;
}
if (nextTop !== null) {
menu.style.top = nextTop + 'px';
topCache = nextTop;
}
prevScrollTop = scrollTop;
}, { passive: true });
})();
(function controllBorder() {
function updateBorder() {
if (menu.offsetTop === 0) {
menu.classList.remove('bordered');
} else {
menu.classList.add('bordered');
}
}
updateBorder();
document.addEventListener('scroll', updateBorder, { passive: true });
})();
})();

7
clipboard.min.js vendored Normal file

File diff suppressed because one or more lines are too long

441
concepts.html Normal file
View File

@ -0,0 +1,441 @@
<!DOCTYPE HTML>
<html lang="en" class="light" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>Core concepts - Chronos</title>
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="open-in.css">
</head>
<body class="sidebar-visible no-js">
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('light')
html.classList.add(theme);
var body = document.querySelector('body');
body.classList.remove('no-js')
body.classList.add('js');
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var body = document.querySelector('body');
var sidebar = null;
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
body.classList.remove('sidebar-visible');
body.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="examples.html"><strong aria-hidden="true">2.</strong> Examples</a></li><li class="chapter-item expanded affix "><li class="part-title">User guide</li><li class="chapter-item expanded "><a href="concepts.html" class="active"><strong aria-hidden="true">3.</strong> Core concepts</a></li><li class="chapter-item expanded "><a href="async_procs.html"><strong aria-hidden="true">4.</strong> async functions</a></li><li class="chapter-item expanded "><a href="error_handling.html"><strong aria-hidden="true">5.</strong> Errors and exceptions</a></li><li class="chapter-item expanded "><a href="threads.html"><strong aria-hidden="true">6.</strong> Threads</a></li><li class="chapter-item expanded "><a href="tips.html"><strong aria-hidden="true">7.</strong> Tips, tricks and best practices</a></li><li class="chapter-item expanded "><a href="porting.html"><strong aria-hidden="true">8.</strong> Porting code to chronos</a></li><li class="chapter-item expanded "><a href="http_server_middleware.html"><strong aria-hidden="true">9.</strong> HTTP server middleware</a></li><li class="chapter-item expanded affix "><li class="part-title">Developer guide</li><li class="chapter-item expanded "><a href="book.html"><strong aria-hidden="true">10.</strong> Updating this book</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<!-- Track and set sidebar scroll position -->
<script>
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
sidebarScrollbox.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
sidebarScrollbox.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
</script>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Chronos</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/status-im/nim-chronos/" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h1 id="concepts"><a class="header" href="#concepts">Concepts</a></h1>
<p>Async/await is a programming model that relies on cooperative multitasking to
coordinate the concurrent execution of procedures, using event notifications
from the operating system or other treads to resume execution.</p>
<p>Code execution happens in a loop that alternates between making progress on
tasks and handling events.</p>
<ul>
<li><a href="#the-dispatcher">The dispatcher</a></li>
<li><a href="#the-future-type">The <code>Future</code> type</a></li>
<li><a href="#the-poll-call">The <code>poll</code> call</a></li>
<li><a href="#cancellation">Cancellation</a></li>
<li><a href="#compile-time-configuration">Compile-time configuration</a></li>
</ul>
<h2 id="the-dispatcher"><a class="header" href="#the-dispatcher">The dispatcher</a></h2>
<p>The event handler loop is called a &quot;dispatcher&quot; and a single instance per
thread is created, as soon as one is needed.</p>
<p>Scheduling is done by calling <a href="./async_procs.html">async procedures</a> that return
<code>Future</code> objects - each time a procedure is unable to make further
progress, for example because it's waiting for some data to arrive, it hands
control back to the dispatcher which ensures that the procedure is resumed when
ready.</p>
<p>A single thread, and thus a single dispatcher, is typically able to handle
thousands of concurrent in-progress requests.</p>
<h2 id="the-future-type"><a class="header" href="#the-future-type">The <code>Future</code> type</a></h2>
<p><code>Future</code> objects encapsulate the outcome of executing an <code>async</code> procedure. The
<code>Future</code> may be <code>pending</code> meaning that the outcome is not yet known or
<code>finished</code> meaning that the return value is available, the operation failed
with an exception or was cancelled.</p>
<p>Inside an async procedure, you can <code>await</code> the outcome of another async
procedure - if the <code>Future</code> representing that operation is still <code>pending</code>, a
callback representing where to resume execution will be added to it and the
dispatcher will be given back control to deal with other tasks.</p>
<p>When a <code>Future</code> is <code>finished</code>, all its callbacks are scheduled to be run by
the dispatcher, thus continuing any operations that were waiting for an outcome.</p>
<h2 id="the-poll-call"><a class="header" href="#the-poll-call">The <code>poll</code> call</a></h2>
<p>To trigger the processing step of the dispatcher, we need to call <code>poll()</code> -
either directly or through a wrapper like <code>runForever()</code> or <code>waitFor()</code>.</p>
<p>Each call to poll handles any file descriptors, timers and callbacks that are
ready to be processed.</p>
<p>Using <code>waitFor</code>, the result of a single asynchronous operation can be obtained:</p>
<pre><code class="language-nim">proc myApp() {.async.} =
echo &quot;Waiting for a second...&quot;
await sleepAsync(1.seconds)
echo &quot;done!&quot;
waitFor myApp()
</code></pre>
<p>It is also possible to keep running the event loop forever using <code>runForever</code>:</p>
<pre><code class="language-nim">proc myApp() {.async.} =
while true:
await sleepAsync(1.seconds)
echo &quot;A bit more than a second passed!&quot;
let future = myApp()
runForever()
</code></pre>
<p>Such an application never terminates, thus it is rare that applications are
structured this way.</p>
<pre><code class="language-admonish warning">Both `waitFor` and `runForever` call `poll` which offers fine-grained
control over the event loop steps.
Nested calls to `poll` - directly or indirectly via `waitFor` and `runForever`
are not allowed.
</code></pre>
<h2 id="cancellation"><a class="header" href="#cancellation">Cancellation</a></h2>
<p>Any pending <code>Future</code> can be cancelled. This can be used for timeouts, to start
multiple parallel operations and cancel the rest as soon as one finishes,
to initiate the orderely shutdown of an application etc.</p>
<pre><code class="language-nim">## Simple cancellation example
import chronos
proc someTask() {.async.} = await sleepAsync(10.minutes)
proc cancellationExample() {.async.} =
# Start a task but don't wait for it to finish
let future = someTask()
future.cancelSoon()
# `cancelSoon` schedules but does not wait for the future to get cancelled -
# it might still be pending here
let future2 = someTask() # Start another task concurrently
await future2.cancelAndWait()
# Using `cancelAndWait`, we can be sure that `future2` is either
# complete, failed or cancelled at this point. `future` could still be
# pending!
assert future2.finished()
waitFor(cancellationExample())
</code></pre>
<p>Even if cancellation is initiated, it is not guaranteed that the operation gets
cancelled - the future might still be completed or fail depending on the
order of events in the dispatcher and the specifics of the operation.</p>
<p>If the future indeed gets cancelled, <code>await</code> will raise a
<code>CancelledError</code> as is likely to happen in the following example:</p>
<pre><code class="language-nim">proc c1 {.async.} =
echo &quot;Before sleep&quot;
try:
await sleepAsync(10.minutes)
echo &quot;After sleep&quot; # not reach due to cancellation
except CancelledError as exc:
echo &quot;We got cancelled!&quot;
# `CancelledError` is typically re-raised to notify the caller that the
# operation is being cancelled
raise exc
proc c2 {.async.} =
await c1()
echo &quot;Never reached, since the CancelledError got re-raised&quot;
let work = c2()
waitFor(work.cancelAndWait())
</code></pre>
<p>The <code>CancelledError</code> will now travel up the stack like any other exception.
It can be caught for instance to free some resources and is then typically
re-raised for the whole chain operations to get cancelled.</p>
<p>Alternatively, the cancellation request can be translated to a regular outcome
of the operation - for example, a <code>read</code> operation might return an empty result.</p>
<p>Cancelling an already-finished <code>Future</code> has no effect, as the following example
of downloading two web pages concurrently shows:</p>
<pre><code class="language-nim">## Make two http requests concurrently and output the one that wins
import chronos
import ./httpget
proc twoGets() {.async.} =
let
futs = @[
# Both pages will start downloading concurrently...
httpget.retrievePage(&quot;https://duckduckgo.com/?q=chronos&quot;),
httpget.retrievePage(&quot;https://www.google.fr/search?q=chronos&quot;)
]
# Wait for at least one request to finish..
let winner = await one(futs)
# ..and cancel the others since we won't need them
for fut in futs:
# Trying to cancel an already-finished future is harmless
fut.cancelSoon()
# An exception could be raised here if the winning request failed!
echo &quot;Result: &quot;, winner.read()
waitFor(twoGets())
</code></pre>
<h3 id="ownership"><a class="header" href="#ownership">Ownership</a></h3>
<p>When calling a procedure that returns a <code>Future</code>, ownership of that <code>Future</code> is
shared between the callee that created it and the caller that waits for it to be
finished.</p>
<p>The <code>Future</code> can be thought of as a single-item channel between a producer and a
consumer. The producer creates the <code>Future</code> and is responsible for completing or
failing it while the caller waits for completion and may <code>cancel</code> it.</p>
<p>Although it is technically possible, callers must not <code>complete</code> or <code>fail</code>
futures and callees or other intermediate observers must not <code>cancel</code> them as
this may lead to panics and shutdown (ie if the future is completed twice or a
cancalletion is not handled by the original caller).</p>
<h3 id="nocancel"><a class="header" href="#nocancel"><code>noCancel</code></a></h3>
<p>Certain operations must not be cancelled for semantic reasons. Common scenarios
include <code>closeWait</code> that releases a resources irrevocably and composed
operations whose individual steps should be performed together or not at all.</p>
<p>In such cases, the <code>noCancel</code> modifier to <code>await</code> can be used to temporarily
disable cancellation propagation, allowing the operation to complete even if
the caller initiates a cancellation request:</p>
<pre><code class="language-nim">proc deepSleep(dur: Duration) {.async.} =
# `noCancel` prevents any cancellation request by the caller of `deepSleep`
# from reaching `sleepAsync` - even if `deepSleep` is cancelled, its future
# will not complete until the sleep finishes.
await noCancel sleepAsync(dur)
let future = deepSleep(10.minutes)
# This will take ~10 minutes even if we try to cancel the call to `deepSleep`!
await cancelAndWait(future)
</code></pre>
<h3 id="join"><a class="header" href="#join"><code>join</code></a></h3>
<p>The <code>join</code> modifier to <code>await</code> allows cancelling an <code>async</code> procedure without
propagating the cancellation to the awaited operation. This is useful when
<code>await</code>:ing a <code>Future</code> for monitoring purposes, ie when a procedure is not the
owner of the future that's being <code>await</code>:ed.</p>
<p>One situation where this happens is when implementing the &quot;observer&quot; pattern,
where a helper monitors an operation it did not initiate:</p>
<pre><code class="language-nim">var tick: Future[void]
proc ticker() {.async.} =
while true:
tick = sleepAsync(1.second)
await tick
echo &quot;tick!&quot;
proc tocker() {.async.} =
# This operation does not own or implement the operation behind `tick`,
# so it should not cancel it when `tocker` is cancelled
await join tick
echo &quot;tock!&quot;
let
fut = ticker() # `ticker` is now looping and most likely waiting for `tick`
fut2 = tocker() # both `ticker` and `tocker` are waiting for `tick`
# We don't want `tocker` to cancel a future that was created in `ticker`
waitFor fut2.cancelAndWait()
waitFor fut # keeps printing `tick!` every second.
</code></pre>
<h2 id="compile-time-configuration"><a class="header" href="#compile-time-configuration">Compile-time configuration</a></h2>
<p><code>chronos</code> contains several compile-time
<a href="./chronos/config.nim">configuration options</a> enabling stricter compile-time
checks and debugging helpers whose runtime cost may be significant.</p>
<p>Strictness options generally will become default in future chronos releases and
allow adapting existing code without changing the new version - see the
<a href="./chronos/config.nim"><code>config.nim</code></a> module for more information.</p>
<footer id="open-on-gh">Found a bug? <a href="https://github.com/status-im/nim-chronos//edit/master/docs/src/concepts.md">Edit this page on GitHub.</a></footer>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="examples.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="async_procs.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="examples.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="async_procs.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script>
window.playground_copyable = true;
</script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>

606
css/chrome.css Normal file
View File

@ -0,0 +1,606 @@
/* CSS for UI elements (a.k.a. chrome) */
@import 'variables.css';
html {
scrollbar-color: var(--scrollbar) var(--bg);
}
#searchresults a,
.content a:link,
a:visited,
a > .hljs {
color: var(--links);
}
/*
body-container is necessary because mobile browsers don't seem to like
overflow-x on the body tag when there is a <meta name="viewport"> tag.
*/
#body-container {
/*
This is used when the sidebar pushes the body content off the side of
the screen on small screens. Without it, dragging on mobile Safari
will want to reposition the viewport in a weird way.
*/
overflow-x: clip;
}
/* Menu Bar */
#menu-bar,
#menu-bar-hover-placeholder {
z-index: 101;
margin: auto calc(0px - var(--page-padding));
}
#menu-bar {
position: relative;
display: flex;
flex-wrap: wrap;
background-color: var(--bg);
border-block-end-color: var(--bg);
border-block-end-width: 1px;
border-block-end-style: solid;
}
#menu-bar.sticky,
.js #menu-bar-hover-placeholder:hover + #menu-bar,
.js #menu-bar:hover,
.js.sidebar-visible #menu-bar {
position: -webkit-sticky;
position: sticky;
top: 0 !important;
}
#menu-bar-hover-placeholder {
position: sticky;
position: -webkit-sticky;
top: 0;
height: var(--menu-bar-height);
}
#menu-bar.bordered {
border-block-end-color: var(--table-border-color);
}
#menu-bar i, #menu-bar .icon-button {
position: relative;
padding: 0 8px;
z-index: 10;
line-height: var(--menu-bar-height);
cursor: pointer;
transition: color 0.5s;
}
@media only screen and (max-width: 420px) {
#menu-bar i, #menu-bar .icon-button {
padding: 0 5px;
}
}
.icon-button {
border: none;
background: none;
padding: 0;
color: inherit;
}
.icon-button i {
margin: 0;
}
.right-buttons {
margin: 0 15px;
}
.right-buttons a {
text-decoration: none;
}
.left-buttons {
display: flex;
margin: 0 5px;
}
.no-js .left-buttons button {
display: none;
}
.menu-title {
display: inline-block;
font-weight: 200;
font-size: 2.4rem;
line-height: var(--menu-bar-height);
text-align: center;
margin: 0;
flex: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.js .menu-title {
cursor: pointer;
}
.menu-bar,
.menu-bar:visited,
.nav-chapters,
.nav-chapters:visited,
.mobile-nav-chapters,
.mobile-nav-chapters:visited,
.menu-bar .icon-button,
.menu-bar a i {
color: var(--icons);
}
.menu-bar i:hover,
.menu-bar .icon-button:hover,
.nav-chapters:hover,
.mobile-nav-chapters i:hover {
color: var(--icons-hover);
}
/* Nav Icons */
.nav-chapters {
font-size: 2.5em;
text-align: center;
text-decoration: none;
position: fixed;
top: 0;
bottom: 0;
margin: 0;
max-width: 150px;
min-width: 90px;
display: flex;
justify-content: center;
align-content: center;
flex-direction: column;
transition: color 0.5s, background-color 0.5s;
}
.nav-chapters:hover {
text-decoration: none;
background-color: var(--theme-hover);
transition: background-color 0.15s, color 0.15s;
}
.nav-wrapper {
margin-block-start: 50px;
display: none;
}
.mobile-nav-chapters {
font-size: 2.5em;
text-align: center;
text-decoration: none;
width: 90px;
border-radius: 5px;
background-color: var(--sidebar-bg);
}
/* Only Firefox supports flow-relative values */
.previous { float: left; }
[dir=rtl] .previous { float: right; }
/* Only Firefox supports flow-relative values */
.next {
float: right;
right: var(--page-padding);
}
[dir=rtl] .next {
float: left;
right: unset;
left: var(--page-padding);
}
/* Use the correct buttons for RTL layouts*/
[dir=rtl] .previous i.fa-angle-left:before {content:"\f105";}
[dir=rtl] .next i.fa-angle-right:before { content:"\f104"; }
@media only screen and (max-width: 1080px) {
.nav-wide-wrapper { display: none; }
.nav-wrapper { display: block; }
}
/* sidebar-visible */
@media only screen and (max-width: 1380px) {
#sidebar-toggle-anchor:checked ~ .page-wrapper .nav-wide-wrapper { display: none; }
#sidebar-toggle-anchor:checked ~ .page-wrapper .nav-wrapper { display: block; }
}
/* Inline code */
:not(pre) > .hljs {
display: inline;
padding: 0.1em 0.3em;
border-radius: 3px;
}
:not(pre):not(a) > .hljs {
color: var(--inline-code-color);
overflow-x: initial;
}
a:hover > .hljs {
text-decoration: underline;
}
pre {
position: relative;
}
pre > .buttons {
position: absolute;
z-index: 100;
right: 0px;
top: 2px;
margin: 0px;
padding: 2px 0px;
color: var(--sidebar-fg);
cursor: pointer;
visibility: hidden;
opacity: 0;
transition: visibility 0.1s linear, opacity 0.1s linear;
}
pre:hover > .buttons {
visibility: visible;
opacity: 1
}
pre > .buttons :hover {
color: var(--sidebar-active);
border-color: var(--icons-hover);
background-color: var(--theme-hover);
}
pre > .buttons i {
margin-inline-start: 8px;
}
pre > .buttons button {
cursor: inherit;
margin: 0px 5px;
padding: 3px 5px;
font-size: 14px;
border-style: solid;
border-width: 1px;
border-radius: 4px;
border-color: var(--icons);
background-color: var(--theme-popup-bg);
transition: 100ms;
transition-property: color,border-color,background-color;
color: var(--icons);
}
@media (pointer: coarse) {
pre > .buttons button {
/* On mobile, make it easier to tap buttons. */
padding: 0.3rem 1rem;
}
.sidebar-resize-indicator {
/* Hide resize indicator on devices with limited accuracy */
display: none;
}
}
pre > code {
display: block;
padding: 1rem;
}
/* FIXME: ACE editors overlap their buttons because ACE does absolute
positioning within the code block which breaks padding. The only solution I
can think of is to move the padding to the outer pre tag (or insert a div
wrapper), but that would require fixing a whole bunch of CSS rules.
*/
.hljs.ace_editor {
padding: 0rem 0rem;
}
pre > .result {
margin-block-start: 10px;
}
/* Search */
#searchresults a {
text-decoration: none;
}
mark {
border-radius: 2px;
padding-block-start: 0;
padding-block-end: 1px;
padding-inline-start: 3px;
padding-inline-end: 3px;
margin-block-start: 0;
margin-block-end: -1px;
margin-inline-start: -3px;
margin-inline-end: -3px;
background-color: var(--search-mark-bg);
transition: background-color 300ms linear;
cursor: pointer;
}
mark.fade-out {
background-color: rgba(0,0,0,0) !important;
cursor: auto;
}
.searchbar-outer {
margin-inline-start: auto;
margin-inline-end: auto;
max-width: var(--content-max-width);
}
#searchbar {
width: 100%;
margin-block-start: 5px;
margin-block-end: 0;
margin-inline-start: auto;
margin-inline-end: auto;
padding: 10px 16px;
transition: box-shadow 300ms ease-in-out;
border: 1px solid var(--searchbar-border-color);
border-radius: 3px;
background-color: var(--searchbar-bg);
color: var(--searchbar-fg);
}
#searchbar:focus,
#searchbar.active {
box-shadow: 0 0 3px var(--searchbar-shadow-color);
}
.searchresults-header {
font-weight: bold;
font-size: 1em;
padding-block-start: 18px;
padding-block-end: 0;
padding-inline-start: 5px;
padding-inline-end: 0;
color: var(--searchresults-header-fg);
}
.searchresults-outer {
margin-inline-start: auto;
margin-inline-end: auto;
max-width: var(--content-max-width);
border-block-end: 1px dashed var(--searchresults-border-color);
}
ul#searchresults {
list-style: none;
padding-inline-start: 20px;
}
ul#searchresults li {
margin: 10px 0px;
padding: 2px;
border-radius: 2px;
}
ul#searchresults li.focus {
background-color: var(--searchresults-li-bg);
}
ul#searchresults span.teaser {
display: block;
clear: both;
margin-block-start: 5px;
margin-block-end: 0;
margin-inline-start: 20px;
margin-inline-end: 0;
font-size: 0.8em;
}
ul#searchresults span.teaser em {
font-weight: bold;
font-style: normal;
}
/* Sidebar */
.sidebar {
position: fixed;
left: 0;
top: 0;
bottom: 0;
width: var(--sidebar-width);
font-size: 0.875em;
box-sizing: border-box;
-webkit-overflow-scrolling: touch;
overscroll-behavior-y: contain;
background-color: var(--sidebar-bg);
color: var(--sidebar-fg);
}
[dir=rtl] .sidebar { left: unset; right: 0; }
.sidebar-resizing {
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
user-select: none;
}
.no-js .sidebar,
.js:not(.sidebar-resizing) .sidebar {
transition: transform 0.3s; /* Animation: slide away */
}
.sidebar code {
line-height: 2em;
}
.sidebar .sidebar-scrollbox {
overflow-y: auto;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
padding: 10px 10px;
}
.sidebar .sidebar-resize-handle {
position: absolute;
cursor: col-resize;
width: 0;
right: calc(var(--sidebar-resize-indicator-width) * -1);
top: 0;
bottom: 0;
display: flex;
align-items: center;
}
.sidebar-resize-handle .sidebar-resize-indicator {
width: 100%;
height: 12px;
background-color: var(--icons);
margin-inline-start: var(--sidebar-resize-indicator-space);
}
[dir=rtl] .sidebar .sidebar-resize-handle {
left: calc(var(--sidebar-resize-indicator-width) * -1);
right: unset;
}
.js .sidebar .sidebar-resize-handle {
cursor: col-resize;
width: calc(var(--sidebar-resize-indicator-width) - var(--sidebar-resize-indicator-space));
}
/* sidebar-hidden */
#sidebar-toggle-anchor:not(:checked) ~ .sidebar {
transform: translateX(calc(0px - var(--sidebar-width) - var(--sidebar-resize-indicator-width)));
z-index: -1;
}
[dir=rtl] #sidebar-toggle-anchor:not(:checked) ~ .sidebar {
transform: translateX(calc(var(--sidebar-width) + var(--sidebar-resize-indicator-width)));
}
.sidebar::-webkit-scrollbar {
background: var(--sidebar-bg);
}
.sidebar::-webkit-scrollbar-thumb {
background: var(--scrollbar);
}
/* sidebar-visible */
#sidebar-toggle-anchor:checked ~ .page-wrapper {
transform: translateX(calc(var(--sidebar-width) + var(--sidebar-resize-indicator-width)));
}
[dir=rtl] #sidebar-toggle-anchor:checked ~ .page-wrapper {
transform: translateX(calc(0px - var(--sidebar-width) - var(--sidebar-resize-indicator-width)));
}
@media only screen and (min-width: 620px) {
#sidebar-toggle-anchor:checked ~ .page-wrapper {
transform: none;
margin-inline-start: calc(var(--sidebar-width) + var(--sidebar-resize-indicator-width));
}
[dir=rtl] #sidebar-toggle-anchor:checked ~ .page-wrapper {
transform: none;
}
}
.chapter {
list-style: none outside none;
padding-inline-start: 0;
line-height: 2.2em;
}
.chapter ol {
width: 100%;
}
.chapter li {
display: flex;
color: var(--sidebar-non-existant);
}
.chapter li a {
display: block;
padding: 0;
text-decoration: none;
color: var(--sidebar-fg);
}
.chapter li a:hover {
color: var(--sidebar-active);
}
.chapter li a.active {
color: var(--sidebar-active);
}
.chapter li > a.toggle {
cursor: pointer;
display: block;
margin-inline-start: auto;
padding: 0 10px;
user-select: none;
opacity: 0.68;
}
.chapter li > a.toggle div {
transition: transform 0.5s;
}
/* collapse the section */
.chapter li:not(.expanded) + li > ol {
display: none;
}
.chapter li.chapter-item {
line-height: 1.5em;
margin-block-start: 0.6em;
}
.chapter li.expanded > a.toggle div {
transform: rotate(90deg);
}
.spacer {
width: 100%;
height: 3px;
margin: 5px 0px;
}
.chapter .spacer {
background-color: var(--sidebar-spacer);
}
@media (-moz-touch-enabled: 1), (pointer: coarse) {
.chapter li a { padding: 5px 0; }
.spacer { margin: 10px 0; }
}
.section {
list-style: none outside none;
padding-inline-start: 20px;
line-height: 1.9em;
}
/* Theme Menu Popup */
.theme-popup {
position: absolute;
left: 10px;
top: var(--menu-bar-height);
z-index: 1000;
border-radius: 4px;
font-size: 0.7em;
color: var(--fg);
background: var(--theme-popup-bg);
border: 1px solid var(--theme-popup-border);
margin: 0;
padding: 0;
list-style: none;
display: none;
/* Don't let the children's background extend past the rounded corners. */
overflow: hidden;
}
[dir=rtl] .theme-popup { left: unset; right: 10px; }
.theme-popup .default {
color: var(--icons);
}
.theme-popup .theme {
width: 100%;
border: 0;
margin: 0;
padding: 2px 20px;
line-height: 25px;
white-space: nowrap;
text-align: start;
cursor: pointer;
color: inherit;
background: inherit;
font-size: inherit;
}
.theme-popup .theme:hover {
background-color: var(--theme-hover);
}
.theme-selected::before {
display: inline-block;
content: "✓";
margin-inline-start: -14px;
width: 14px;
}

234
css/general.css Normal file
View File

@ -0,0 +1,234 @@
/* Base styles and content styles */
@import 'variables.css';
:root {
/* Browser default font-size is 16px, this way 1 rem = 10px */
font-size: 62.5%;
color-scheme: var(--color-scheme);
}
html {
font-family: "Open Sans", sans-serif;
color: var(--fg);
background-color: var(--bg);
text-size-adjust: none;
-webkit-text-size-adjust: none;
}
body {
margin: 0;
font-size: 1.6rem;
overflow-x: hidden;
}
code {
font-family: var(--mono-font) !important;
font-size: var(--code-font-size);
direction: ltr !important;
}
/* make long words/inline code not x overflow */
main {
overflow-wrap: break-word;
}
/* make wide tables scroll if they overflow */
.table-wrapper {
overflow-x: auto;
}
/* Don't change font size in headers. */
h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
font-size: unset;
}
.left { float: left; }
.right { float: right; }
.boring { opacity: 0.6; }
.hide-boring .boring { display: none; }
.hidden { display: none !important; }
h2, h3 { margin-block-start: 2.5em; }
h4, h5 { margin-block-start: 2em; }
.header + .header h3,
.header + .header h4,
.header + .header h5 {
margin-block-start: 1em;
}
h1:target::before,
h2:target::before,
h3:target::before,
h4:target::before,
h5:target::before,
h6:target::before {
display: inline-block;
content: "»";
margin-inline-start: -30px;
width: 30px;
}
/* This is broken on Safari as of version 14, but is fixed
in Safari Technology Preview 117 which I think will be Safari 14.2.
https://bugs.webkit.org/show_bug.cgi?id=218076
*/
:target {
/* Safari does not support logical properties */
scroll-margin-top: calc(var(--menu-bar-height) + 0.5em);
}
.page {
outline: 0;
padding: 0 var(--page-padding);
margin-block-start: calc(0px - var(--menu-bar-height)); /* Compensate for the #menu-bar-hover-placeholder */
}
.page-wrapper {
box-sizing: border-box;
background-color: var(--bg);
}
.no-js .page-wrapper,
.js:not(.sidebar-resizing) .page-wrapper {
transition: margin-left 0.3s ease, transform 0.3s ease; /* Animation: slide away */
}
[dir=rtl] .js:not(.sidebar-resizing) .page-wrapper {
transition: margin-right 0.3s ease, transform 0.3s ease; /* Animation: slide away */
}
.content {
overflow-y: auto;
padding: 0 5px 50px 5px;
}
.content main {
margin-inline-start: auto;
margin-inline-end: auto;
max-width: var(--content-max-width);
}
.content p { line-height: 1.45em; }
.content ol { line-height: 1.45em; }
.content ul { line-height: 1.45em; }
.content a { text-decoration: none; }
.content a:hover { text-decoration: underline; }
.content img, .content video { max-width: 100%; }
.content .header:link,
.content .header:visited {
color: var(--fg);
}
.content .header:link,
.content .header:visited:hover {
text-decoration: none;
}
table {
margin: 0 auto;
border-collapse: collapse;
}
table td {
padding: 3px 20px;
border: 1px var(--table-border-color) solid;
}
table thead {
background: var(--table-header-bg);
}
table thead td {
font-weight: 700;
border: none;
}
table thead th {
padding: 3px 20px;
}
table thead tr {
border: 1px var(--table-header-bg) solid;
}
/* Alternate background colors for rows */
table tbody tr:nth-child(2n) {
background: var(--table-alternate-bg);
}
blockquote {
margin: 20px 0;
padding: 0 20px;
color: var(--fg);
background-color: var(--quote-bg);
border-block-start: .1em solid var(--quote-border);
border-block-end: .1em solid var(--quote-border);
}
.warning {
margin: 20px;
padding: 0 20px;
border-inline-start: 2px solid var(--warning-border);
}
.warning:before {
position: absolute;
width: 3rem;
height: 3rem;
margin-inline-start: calc(-1.5rem - 21px);
content: "ⓘ";
text-align: center;
background-color: var(--bg);
color: var(--warning-border);
font-weight: bold;
font-size: 2rem;
}
blockquote .warning:before {
background-color: var(--quote-bg);
}
kbd {
background-color: var(--table-border-color);
border-radius: 4px;
border: solid 1px var(--theme-popup-border);
box-shadow: inset 0 -1px 0 var(--theme-hover);
display: inline-block;
font-size: var(--code-font-size);
font-family: var(--mono-font);
line-height: 10px;
padding: 4px 5px;
vertical-align: middle;
}
:not(.footnote-definition) + .footnote-definition,
.footnote-definition + :not(.footnote-definition) {
margin-block-start: 2em;
}
.footnote-definition {
font-size: 0.9em;
margin: 0.5em 0;
}
.footnote-definition p {
display: inline;
}
.tooltiptext {
position: absolute;
visibility: hidden;
color: #fff;
background-color: #333;
transform: translateX(-50%); /* Center by moving tooltip 50% of its width left */
left: -8px; /* Half of the width of the icon */
top: -35px;
font-size: 0.8em;
text-align: center;
border-radius: 6px;
padding: 5px 8px;
margin: 5px;
z-index: 1000;
}
.tooltipped .tooltiptext {
visibility: visible;
}
.chapter li.part-title {
color: var(--sidebar-fg);
margin: 5px 0px;
font-weight: bold;
}
.result-no-output {
font-style: italic;
}

50
css/print.css Normal file
View File

@ -0,0 +1,50 @@
#sidebar,
#menu-bar,
.nav-chapters,
.mobile-nav-chapters {
display: none;
}
#page-wrapper.page-wrapper {
transform: none !important;
margin-inline-start: 0px;
overflow-y: initial;
}
#content {
max-width: none;
margin: 0;
padding: 0;
}
.page {
overflow-y: initial;
}
code {
direction: ltr !important;
}
pre > .buttons {
z-index: 2;
}
a, a:visited, a:active, a:hover {
color: #4183c4;
text-decoration: none;
}
h1, h2, h3, h4, h5, h6 {
page-break-inside: avoid;
page-break-after: avoid;
}
pre, code {
page-break-inside: avoid;
white-space: pre-wrap;
}
.fa {
display: none !important;
}

279
css/variables.css Normal file
View File

@ -0,0 +1,279 @@
/* Globals */
:root {
--sidebar-width: 300px;
--sidebar-resize-indicator-width: 8px;
--sidebar-resize-indicator-space: 2px;
--page-padding: 15px;
--content-max-width: 750px;
--menu-bar-height: 50px;
--mono-font: "Source Code Pro", Consolas, "Ubuntu Mono", Menlo, "DejaVu Sans Mono", monospace, monospace;
--code-font-size: 0.875em /* please adjust the ace font size accordingly in editor.js */
}
/* Themes */
.ayu {
--bg: hsl(210, 25%, 8%);
--fg: #c5c5c5;
--sidebar-bg: #14191f;
--sidebar-fg: #c8c9db;
--sidebar-non-existant: #5c6773;
--sidebar-active: #ffb454;
--sidebar-spacer: #2d334f;
--scrollbar: var(--sidebar-fg);
--icons: #737480;
--icons-hover: #b7b9cc;
--links: #0096cf;
--inline-code-color: #ffb454;
--theme-popup-bg: #14191f;
--theme-popup-border: #5c6773;
--theme-hover: #191f26;
--quote-bg: hsl(226, 15%, 17%);
--quote-border: hsl(226, 15%, 22%);
--warning-border: #ff8e00;
--table-border-color: hsl(210, 25%, 13%);
--table-header-bg: hsl(210, 25%, 28%);
--table-alternate-bg: hsl(210, 25%, 11%);
--searchbar-border-color: #848484;
--searchbar-bg: #424242;
--searchbar-fg: #fff;
--searchbar-shadow-color: #d4c89f;
--searchresults-header-fg: #666;
--searchresults-border-color: #888;
--searchresults-li-bg: #252932;
--search-mark-bg: #e3b171;
--color-scheme: dark;
}
.coal {
--bg: hsl(200, 7%, 8%);
--fg: #98a3ad;
--sidebar-bg: #292c2f;
--sidebar-fg: #a1adb8;
--sidebar-non-existant: #505254;
--sidebar-active: #3473ad;
--sidebar-spacer: #393939;
--scrollbar: var(--sidebar-fg);
--icons: #43484d;
--icons-hover: #b3c0cc;
--links: #2b79a2;
--inline-code-color: #c5c8c6;
--theme-popup-bg: #141617;
--theme-popup-border: #43484d;
--theme-hover: #1f2124;
--quote-bg: hsl(234, 21%, 18%);
--quote-border: hsl(234, 21%, 23%);
--warning-border: #ff8e00;
--table-border-color: hsl(200, 7%, 13%);
--table-header-bg: hsl(200, 7%, 28%);
--table-alternate-bg: hsl(200, 7%, 11%);
--searchbar-border-color: #aaa;
--searchbar-bg: #b7b7b7;
--searchbar-fg: #000;
--searchbar-shadow-color: #aaa;
--searchresults-header-fg: #666;
--searchresults-border-color: #98a3ad;
--searchresults-li-bg: #2b2b2f;
--search-mark-bg: #355c7d;
--color-scheme: dark;
}
.light {
--bg: hsl(0, 0%, 100%);
--fg: hsl(0, 0%, 0%);
--sidebar-bg: #fafafa;
--sidebar-fg: hsl(0, 0%, 0%);
--sidebar-non-existant: #aaaaaa;
--sidebar-active: #1f1fff;
--sidebar-spacer: #f4f4f4;
--scrollbar: #8F8F8F;
--icons: #747474;
--icons-hover: #000000;
--links: #20609f;
--inline-code-color: #301900;
--theme-popup-bg: #fafafa;
--theme-popup-border: #cccccc;
--theme-hover: #e6e6e6;
--quote-bg: hsl(197, 37%, 96%);
--quote-border: hsl(197, 37%, 91%);
--warning-border: #ff8e00;
--table-border-color: hsl(0, 0%, 95%);
--table-header-bg: hsl(0, 0%, 80%);
--table-alternate-bg: hsl(0, 0%, 97%);
--searchbar-border-color: #aaa;
--searchbar-bg: #fafafa;
--searchbar-fg: #000;
--searchbar-shadow-color: #aaa;
--searchresults-header-fg: #666;
--searchresults-border-color: #888;
--searchresults-li-bg: #e4f2fe;
--search-mark-bg: #a2cff5;
--color-scheme: light;
}
.navy {
--bg: hsl(226, 23%, 11%);
--fg: #bcbdd0;
--sidebar-bg: #282d3f;
--sidebar-fg: #c8c9db;
--sidebar-non-existant: #505274;
--sidebar-active: #2b79a2;
--sidebar-spacer: #2d334f;
--scrollbar: var(--sidebar-fg);
--icons: #737480;
--icons-hover: #b7b9cc;
--links: #2b79a2;
--inline-code-color: #c5c8c6;
--theme-popup-bg: #161923;
--theme-popup-border: #737480;
--theme-hover: #282e40;
--quote-bg: hsl(226, 15%, 17%);
--quote-border: hsl(226, 15%, 22%);
--warning-border: #ff8e00;
--table-border-color: hsl(226, 23%, 16%);
--table-header-bg: hsl(226, 23%, 31%);
--table-alternate-bg: hsl(226, 23%, 14%);
--searchbar-border-color: #aaa;
--searchbar-bg: #aeaec6;
--searchbar-fg: #000;
--searchbar-shadow-color: #aaa;
--searchresults-header-fg: #5f5f71;
--searchresults-border-color: #5c5c68;
--searchresults-li-bg: #242430;
--search-mark-bg: #a2cff5;
--color-scheme: dark;
}
.rust {
--bg: hsl(60, 9%, 87%);
--fg: #262625;
--sidebar-bg: #3b2e2a;
--sidebar-fg: #c8c9db;
--sidebar-non-existant: #505254;
--sidebar-active: #e69f67;
--sidebar-spacer: #45373a;
--scrollbar: var(--sidebar-fg);
--icons: #737480;
--icons-hover: #262625;
--links: #2b79a2;
--inline-code-color: #6e6b5e;
--theme-popup-bg: #e1e1db;
--theme-popup-border: #b38f6b;
--theme-hover: #99908a;
--quote-bg: hsl(60, 5%, 75%);
--quote-border: hsl(60, 5%, 70%);
--warning-border: #ff8e00;
--table-border-color: hsl(60, 9%, 82%);
--table-header-bg: #b3a497;
--table-alternate-bg: hsl(60, 9%, 84%);
--searchbar-border-color: #aaa;
--searchbar-bg: #fafafa;
--searchbar-fg: #000;
--searchbar-shadow-color: #aaa;
--searchresults-header-fg: #666;
--searchresults-border-color: #888;
--searchresults-li-bg: #dec2a2;
--search-mark-bg: #e69f67;
--color-scheme: light;
}
@media (prefers-color-scheme: dark) {
.light.no-js {
--bg: hsl(200, 7%, 8%);
--fg: #98a3ad;
--sidebar-bg: #292c2f;
--sidebar-fg: #a1adb8;
--sidebar-non-existant: #505254;
--sidebar-active: #3473ad;
--sidebar-spacer: #393939;
--scrollbar: var(--sidebar-fg);
--icons: #43484d;
--icons-hover: #b3c0cc;
--links: #2b79a2;
--inline-code-color: #c5c8c6;
--theme-popup-bg: #141617;
--theme-popup-border: #43484d;
--theme-hover: #1f2124;
--quote-bg: hsl(234, 21%, 18%);
--quote-border: hsl(234, 21%, 23%);
--warning-border: #ff8e00;
--table-border-color: hsl(200, 7%, 13%);
--table-header-bg: hsl(200, 7%, 28%);
--table-alternate-bg: hsl(200, 7%, 11%);
--searchbar-border-color: #aaa;
--searchbar-bg: #b7b7b7;
--searchbar-fg: #000;
--searchbar-shadow-color: #aaa;
--searchresults-header-fg: #666;
--searchresults-border-color: #98a3ad;
--searchresults-li-bg: #2b2b2f;
--search-mark-bg: #355c7d;
}
}

10
elasticlunr.min.js vendored Normal file

File diff suppressed because one or more lines are too long

372
error_handling.html Normal file
View File

@ -0,0 +1,372 @@
<!DOCTYPE HTML>
<html lang="en" class="light" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>Errors and exceptions - Chronos</title>
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="open-in.css">
</head>
<body class="sidebar-visible no-js">
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('light')
html.classList.add(theme);
var body = document.querySelector('body');
body.classList.remove('no-js')
body.classList.add('js');
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var body = document.querySelector('body');
var sidebar = null;
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
body.classList.remove('sidebar-visible');
body.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="examples.html"><strong aria-hidden="true">2.</strong> Examples</a></li><li class="chapter-item expanded affix "><li class="part-title">User guide</li><li class="chapter-item expanded "><a href="concepts.html"><strong aria-hidden="true">3.</strong> Core concepts</a></li><li class="chapter-item expanded "><a href="async_procs.html"><strong aria-hidden="true">4.</strong> async functions</a></li><li class="chapter-item expanded "><a href="error_handling.html" class="active"><strong aria-hidden="true">5.</strong> Errors and exceptions</a></li><li class="chapter-item expanded "><a href="threads.html"><strong aria-hidden="true">6.</strong> Threads</a></li><li class="chapter-item expanded "><a href="tips.html"><strong aria-hidden="true">7.</strong> Tips, tricks and best practices</a></li><li class="chapter-item expanded "><a href="porting.html"><strong aria-hidden="true">8.</strong> Porting code to chronos</a></li><li class="chapter-item expanded "><a href="http_server_middleware.html"><strong aria-hidden="true">9.</strong> HTTP server middleware</a></li><li class="chapter-item expanded affix "><li class="part-title">Developer guide</li><li class="chapter-item expanded "><a href="book.html"><strong aria-hidden="true">10.</strong> Updating this book</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<!-- Track and set sidebar scroll position -->
<script>
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
sidebarScrollbox.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
sidebarScrollbox.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
</script>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Chronos</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/status-im/nim-chronos/" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h1 id="errors-and-exceptions"><a class="header" href="#errors-and-exceptions">Errors and exceptions</a></h1>
<ul>
<li><a href="#exceptions">Exceptions</a></li>
<li><a href="#checked-exceptions">Checked exceptions</a></li>
<li><a href="#the-exception-type">The <code>Exception</code> type</a></li>
<li><a href="#compatibility-modes">Compatibility modes</a></li>
</ul>
<h2 id="exceptions"><a class="header" href="#exceptions">Exceptions</a></h2>
<p>Exceptions inheriting from <a href="https://nim-lang.org/docs/system.html#CatchableError"><code>CatchableError</code></a>
interrupt execution of an <code>async</code> procedure. The exception is placed in the
<code>Future.error</code> field while changing the status of the <code>Future</code> to <code>Failed</code>
and callbacks are scheduled.</p>
<p>When a future is read or awaited the exception is re-raised, traversing the
<code>async</code> execution chain until handled.</p>
<pre><code class="language-nim">proc p1() {.async.} =
await sleepAsync(1.seconds)
raise newException(ValueError, &quot;ValueError inherits from CatchableError&quot;)
proc p2() {.async.} =
await sleepAsync(1.seconds)
proc p3() {.async.} =
let
fut1 = p1()
fut2 = p2()
await fut1
echo &quot;unreachable code here&quot;
await fut2
# `waitFor()` would call `Future.read()` unconditionally, which would raise the
# exception in `Future.error`.
let fut3 = p3()
while not(fut3.finished()):
poll()
echo &quot;fut3.state = &quot;, fut3.state # &quot;Failed&quot;
if fut3.failed():
echo &quot;p3() failed: &quot;, fut3.error.name, &quot;: &quot;, fut3.error.msg
# prints &quot;p3() failed: ValueError: ValueError inherits from CatchableError&quot;
</code></pre>
<p>You can put the <code>await</code> in a <code>try</code> block, to deal with that exception sooner:</p>
<pre><code class="language-nim">proc p3() {.async.} =
let
fut1 = p1()
fut2 = p2()
try:
await fut1
except CachableError:
echo &quot;p1() failed: &quot;, fut1.error.name, &quot;: &quot;, fut1.error.msg
echo &quot;reachable code here&quot;
await fut2
</code></pre>
<p>Because <code>chronos</code> ensures that all exceptions are re-routed to the <code>Future</code>,
<code>poll</code> will not itself raise exceptions.</p>
<p><code>poll</code> may still panic / raise <code>Defect</code> if such are raised in user code due to
undefined behavior.</p>
<h2 id="checked-exceptions"><a class="header" href="#checked-exceptions">Checked exceptions</a></h2>
<p>By specifying a <code>raises</code> list to an async procedure, you can check which
exceptions can be raised by it:</p>
<pre><code class="language-nim">proc p1(): Future[void] {.async: (raises: [IOError]).} =
assert not (compiles do: raise newException(ValueError, &quot;uh-uh&quot;))
raise newException(IOError, &quot;works&quot;) # Or any child of IOError
proc p2(): Future[void] {.async, (raises: [IOError]).} =
await p1() # Works, because await knows that p1
# can only raise IOError
</code></pre>
<p>Under the hood, the return type of <code>p1</code> will be rewritten to an internal type
which will convey raises informations to <code>await</code>.</p>
<pre><code class="language-admonition note">Most `async` include `CancelledError` in the list of `raises`, indicating that
the operation they implement might get cancelled resulting in neither value nor
error!
</code></pre>
<p>When using checked exceptions, the <code>Future</code> type is modified to include
<code>raises</code> information - it can be constructed with the <code>Raising</code> helper:</p>
<pre><code class="language-nim"># Create a variable of the type that will be returned by a an async function
# raising `[CancelledError]`:
var fut: Future[int].Raising([CancelledError])
</code></pre>
<pre><code class="language-admonition note">`Raising` creates a specialization of `InternalRaisesFuture` type - as the name
suggests, this is an internal type whose implementation details are likely to
change in future `chronos` versions.
</code></pre>
<h2 id="the-exception-type"><a class="header" href="#the-exception-type">The <code>Exception</code> type</a></h2>
<p>Exceptions deriving from <code>Exception</code> are not caught by default as these may
include <code>Defect</code> and other forms undefined or uncatchable behavior.</p>
<p>Because exception effect tracking is turned on for <code>async</code> functions, this may
sometimes lead to compile errors around forward declarations, methods and
closures as Nim conservatively asssumes that any <code>Exception</code> might be raised
from those.</p>
<p>Make sure to explicitly annotate these with <code>{.raises.}</code>:</p>
<pre><code class="language-nim"># Forward declarations need to explicitly include a raises list:
proc myfunction() {.raises: [ValueError].}
# ... as do `proc` types
type MyClosure = proc() {.raises: [ValueError].}
proc myfunction() =
raise (ref ValueError)(msg: &quot;Implementation here&quot;)
let closure: MyClosure = myfunction
</code></pre>
<h2 id="compatibility-modes"><a class="header" href="#compatibility-modes">Compatibility modes</a></h2>
<p><strong>Individual functions.</strong> For compatibility, <code>async</code> functions can be instructed
to handle <code>Exception</code> as well, specifying <code>handleException: true</code>. Any
<code>Exception</code> that is not a <code>Defect</code> and not a <code>CatchableError</code> will then be
caught and remapped to <code>AsyncExceptionError</code>:</p>
<pre><code class="language-nim">proc raiseException() {.async: (handleException: true, raises: [AsyncExceptionError]).} =
raise (ref Exception)(msg: &quot;Raising Exception is UB&quot;)
proc callRaiseException() {.async: (raises: []).} =
try:
await raiseException()
except AsyncExceptionError as exc:
# The original Exception is available from the `parent` field
echo exc.parent.msg
</code></pre>
<p><strong>Global flag.</strong> This mode can be enabled globally with
<code>-d:chronosHandleException</code> as a help when porting code to <code>chronos</code>. The
behavior in this case will be that:</p>
<ol>
<li>
<p>old-style functions annotated with plain <code>async</code> will behave as if they had
been annotated with <code>async: (handleException: true)</code>.</p>
<p>This is functionally equivalent to
<code>async: (handleException: true, raises: [CatchableError])</code> and will, as
before, remap any <code>Exception</code> that is not <code>Defect</code> into
<code>AsyncExceptionError</code>, while also allowing any <code>CatchableError</code> (including
<code>AsyncExceptionError</code>) to get through without compilation errors.</p>
</li>
<li>
<p>New-style functions with <code>async: (raises: [...])</code> annotations or their own
<code>handleException</code> annotations will not be affected.</p>
</li>
</ol>
<p>The rationale here is to allow one to incrementally introduce exception
annotations and get compiler feedback while not requiring that every bit of
legacy code is updated at once.</p>
<p>This should be used sparingly and with care, however, as global configuration
settings may interfere with libraries that use <code>chronos</code> leading to unexpected
behavior.</p>
<footer id="open-on-gh">Found a bug? <a href="https://github.com/status-im/nim-chronos//edit/master/docs/src/error_handling.md">Edit this page on GitHub.</a></footer>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="async_procs.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="threads.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="async_procs.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="threads.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script>
window.playground_copyable = true;
</script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>

253
examples.html Normal file
View File

@ -0,0 +1,253 @@
<!DOCTYPE HTML>
<html lang="en" class="light" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>Examples - Chronos</title>
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="open-in.css">
</head>
<body class="sidebar-visible no-js">
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('light')
html.classList.add(theme);
var body = document.querySelector('body');
body.classList.remove('no-js')
body.classList.add('js');
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var body = document.querySelector('body');
var sidebar = null;
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
body.classList.remove('sidebar-visible');
body.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="examples.html" class="active"><strong aria-hidden="true">2.</strong> Examples</a></li><li class="chapter-item expanded affix "><li class="part-title">User guide</li><li class="chapter-item expanded "><a href="concepts.html"><strong aria-hidden="true">3.</strong> Core concepts</a></li><li class="chapter-item expanded "><a href="async_procs.html"><strong aria-hidden="true">4.</strong> async functions</a></li><li class="chapter-item expanded "><a href="error_handling.html"><strong aria-hidden="true">5.</strong> Errors and exceptions</a></li><li class="chapter-item expanded "><a href="threads.html"><strong aria-hidden="true">6.</strong> Threads</a></li><li class="chapter-item expanded "><a href="tips.html"><strong aria-hidden="true">7.</strong> Tips, tricks and best practices</a></li><li class="chapter-item expanded "><a href="porting.html"><strong aria-hidden="true">8.</strong> Porting code to chronos</a></li><li class="chapter-item expanded "><a href="http_server_middleware.html"><strong aria-hidden="true">9.</strong> HTTP server middleware</a></li><li class="chapter-item expanded affix "><li class="part-title">Developer guide</li><li class="chapter-item expanded "><a href="book.html"><strong aria-hidden="true">10.</strong> Updating this book</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<!-- Track and set sidebar scroll position -->
<script>
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
sidebarScrollbox.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
sidebarScrollbox.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
</script>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Chronos</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/status-im/nim-chronos/" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h1 id="examples"><a class="header" href="#examples">Examples</a></h1>
<p>Examples are available in the <a href="https://github.com/status-im/nim-chronos/tree/master/docs/examples/"><code>docs/examples/</code></a> folder.</p>
<h2 id="basic-concepts"><a class="header" href="#basic-concepts">Basic concepts</a></h2>
<ul>
<li><a href="https://github.com/status-im/nim-chronos/tree/master/docs/examples/cancellation.nim">cancellation</a> - Cancellation primer</li>
<li><a href="https://github.com/status-im/nim-chronos/tree/master/docs/examples/timeoutsimple.nim">timeoutsimple</a> - Simple timeouts</li>
<li><a href="https://github.com/status-im/nim-chronos/tree/master/docs/examples/examples/timeoutcomposed.nim">timeoutcomposed</a> - Shared timeout of multiple tasks</li>
</ul>
<h2 id="threads"><a class="header" href="#threads">Threads</a></h2>
<ul>
<li><a href="https://github.com/status-im/nim-chronos/tree/master/docs/examples/signalling.nim">signalling</a> - Cross-thread signalling</li>
</ul>
<h2 id="tcp"><a class="header" href="#tcp">TCP</a></h2>
<ul>
<li><a href="https://github.com/status-im/nim-chronos/tree/master/docs/examples/tcpserver.nim">tcpserver</a> - Simple TCP/IP v4/v6 echo server</li>
</ul>
<h2 id="http"><a class="header" href="#http">HTTP</a></h2>
<ul>
<li><a href="https://github.com/status-im/nim-chronos/tree/master/docs/examples/httpget.nim">httpget</a> - Downloading a web page using the http client</li>
<li><a href="https://github.com/status-im/nim-chronos/tree/master/docs/examples/twogets.nim">twogets</a> - Download two pages concurrently</li>
<li><a href="https://github.com/status-im/nim-chronos/tree/master/docs/examples/middleware.nim">middleware</a> - Deploy multiple HTTP server middlewares</li>
</ul>
<footer id="open-on-gh">Found a bug? <a href="https://github.com/status-im/nim-chronos//edit/master/docs/src/examples.md">Edit this page on GitHub.</a></footer>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="introduction.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="concepts.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="introduction.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="concepts.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script>
window.playground_copyable = true;
</script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>

BIN
favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

22
favicon.svg Normal file
View File

@ -0,0 +1,22 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 199.7 184.2">
<style>
@media (prefers-color-scheme: dark) {
svg { fill: white; }
}
</style>
<path d="M189.5,36.8c0.2,2.8,0,5.1-0.6,6.8L153,162c-0.6,2.1-2,3.7-4.2,5c-2.2,1.2-4.4,1.9-6.7,1.9H31.4c-9.6,0-15.3-2.8-17.3-8.4
c-0.8-2.2-0.8-3.9,0.1-5.2c0.9-1.2,2.4-1.8,4.6-1.8H123c7.4,0,12.6-1.4,15.4-4.1s5.7-8.9,8.6-18.4l32.9-108.6
c1.8-5.9,1-11.1-2.2-15.6S169.9,0,164,0H72.7c-1,0-3.1,0.4-6.1,1.1l0.1-0.4C64.5,0.2,62.6,0,61,0.1s-3,0.5-4.3,1.4
c-1.3,0.9-2.4,1.8-3.2,2.8S52,6.5,51.2,8.1c-0.8,1.6-1.4,3-1.9,4.3s-1.1,2.7-1.8,4.2c-0.7,1.5-1.3,2.7-2,3.7c-0.5,0.6-1.2,1.5-2,2.5
s-1.6,2-2.2,2.8s-0.9,1.5-1.1,2.2c-0.2,0.7-0.1,1.8,0.2,3.2c0.3,1.4,0.4,2.4,0.4,3.1c-0.3,3-1.4,6.9-3.3,11.6
c-1.9,4.7-3.6,8.1-5.1,10.1c-0.3,0.4-1.2,1.3-2.6,2.7c-1.4,1.4-2.3,2.6-2.6,3.7c-0.3,0.4-0.3,1.5-0.1,3.4c0.3,1.8,0.4,3.1,0.3,3.8
c-0.3,2.7-1.3,6.3-3,10.8c-1.7,4.5-3.4,8.2-5,11c-0.2,0.5-0.9,1.4-2,2.8c-1.1,1.4-1.8,2.5-2,3.4c-0.2,0.6-0.1,1.8,0.1,3.4
c0.2,1.6,0.2,2.8-0.1,3.6c-0.6,3-1.8,6.7-3.6,11c-1.8,4.3-3.6,7.9-5.4,11c-0.5,0.8-1.1,1.7-2,2.8c-0.8,1.1-1.5,2-2,2.8
s-0.8,1.6-1,2.5c-0.1,0.5,0,1.3,0.4,2.3c0.3,1.1,0.4,1.9,0.4,2.6c-0.1,1.1-0.2,2.6-0.5,4.4c-0.2,1.8-0.4,2.9-0.4,3.2
c-1.8,4.8-1.7,9.9,0.2,15.2c2.2,6.2,6.2,11.5,11.9,15.8c5.7,4.3,11.7,6.4,17.8,6.4h110.7c5.2,0,10.1-1.7,14.7-5.2s7.7-7.8,9.2-12.9
l33-108.6c1.8-5.8,1-10.9-2.2-15.5C194.9,39.7,192.6,38,189.5,36.8z M59.6,122.8L73.8,80c0,0,7,0,10.8,0s28.8-1.7,25.4,17.5
c-3.4,19.2-18.8,25.2-36.8,25.4S59.6,122.8,59.6,122.8z M78.6,116.8c4.7-0.1,18.9-2.9,22.1-17.1S89.2,86.3,89.2,86.3l-8.9,0
l-10.2,30.5C70.2,116.9,74,116.9,78.6,116.8z M75.3,68.7L89,26.2h9.8l0.8,34l23.6-34h9.9l-13.6,42.5h-7.1l12.5-35.4l-24.5,35.4h-6.8
l-0.8-35L82,68.7H75.3z"/>
</svg>
<!-- Original image Copyright Dave Gandy — CC BY 4.0 License -->

After

Width:  |  Height:  |  Size: 1.8 KiB

202
fonts/OPEN-SANS-LICENSE.txt Normal file
View File

@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -0,0 +1,93 @@
Copyright 2010, 2012 Adobe Systems Incorporated (http://www.adobe.com/), with Reserved Font Name 'Source'. All Rights Reserved. Source is a trademark of Adobe Systems Incorporated in the United States and/or other countries.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

100
fonts/fonts.css Normal file
View File

@ -0,0 +1,100 @@
/* Open Sans is licensed under the Apache License, Version 2.0. See http://www.apache.org/licenses/LICENSE-2.0 */
/* Source Code Pro is under the Open Font License. See https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL */
/* open-sans-300 - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 300;
src: local('Open Sans Light'), local('OpenSans-Light'),
url('open-sans-v17-all-charsets-300.woff2') format('woff2');
}
/* open-sans-300italic - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 300;
src: local('Open Sans Light Italic'), local('OpenSans-LightItalic'),
url('open-sans-v17-all-charsets-300italic.woff2') format('woff2');
}
/* open-sans-regular - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: local('Open Sans Regular'), local('OpenSans-Regular'),
url('open-sans-v17-all-charsets-regular.woff2') format('woff2');
}
/* open-sans-italic - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 400;
src: local('Open Sans Italic'), local('OpenSans-Italic'),
url('open-sans-v17-all-charsets-italic.woff2') format('woff2');
}
/* open-sans-600 - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 600;
src: local('Open Sans SemiBold'), local('OpenSans-SemiBold'),
url('open-sans-v17-all-charsets-600.woff2') format('woff2');
}
/* open-sans-600italic - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 600;
src: local('Open Sans SemiBold Italic'), local('OpenSans-SemiBoldItalic'),
url('open-sans-v17-all-charsets-600italic.woff2') format('woff2');
}
/* open-sans-700 - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 700;
src: local('Open Sans Bold'), local('OpenSans-Bold'),
url('open-sans-v17-all-charsets-700.woff2') format('woff2');
}
/* open-sans-700italic - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 700;
src: local('Open Sans Bold Italic'), local('OpenSans-BoldItalic'),
url('open-sans-v17-all-charsets-700italic.woff2') format('woff2');
}
/* open-sans-800 - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 800;
src: local('Open Sans ExtraBold'), local('OpenSans-ExtraBold'),
url('open-sans-v17-all-charsets-800.woff2') format('woff2');
}
/* open-sans-800italic - latin_vietnamese_latin-ext_greek-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Open Sans';
font-style: italic;
font-weight: 800;
src: local('Open Sans ExtraBold Italic'), local('OpenSans-ExtraBoldItalic'),
url('open-sans-v17-all-charsets-800italic.woff2') format('woff2');
}
/* source-code-pro-500 - latin_vietnamese_latin-ext_greek_cyrillic-ext_cyrillic */
@font-face {
font-family: 'Source Code Pro';
font-style: normal;
font-weight: 500;
src: url('source-code-pro-v11-all-charsets-500.woff2') format('woff2');
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

82
highlight.css Normal file
View File

@ -0,0 +1,82 @@
/*
* An increased contrast highlighting scheme loosely based on the
* "Base16 Atelier Dune Light" theme by Bram de Haan
* (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/dune)
* Original Base16 color scheme by Chris Kempson
* (https://github.com/chriskempson/base16)
*/
/* Comment */
.hljs-comment,
.hljs-quote {
color: #575757;
}
/* Red */
.hljs-variable,
.hljs-template-variable,
.hljs-attribute,
.hljs-tag,
.hljs-name,
.hljs-regexp,
.hljs-link,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class {
color: #d70025;
}
/* Orange */
.hljs-number,
.hljs-meta,
.hljs-built_in,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-params {
color: #b21e00;
}
/* Green */
.hljs-string,
.hljs-symbol,
.hljs-bullet {
color: #008200;
}
/* Blue */
.hljs-title,
.hljs-section {
color: #0030f2;
}
/* Purple */
.hljs-keyword,
.hljs-selector-tag {
color: #9d00ec;
}
.hljs {
display: block;
overflow-x: auto;
background: #f6f7f6;
color: #000;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
.hljs-addition {
color: #22863a;
background-color: #f0fff4;
}
.hljs-deletion {
color: #b31d28;
background-color: #ffeef0;
}

53
highlight.js Normal file

File diff suppressed because one or more lines are too long

312
http_server_middleware.html Normal file
View File

@ -0,0 +1,312 @@
<!DOCTYPE HTML>
<html lang="en" class="light" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>HTTP server middleware - Chronos</title>
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="open-in.css">
</head>
<body class="sidebar-visible no-js">
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('light')
html.classList.add(theme);
var body = document.querySelector('body');
body.classList.remove('no-js')
body.classList.add('js');
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var body = document.querySelector('body');
var sidebar = null;
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
body.classList.remove('sidebar-visible');
body.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="examples.html"><strong aria-hidden="true">2.</strong> Examples</a></li><li class="chapter-item expanded affix "><li class="part-title">User guide</li><li class="chapter-item expanded "><a href="concepts.html"><strong aria-hidden="true">3.</strong> Core concepts</a></li><li class="chapter-item expanded "><a href="async_procs.html"><strong aria-hidden="true">4.</strong> async functions</a></li><li class="chapter-item expanded "><a href="error_handling.html"><strong aria-hidden="true">5.</strong> Errors and exceptions</a></li><li class="chapter-item expanded "><a href="threads.html"><strong aria-hidden="true">6.</strong> Threads</a></li><li class="chapter-item expanded "><a href="tips.html"><strong aria-hidden="true">7.</strong> Tips, tricks and best practices</a></li><li class="chapter-item expanded "><a href="porting.html"><strong aria-hidden="true">8.</strong> Porting code to chronos</a></li><li class="chapter-item expanded "><a href="http_server_middleware.html" class="active"><strong aria-hidden="true">9.</strong> HTTP server middleware</a></li><li class="chapter-item expanded affix "><li class="part-title">Developer guide</li><li class="chapter-item expanded "><a href="book.html"><strong aria-hidden="true">10.</strong> Updating this book</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<!-- Track and set sidebar scroll position -->
<script>
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
sidebarScrollbox.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
sidebarScrollbox.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
</script>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Chronos</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/status-im/nim-chronos/" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h2 id="http-server-middleware"><a class="header" href="#http-server-middleware">HTTP server middleware</a></h2>
<p>Chronos provides a powerful mechanism for customizing HTTP request handlers via
middlewares.</p>
<p>A middleware is a coroutine that can modify, block or filter HTTP request.</p>
<p>Single HTTP server could support unlimited number of middlewares, but you need to consider that each request in worst case could go through all the middlewares, and therefore a huge number of middlewares can have a significant impact on HTTP server performance.</p>
<p>Order of middlewares is also important: right after HTTP server has received request, it will be sent to the first middleware in list, and each middleware will be responsible for passing control to other middlewares. Therefore, when building a list, it would be a good idea to place the request handlers at the end of the list, while keeping the middleware that could block or modify the request at the beginning of the list.</p>
<p>Middleware could also modify HTTP server request, and these changes will be visible to all handlers (either middlewares or the original request handler). This can be done using the following helpers:</p>
<pre><code class="language-nim"> proc updateRequest*(request: HttpRequestRef, scheme: string, meth: HttpMethod,
version: HttpVersion, requestUri: string,
headers: HttpTable): HttpResultMessage[void]
proc updateRequest*(request: HttpRequestRef, meth: HttpMethod,
requestUri: string,
headers: HttpTable): HttpResultMessage[void]
proc updateRequest*(request: HttpRequestRef, requestUri: string,
headers: HttpTable): HttpResultMessage[void]
proc updateRequest*(request: HttpRequestRef,
requestUri: string): HttpResultMessage[void]
proc updateRequest*(request: HttpRequestRef,
headers: HttpTable): HttpResultMessage[void]
</code></pre>
<p>As you can see all the HTTP request parameters could be modified: request method, version, request path and request headers.</p>
<p>Middleware could also use helpers to obtain more information about remote and local addresses of request's connection (this could be helpful when you need to do some IP address filtering).</p>
<pre><code class="language-nim"> proc remote*(request: HttpRequestRef): Opt[TransportAddress]
## Returns remote address of HTTP request's connection.
proc local*(request: HttpRequestRef): Opt[TransportAddress] =
## Returns local address of HTTP request's connection.
</code></pre>
<p>Every middleware is the coroutine which looks like this:</p>
<pre><code class="language-nim"> proc middlewareHandler(
middleware: HttpServerMiddlewareRef,
reqfence: RequestFence,
nextHandler: HttpProcessCallback2
): Future[HttpResponseRef] {.async: (raises: [CancelledError]).} =
</code></pre>
<p>Where <code>middleware</code> argument is the object which could hold some specific values, <code>reqfence</code> is HTTP request which is enclosed with HTTP server error information and <code>nextHandler</code> is reference to next request handler, it could be either middleware handler or the original request processing callback handler.</p>
<pre><code class="language-nim"> await nextHandler(reqfence)
</code></pre>
<p>You should perform await for the response from the <code>nextHandler(reqfence)</code>. Usually you should call next handler when you dont want to handle request or you dont know how to handle it, for example:</p>
<pre><code class="language-nim"> proc middlewareHandler(
middleware: HttpServerMiddlewareRef,
reqfence: RequestFence,
nextHandler: HttpProcessCallback2
): Future[HttpResponseRef] {.async: (raises: [CancelledError]).} =
if reqfence.isErr():
# We dont know or do not want to handle failed requests, so we call next handler.
return await nextHandler(reqfence)
let request = reqfence.get()
if request.uri.path == &quot;/path/we/able/to/respond&quot;:
try:
# Sending some response.
await request.respond(Http200, &quot;TEST&quot;)
except HttpWriteError as exc:
# We could also return default response for exception or other types of error.
defaultResponse(exc)
elif request.uri.path == &quot;/path/for/rewrite&quot;:
# We going to modify request object for this request, next handler will receive it with different request path.
let res = request.updateRequest(&quot;/path/to/new/location&quot;)
if res.isErr():
return defaultResponse(res.error)
await nextHandler(reqfence)
elif request.uri.path == &quot;/restricted/path&quot;:
if request.remote().isNone():
# We can't obtain remote address, so we force HTTP server to respond with `401 Unauthorized` status code.
return codeResponse(Http401)
if $(request.remote().get()).startsWith(&quot;127.0.0.1&quot;):
# Remote peer's address starts with &quot;127.0.0.1&quot;, sending proper response.
await request.respond(Http200, &quot;AUTHORIZED&quot;)
else:
# Force HTTP server to respond with `403 Forbidden` status code.
codeResponse(Http403)
elif request.uri.path == &quot;/blackhole&quot;:
# Force HTTP server to drop connection with remote peer.
dropResponse()
else:
# All other requests should be handled by somebody else.
await nextHandler(reqfence)
</code></pre>
<footer id="open-on-gh">Found a bug? <a href="https://github.com/status-im/nim-chronos//edit/master/docs/src/http_server_middleware.md">Edit this page on GitHub.</a></footer>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="porting.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="book.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="porting.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="book.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script>
window.playground_copyable = true;
</script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>

274
index.html Normal file
View File

@ -0,0 +1,274 @@
<!DOCTYPE HTML>
<html lang="en" class="light" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>Introduction - Chronos</title>
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="open-in.css">
</head>
<body class="sidebar-visible no-js">
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('light')
html.classList.add(theme);
var body = document.querySelector('body');
body.classList.remove('no-js')
body.classList.add('js');
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var body = document.querySelector('body');
var sidebar = null;
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
body.classList.remove('sidebar-visible');
body.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html" class="active"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="examples.html"><strong aria-hidden="true">2.</strong> Examples</a></li><li class="chapter-item expanded affix "><li class="part-title">User guide</li><li class="chapter-item expanded "><a href="concepts.html"><strong aria-hidden="true">3.</strong> Core concepts</a></li><li class="chapter-item expanded "><a href="async_procs.html"><strong aria-hidden="true">4.</strong> async functions</a></li><li class="chapter-item expanded "><a href="error_handling.html"><strong aria-hidden="true">5.</strong> Errors and exceptions</a></li><li class="chapter-item expanded "><a href="threads.html"><strong aria-hidden="true">6.</strong> Threads</a></li><li class="chapter-item expanded "><a href="tips.html"><strong aria-hidden="true">7.</strong> Tips, tricks and best practices</a></li><li class="chapter-item expanded "><a href="porting.html"><strong aria-hidden="true">8.</strong> Porting code to chronos</a></li><li class="chapter-item expanded "><a href="http_server_middleware.html"><strong aria-hidden="true">9.</strong> HTTP server middleware</a></li><li class="chapter-item expanded affix "><li class="part-title">Developer guide</li><li class="chapter-item expanded "><a href="book.html"><strong aria-hidden="true">10.</strong> Updating this book</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<!-- Track and set sidebar scroll position -->
<script>
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
sidebarScrollbox.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
sidebarScrollbox.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
</script>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Chronos</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/status-im/nim-chronos/" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h1 id="introduction"><a class="header" href="#introduction">Introduction</a></h1>
<p>Chronos implements the <a href="https://en.wikipedia.org/wiki/Async/await">async/await</a>
paradigm in a self-contained library using macro and closure iterator
transformation features provided by Nim.</p>
<p>Features include:</p>
<ul>
<li>Asynchronous socket and process I/O</li>
<li>HTTP client / server with SSL/TLS support out of the box (no OpenSSL needed)</li>
<li>Synchronization primitivies like queues, events and locks</li>
<li><a href="./concepts.html#cancellation">Cancellation</a></li>
<li>Efficient dispatch pipeline with excellent multi-platform support</li>
<li>Exception <a href="./guide.html#error-handling">effect support</a></li>
</ul>
<h2 id="installation"><a class="header" href="#installation">Installation</a></h2>
<p>Install <code>chronos</code> using <code>nimble</code>:</p>
<pre><code class="language-text">nimble install chronos
</code></pre>
<p>or add a dependency to your <code>.nimble</code> file:</p>
<pre><code class="language-text">requires &quot;chronos&quot;
</code></pre>
<p>and start using it:</p>
<pre><code class="language-nim">import chronos/apps/http/httpclient
proc retrievePage*(uri: string): Future[string] {.async.} =
# Create a new HTTP session
let httpSession = HttpSessionRef.new()
try:
# Fetch page contents
let resp = await httpSession.fetch(parseUri(uri))
# Convert response to a string, assuming its encoding matches the terminal!
bytesToString(resp.data)
finally: # Close the session
await noCancel(httpSession.closeWait())
echo waitFor retrievePage(
&quot;https://raw.githubusercontent.com/status-im/nim-chronos/master/README.md&quot;)
</code></pre>
<p>There are more <a href="./examples.html">examples</a> throughout the manual!</p>
<h2 id="platform-support"><a class="header" href="#platform-support">Platform support</a></h2>
<p>Several platforms are supported, with different backend <a href="./concepts.html#compile-time-configuration">options</a>:</p>
<ul>
<li>Windows: <a href="https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports"><code>IOCP</code></a></li>
<li>Linux: <a href="https://en.wikipedia.org/wiki/Epoll"><code>epoll</code></a> / <code>poll</code></li>
<li>OSX / BSD: <a href="https://en.wikipedia.org/wiki/Kqueue"><code>kqueue</code></a> / <code>poll</code></li>
<li>Android / Emscripten / posix: <code>poll</code></li>
</ul>
<h2 id="api-documentation"><a class="header" href="#api-documentation">API documentation</a></h2>
<p>This guide covers basic usage of chronos - for details, see the
<a href="./api/chronos.html">API reference</a>.</p>
<footer id="open-on-gh">Found a bug? <a href="https://github.com/status-im/nim-chronos//edit/master/docs/src/introduction.md">Edit this page on GitHub.</a></footer>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="next prefetch" href="examples.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="next prefetch" href="examples.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script>
window.playground_copyable = true;
</script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>

274
introduction.html Normal file
View File

@ -0,0 +1,274 @@
<!DOCTYPE HTML>
<html lang="en" class="light" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>Introduction - Chronos</title>
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="favicon.svg">
<link rel="shortcut icon" href="favicon.png">
<link rel="stylesheet" href="css/variables.css">
<link rel="stylesheet" href="css/general.css">
<link rel="stylesheet" href="css/chrome.css">
<link rel="stylesheet" href="css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" href="highlight.css">
<link rel="stylesheet" href="tomorrow-night.css">
<link rel="stylesheet" href="ayu-highlight.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="open-in.css">
</head>
<body class="sidebar-visible no-js">
<div id="body-container">
<!-- Provide site root to javascript -->
<script>
var path_to_root = "";
var default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? "navy" : "light";
</script>
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
var theme = localStorage.getItem('mdbook-theme');
var sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
var theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
var html = document.querySelector('html');
html.classList.remove('light')
html.classList.add(theme);
var body = document.querySelector('body');
body.classList.remove('no-js')
body.classList.add('js');
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
var body = document.querySelector('body');
var sidebar = null;
var sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
body.classList.remove('sidebar-visible');
body.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<div class="sidebar-scrollbox">
<ol class="chapter"><li class="chapter-item expanded "><a href="introduction.html" class="active"><strong aria-hidden="true">1.</strong> Introduction</a></li><li class="chapter-item expanded "><a href="examples.html"><strong aria-hidden="true">2.</strong> Examples</a></li><li class="chapter-item expanded affix "><li class="part-title">User guide</li><li class="chapter-item expanded "><a href="concepts.html"><strong aria-hidden="true">3.</strong> Core concepts</a></li><li class="chapter-item expanded "><a href="async_procs.html"><strong aria-hidden="true">4.</strong> async functions</a></li><li class="chapter-item expanded "><a href="error_handling.html"><strong aria-hidden="true">5.</strong> Errors and exceptions</a></li><li class="chapter-item expanded "><a href="threads.html"><strong aria-hidden="true">6.</strong> Threads</a></li><li class="chapter-item expanded "><a href="tips.html"><strong aria-hidden="true">7.</strong> Tips, tricks and best practices</a></li><li class="chapter-item expanded "><a href="porting.html"><strong aria-hidden="true">8.</strong> Porting code to chronos</a></li><li class="chapter-item expanded "><a href="http_server_middleware.html"><strong aria-hidden="true">9.</strong> HTTP server middleware</a></li><li class="chapter-item expanded affix "><li class="part-title">Developer guide</li><li class="chapter-item expanded "><a href="book.html"><strong aria-hidden="true">10.</strong> Updating this book</a></li></ol>
</div>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<!-- Track and set sidebar scroll position -->
<script>
var sidebarScrollbox = document.querySelector('#sidebar .sidebar-scrollbox');
sidebarScrollbox.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', sidebarScrollbox.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
sidebarScrollbox.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
</script>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search. (Shortkey: s)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="S" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">Chronos</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://github.com/status-im/nim-chronos/" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h1 id="introduction"><a class="header" href="#introduction">Introduction</a></h1>
<p>Chronos implements the <a href="https://en.wikipedia.org/wiki/Async/await">async/await</a>
paradigm in a self-contained library using macro and closure iterator
transformation features provided by Nim.</p>
<p>Features include:</p>
<ul>
<li>Asynchronous socket and process I/O</li>
<li>HTTP client / server with SSL/TLS support out of the box (no OpenSSL needed)</li>
<li>Synchronization primitivies like queues, events and locks</li>
<li><a href="./concepts.html#cancellation">Cancellation</a></li>
<li>Efficient dispatch pipeline with excellent multi-platform support</li>
<li>Exception <a href="./guide.html#error-handling">effect support</a></li>
</ul>
<h2 id="installation"><a class="header" href="#installation">Installation</a></h2>
<p>Install <code>chronos</code> using <code>nimble</code>:</p>
<pre><code class="language-text">nimble install chronos
</code></pre>
<p>or add a dependency to your <code>.nimble</code> file:</p>
<pre><code class="language-text">requires &quot;chronos&quot;
</code></pre>
<p>and start using it:</p>
<pre><code class="language-nim">import chronos/apps/http/httpclient
proc retrievePage*(uri: string): Future[string] {.async.} =
# Create a new HTTP session
let httpSession = HttpSessionRef.new()
try:
# Fetch page contents
let resp = await httpSession.fetch(parseUri(uri))
# Convert response to a string, assuming its encoding matches the terminal!
bytesToString(resp.data)
finally: # Close the session
await noCancel(httpSession.closeWait())
echo waitFor retrievePage(
&quot;https://raw.githubusercontent.com/status-im/nim-chronos/master/README.md&quot;)
</code></pre>
<p>There are more <a href="./examples.html">examples</a> throughout the manual!</p>
<h2 id="platform-support"><a class="header" href="#platform-support">Platform support</a></h2>
<p>Several platforms are supported, with different backend <a href="./concepts.html#compile-time-configuration">options</a>:</p>
<ul>
<li>Windows: <a href="https://learn.microsoft.com/en-us/windows/win32/fileio/i-o-completion-ports"><code>IOCP</code></a></li>
<li>Linux: <a href="https://en.wikipedia.org/wiki/Epoll"><code>epoll</code></a> / <code>poll</code></li>
<li>OSX / BSD: <a href="https://en.wikipedia.org/wiki/Kqueue"><code>kqueue</code></a> / <code>poll</code></li>
<li>Android / Emscripten / posix: <code>poll</code></li>
</ul>
<h2 id="api-documentation"><a class="header" href="#api-documentation">API documentation</a></h2>
<p>This guide covers basic usage of chronos - for details, see the
<a href="./api/chronos.html">API reference</a>.</p>
<footer id="open-on-gh">Found a bug? <a href="https://github.com/status-im/nim-chronos//edit/master/docs/src/introduction.md">Edit this page on GitHub.</a></footer>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="next prefetch" href="examples.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="next prefetch" href="examples.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script>
window.playground_copyable = true;
</script>
<script src="elasticlunr.min.js"></script>
<script src="mark.min.js"></script>
<script src="searcher.js"></script>
<script src="clipboard.min.js"></script>
<script src="highlight.js"></script>
<script src="book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>

7
mark.min.js vendored Normal file

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More