Skip to content

Commit

Permalink
deploy: 1b547a5
Browse files Browse the repository at this point in the history
  • Loading branch information
chinedufn committed Aug 15, 2024
1 parent 146bff4 commit e4e7aa1
Show file tree
Hide file tree
Showing 4 changed files with 104 additions and 2 deletions.
51 changes: 51 additions & 0 deletions bridge-module/functions/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,57 @@ <h2 id="async-rust-functions"><a class="header" href="#async-rust-functions">Asy
}
</code></pre>
<h2 id="function-attributes"><a class="header" href="#function-attributes">Function Attributes</a></h2>
<h4 id="swift_bridgeinit"><a class="header" href="#swift_bridgeinit">#[swift_bridge(init)]</a></h4>
<p>Used to generate a Swift initializer for Opaque Types.</p>
<pre><pre class="playground"><code class="language-rust">
<span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>// Rust

#[swift_bridge::bridge]
mod ffi {
extern &quot;Rust&quot; {
type RegularInitializer;

#[swift_bridge(init)]
fn new() -&gt; RegularInitializer;
}

extern &quot;Rust&quot; {
type FailableInitializer;

#[swift_bridge(init)]
fn new() -&gt; Option&lt;FailableInitializer&gt;;
}

enum SomeError {
case1,
case2
}

extern &quot;Rust&quot; {
type ThrowingInitializer;

#[swift_bridge(init)]
fn new() -&gt; Result&lt;FailableInitializer, SomeError&gt;;
}
}
<span class="boring">}
</span></code></pre></pre>
<pre><code class="language-swift">// Swift

let regularInitializer = RegularInitializer()

if let failableInitializer = FailableInitializer() {
// ...
}

do {
let throwingInitializer = try ThrowingInitializer()
} catch let error {
// ...
}
</code></pre>
<h4 id="swift_bridgeidentifiable"><a class="header" href="#swift_bridgeidentifiable">#[swift_bridge(Identifiable)]</a></h4>
<p>Used to generate a Swift <code>Identifiable</code> protocol implementation.</p>
<pre><pre class="playground"><code class="language-rust">
Expand Down
51 changes: 51 additions & 0 deletions print.html
Original file line number Diff line number Diff line change
Expand Up @@ -978,6 +978,57 @@ <h2 id="async-rust-functions"><a class="header" href="#async-rust-functions">Asy
}
</code></pre>
<h2 id="function-attributes"><a class="header" href="#function-attributes">Function Attributes</a></h2>
<h4 id="swift_bridgeinit"><a class="header" href="#swift_bridgeinit">#[swift_bridge(init)]</a></h4>
<p>Used to generate a Swift initializer for Opaque Types.</p>
<pre><pre class="playground"><code class="language-rust">
<span class="boring">#![allow(unused)]
</span><span class="boring">fn main() {
</span>// Rust

#[swift_bridge::bridge]
mod ffi {
extern &quot;Rust&quot; {
type RegularInitializer;

#[swift_bridge(init)]
fn new() -&gt; RegularInitializer;
}

extern &quot;Rust&quot; {
type FailableInitializer;

#[swift_bridge(init)]
fn new() -&gt; Option&lt;FailableInitializer&gt;;
}

enum SomeError {
case1,
case2
}

extern &quot;Rust&quot; {
type ThrowingInitializer;

#[swift_bridge(init)]
fn new() -&gt; Result&lt;FailableInitializer, SomeError&gt;;
}
}
<span class="boring">}
</span></code></pre></pre>
<pre><code class="language-swift">// Swift

let regularInitializer = RegularInitializer()

if let failableInitializer = FailableInitializer() {
// ...
}

do {
let throwingInitializer = try ThrowingInitializer()
} catch let error {
// ...
}
</code></pre>
<h4 id="swift_bridgeidentifiable"><a class="header" href="#swift_bridgeidentifiable">#[swift_bridge(Identifiable)]</a></h4>
<p>Used to generate a Swift <code>Identifiable</code> protocol implementation.</p>
<pre><pre class="playground"><code class="language-rust">
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.json

Large diffs are not rendered by default.

0 comments on commit e4e7aa1

Please sign in to comment.