autodoc.git / traditional_manual / chapter_9.html

version» Context lines:

autodoc.git/traditional_manual/chapter_9.html:4617:    copy.</p>   </dd>   <dt class='head--doc'>Note</dt>   <dd class='body--doc'><p>The "avoid copy" part means that a Buffer will never shrink    unless you call the <code>trim</code> function.</p>   </dd></dl>      <hr />   <dl class='group--doc'>   <dt class='head--type'><span class='homogen--type'>Method</span> - <span class='homogen--name'><b>__fd_set_output</b></span> + <span class='homogen--name'><b>__set_on_write</b></span>   </dt> - <dd><p><code><code class='datatype'>int</code> <b><span class='method'>__fd_set_output</span>(</b><code class='datatype'>object</code>|<code class='datatype'>function</code>(<code class='datatype'>string</code>:<code class='datatype'>int</code>) <code class='argument'>write_callback</code><b>)</b></code></p></dd> + <dd><p><code><code class='datatype'>void</code> <b><span class='method'>__set_on_write</span>(</b><code class='datatype'>function</code>(:<code class='datatype void'>void</code>) <code class='argument'>write_callback</code><b>)</b></code></p></dd>      <dt class='head--doc'>Description</dt>   <dd class='body--doc'><p>This tells the buffer to trigger the write callback for the -  specified filedescriptor when data is added to the buffer.</p> - <p> This is used internally by Stdio.File to handle nonblocking -  buffered mode, and is not really intended to be used directly.</p> - <p> If <code>write_callback</code> is <code class='expr'>0</code> (zero) the state is cleared.</p> +  specified file descriptor when data is added to the buffer.</p> + </dd> + <dt class='head--doc'>Note</dt> + <dd class='body--doc'><p>This is used internally by <code>Stdio.File</code> and <code>SSL.File</code> to +  handle nonblocking buffered mode, and is not necessarily +  intended to be used directly by anything but implementations +  of File or Stream like programs. Do not use this yourself +  on buffers with Files or Streams in buffer modes.</p>   </dd></dl>         <hr />   <dl class='group--doc'>   <dt class='head--type'><span class='homogen--type'>Method</span>   <span class='homogen--name'><b>_encode</b></span><br>   <span class='homogen--type'>Method</span>   <span class='homogen--name'><b>_decode</b></span><br>   </dt>
autodoc.git/traditional_manual/chapter_9.html:5127:   </table>   </dd>   <dt class='head--doc'><span id='p-nbytes'></span>Parameter <code class='parameter'>nbytes</code></dt>   <dd></dd><dd class='body--doc'><p>If <code>nbytes</code> is not specified the whole buffer will be written    if possible. Otherwise at most <code>nbytes</code> will be written.</p>   </dd>   <dt class='head--doc'>Returns</dt>   <dd class='body--doc'><p>Will return the number of bytes that have been written successfully.</p>   <p> If no bytes have been written successfully and <code class='expr'>fun()</code> failed    with an error, <code class='expr'>-1</code> will be returned.</p> + </dd> + <dt class='head--doc'>Deprecated</dt> + <dd class='body--doc'><p>This function is going to get deprecated. In case you want to use +  it against an <code>Stdio.File</code> like object, please consider using +  the <code class='expr'>f-&gt;write(buf)</code> API. If you want to use it against a custom +  write function, please consider supporting the <code class='expr'>f-&gt;write(buf)</code> +  API in it.</p>   </dd></dl>         <hr />   <dl class='group--doc'>   <dt class='head--type'><span class='homogen--type'>Method</span>   <span class='homogen--name'><b>range_error</b></span>   </dt>   <dd><p><code><code class='modifier'>protected</code> <code class='object unresolved'>bool</code> <b><span class='method'>range_error</span>(</b><code class='datatype'>int</code> <code class='argument'>howmuch</code><b>)</b></code></p></dd>   
autodoc.git/traditional_manual/chapter_9.html:5639:      <dt class='head--doc'>Description</dt>   <dd class='body--doc'><p>Truncates the buffer to a length of <code>n</code> bytes.</p>   <p> Returns -1 on error and the number of bytes removed otherwise.</p>   </dd></dl>         <hr />   <dl class='group--doc'>   <dt class='head--type'><span class='homogen--type'>Method</span> - <span class='homogen--name'><b>try_output</b></span> - </dt> - <dd><p><code><code class='datatype'>int(-1..)</code> <b><span class='method'>try_output</span>(</b><b>)</b></code></p></dd> -  - <dt class='head--doc'>Description</dt> - <dd class='body--doc'><p>Try to write some data from the buffer to the file -  registered with <code>__fd_set_output()</code>.</p> - <p> This is typically called from backend callbacks when it -  seems that it is possible to write some data to the file.</p> - </dd> - <dt class='head--doc'>Returns</dt> - <dd class='body--doc'><p>Returns <code class='expr'>-1</code> on write error, and otherwise -  the number of bytes written to the file.</p> - </dd> - <dt class='head--doc'>See also</dt> - <dd class='body--doc'><p><code>__fd_set_output()</code></p> - </dd></dl> -  -  - <hr /> - <dl class='group--doc'> - <dt class='head--type'><span class='homogen--type'>Method</span> +    <span class='homogen--name'><b>try_read</b></span>   </dt>   <dd><p><code><code class='datatype'>string(8bit)</code> <b><span class='method'>try_read</span>(</b><code class='datatype'>int</code> <code class='argument'>len</code><b>)</b></code></p></dd>      <dt class='head--doc'>Description</dt>   <dd class='body--doc'><p>Attempt to read some data from the buffer.</p>   </dd>   <dt class='head--doc'><span id='p-len'></span>Parameter <code class='parameter'>len</code></dt>   <dd></dd><dd class='body--doc'><p>Read at most <code>len</code> bytes from the buffer.</p>   </dd>