c5180656cc
Steps to building docs locally: 1. Install Jekyll 2. cd docs 3. bundle exec jekyll serve --incremental 4. open local docs site at http://127.0.0.1:4000/ * basic Jekyll site * Add docs to documentation site * Update javadoc to allow for error free builds * Remove docs for rust dependencies * Better display examples, about and contributing documentation for Mentat * Version docs
315 lines
14 KiB
HTML
315 lines
14 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<title>OptionalRustObject Class Reference</title>
|
|
<link rel="stylesheet" type="text/css" href="../css/jazzy.css" />
|
|
<link rel="stylesheet" type="text/css" href="../css/highlight.css" />
|
|
<meta charset='utf-8'>
|
|
<script src="../js/jquery.min.js" defer></script>
|
|
<script src="../js/jazzy.js" defer></script>
|
|
|
|
</head>
|
|
<body>
|
|
<a name="//apple_ref/swift/Class/OptionalRustObject" class="dashAnchor"></a>
|
|
<a title="OptionalRustObject Class Reference"></a>
|
|
<header>
|
|
<div class="content-wrapper">
|
|
<p><a href="../index.html"> Docs</a> (74% documented)</p>
|
|
</div>
|
|
</header>
|
|
<div class="content-wrapper">
|
|
<p id="breadcrumbs">
|
|
<a href="../index.html"> Reference</a>
|
|
<img id="carat" src="../img/carat.png" />
|
|
OptionalRustObject Class Reference
|
|
</p>
|
|
</div>
|
|
<div class="content-wrapper">
|
|
<nav class="sidebar">
|
|
<ul class="nav-groups">
|
|
<li class="nav-group-name">
|
|
<a href="../Classes.html">Classes</a>
|
|
<ul class="nav-group-tasks">
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/ColResult.html">ColResult</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/ColResultIterator.html">ColResultIterator</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/EntityBuilder.html">EntityBuilder</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/InProgress.html">InProgress</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/InProgressBuilder.html">InProgressBuilder</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/Mentat.html">Mentat</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/OptionalRustObject.html">OptionalRustObject</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/Query.html">Query</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/RelResult.html">RelResult</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/RelResultIterator.html">RelResultIterator</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/RustObject.html">RustObject</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/TupleResult.html">TupleResult</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/TxReport.html">TxReport</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Classes/TypedValue.html">TypedValue</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="nav-group-name">
|
|
<a href="../Enums.html">Enumerations</a>
|
|
<ul class="nav-group-tasks">
|
|
<li class="nav-group-task">
|
|
<a href="../Enums/CacheDirection.html">CacheDirection</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Enums/PointerError.html">PointerError</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Enums/QueryError.html">QueryError</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Enums/ResultError.html">ResultError</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="nav-group-name">
|
|
<a href="../Extensions.html">Extensions</a>
|
|
<ul class="nav-group-tasks">
|
|
<li class="nav-group-task">
|
|
<a href="../Extensions/Date.html">Date</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Extensions/Result.html">Result</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="nav-group-name">
|
|
<a href="../Protocols.html">Protocols</a>
|
|
<ul class="nav-group-tasks">
|
|
<li class="nav-group-task">
|
|
<a href="../Protocols/Observable.html">Observable</a>
|
|
</li>
|
|
<li class="nav-group-task">
|
|
<a href="../Protocols/Observing.html">Observing</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="nav-group-name">
|
|
<a href="../Structs.html">Structures</a>
|
|
<ul class="nav-group-tasks">
|
|
<li class="nav-group-task">
|
|
<a href="../Structs.html#/s:6Mentat0A5ErrorV">MentatError</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li class="nav-group-name">
|
|
<a href="../Typealiases.html">Type Aliases</a>
|
|
<ul class="nav-group-tasks">
|
|
<li class="nav-group-task">
|
|
<a href="../Typealiases.html#/s:6Mentat5Entida">Entid</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
<article class="main-content">
|
|
<section>
|
|
<section class="section">
|
|
<h1>OptionalRustObject</h1>
|
|
<div class="declaration">
|
|
<div class="language">
|
|
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">class</span> <span class="kt">OptionalRustObject</span> <span class="p">:</span> <span class="kt">Destroyable</span></code></pre>
|
|
|
|
</div>
|
|
</div>
|
|
<p>Base class that wraps an optional <code>OpaquePointer</code> representing a pointer to a Rust object.
|
|
This class should be used to wrap Rust pointer that point to consuming structs, that is, calling a function
|
|
for that Rust pointer, will cause Rust to destroy the pointer, leaving the Swift pointer dangling.
|
|
These classes are responsible for ensuring that their raw <code>OpaquePointer</code> are <code>nil</code>led after calling a consuming
|
|
FFI function.
|
|
This class provides cleanup functions on deinit, ensuring that all classes
|
|
that inherit from it will have their <code>OpaquePointer</code> destroyed when the Swift wrapper is destroyed.
|
|
If a class does not override <code>cleanup</code> then a <code>fatalError</code> is thrown.
|
|
The optional pointer is managed here such that is the pointer is nil, then the cleanup function is not called
|
|
ensuring that we do not double free the pointer on exit.</p>
|
|
|
|
</section>
|
|
<section class="section task-group-section">
|
|
<div class="task-group">
|
|
<ul>
|
|
<li class="item">
|
|
<div>
|
|
<code>
|
|
<a name="/s:6Mentat18OptionalRustObjectCACSv3raw_tcfc"></a>
|
|
<a name="//apple_ref/swift/Method/init(raw:)" class="dashAnchor"></a>
|
|
<a class="token" href="#/s:6Mentat18OptionalRustObjectCACSv3raw_tcfc">init(raw:)</a>
|
|
</code>
|
|
</div>
|
|
<div class="height-container">
|
|
<div class="pointer-container"></div>
|
|
<section class="section">
|
|
<div class="pointer"></div>
|
|
<div class="abstract">
|
|
<p>Undocumented</p>
|
|
|
|
</div>
|
|
<div class="declaration">
|
|
<h4>Declaration</h4>
|
|
<div class="language">
|
|
<p class="aside-title">Swift</p>
|
|
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">raw</span><span class="p">:</span> <span class="kt">UnsafeMutableRawPointer</span><span class="p">)</span></code></pre>
|
|
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</li>
|
|
<li class="item">
|
|
<div>
|
|
<code>
|
|
<a name="/s:6Mentat18OptionalRustObjectCACs13OpaquePointerVSg3raw_tcfc"></a>
|
|
<a name="//apple_ref/swift/Method/init(raw:)" class="dashAnchor"></a>
|
|
<a class="token" href="#/s:6Mentat18OptionalRustObjectCACs13OpaquePointerVSg3raw_tcfc">init(raw:)</a>
|
|
</code>
|
|
</div>
|
|
<div class="height-container">
|
|
<div class="pointer-container"></div>
|
|
<section class="section">
|
|
<div class="pointer"></div>
|
|
<div class="abstract">
|
|
<p>Undocumented</p>
|
|
|
|
</div>
|
|
<div class="declaration">
|
|
<h4>Declaration</h4>
|
|
<div class="language">
|
|
<p class="aside-title">Swift</p>
|
|
<pre class="highlight swift"><code><span class="kd">public</span> <span class="nf">init</span><span class="p">(</span><span class="nv">raw</span><span class="p">:</span> <span class="kt">OpaquePointer</span><span class="p">?)</span></code></pre>
|
|
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</li>
|
|
<li class="item">
|
|
<div>
|
|
<code>
|
|
<a name="/s:6Mentat18OptionalRustObjectC6getRaws13OpaquePointerVSgyF"></a>
|
|
<a name="//apple_ref/swift/Method/getRaw()" class="dashAnchor"></a>
|
|
<a class="token" href="#/s:6Mentat18OptionalRustObjectC6getRaws13OpaquePointerVSgyF">getRaw()</a>
|
|
</code>
|
|
</div>
|
|
<div class="height-container">
|
|
<div class="pointer-container"></div>
|
|
<section class="section">
|
|
<div class="pointer"></div>
|
|
<div class="abstract">
|
|
<p>Undocumented</p>
|
|
|
|
</div>
|
|
<div class="declaration">
|
|
<h4>Declaration</h4>
|
|
<div class="language">
|
|
<p class="aside-title">Swift</p>
|
|
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">getRaw</span><span class="p">()</span> <span class="o">-></span> <span class="kt">OpaquePointer</span><span class="p">?</span></code></pre>
|
|
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</li>
|
|
<li class="item">
|
|
<div>
|
|
<code>
|
|
<a name="/s:6Mentat18OptionalRustObjectC12validPointers06OpaqueF0VyKF"></a>
|
|
<a name="//apple_ref/swift/Method/validPointer()" class="dashAnchor"></a>
|
|
<a class="token" href="#/s:6Mentat18OptionalRustObjectC12validPointers06OpaqueF0VyKF">validPointer()</a>
|
|
</code>
|
|
</div>
|
|
<div class="height-container">
|
|
<div class="pointer-container"></div>
|
|
<section class="section">
|
|
<div class="pointer"></div>
|
|
<div class="abstract">
|
|
<p>Provides a non-optional <code>OpaquePointer</code> if one exists for this class.</p>
|
|
<div class="aside aside-throws">
|
|
<p class="aside-title">Throws</p>
|
|
<p><code>Pointer.pointerConsumed</code> if the raw pointer wrapped by this class is nil</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
<div class="declaration">
|
|
<h4>Declaration</h4>
|
|
<div class="language">
|
|
<p class="aside-title">Swift</p>
|
|
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">func</span> <span class="nf">validPointer</span><span class="p">()</span> <span class="k">throws</span> <span class="o">-></span> <span class="kt">OpaquePointer</span></code></pre>
|
|
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<h4>Return Value</h4>
|
|
<p>the raw <code>OpaquePointer</code> wrapped by this class.</p>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</li>
|
|
<li class="item">
|
|
<div>
|
|
<code>
|
|
<a name="/s:6Mentat18OptionalRustObjectC7cleanupys13OpaquePointerV7pointer_tF"></a>
|
|
<a name="//apple_ref/swift/Method/cleanup(pointer:)" class="dashAnchor"></a>
|
|
<a class="token" href="#/s:6Mentat18OptionalRustObjectC7cleanupys13OpaquePointerV7pointer_tF">cleanup(pointer:)</a>
|
|
</code>
|
|
</div>
|
|
<div class="height-container">
|
|
<div class="pointer-container"></div>
|
|
<section class="section">
|
|
<div class="pointer"></div>
|
|
<div class="abstract">
|
|
<p>Undocumented</p>
|
|
|
|
</div>
|
|
<div class="declaration">
|
|
<h4>Declaration</h4>
|
|
<div class="language">
|
|
<p class="aside-title">Swift</p>
|
|
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">func</span> <span class="nf">cleanup</span><span class="p">(</span><span class="nv">pointer</span><span class="p">:</span> <span class="kt">OpaquePointer</span><span class="p">)</span></code></pre>
|
|
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</section>
|
|
</section>
|
|
<section id="footer">
|
|
<p>© 2018 <a class="link" href="" target="_blank" rel="external"></a>. All rights reserved. (Last updated: 2018-06-21)</p>
|
|
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.9.2</a>, a <a class="link" href="http://realm.io" target="_blank" rel="external">Realm</a> project.</p>
|
|
</section>
|
|
</article>
|
|
</div>
|
|
</body>
|
|
</div>
|
|
</html>
|