Skip to content

Commit

Permalink
Built artifacts of 133732d [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
mhammond committed Jan 17, 2024
1 parent 5dda4fb commit eec7a90
Show file tree
Hide file tree
Showing 31 changed files with 114 additions and 38 deletions.
4 changes: 2 additions & 2 deletions internals/api/search-index.js

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions internals/api/src/uniffi_bindgen/interface/enum_.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,9 @@
<a href="#760" id="760">760</a>
<a href="#761" id="761">761</a>
<a href="#762" id="762">762</a>
<a href="#763" id="763">763</a>
<a href="#764" id="764">764</a>
<a href="#765" id="765">765</a>
</pre></div><pre class="rust"><code><span class="comment">/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Expand Down Expand Up @@ -936,6 +939,7 @@
</span><span class="kw">pub struct </span>Enum {
<span class="kw">pub</span>(<span class="kw">super</span>) name: String,
<span class="kw">pub</span>(<span class="kw">super</span>) module_path: String,
<span class="kw">pub</span>(<span class="kw">super</span>) discr_type: <span class="prelude-ty">Option</span>&lt;Type&gt;,
<span class="kw">pub</span>(<span class="kw">super</span>) variants: Vec&lt;Variant&gt;,
<span class="comment">// NOTE: `flat` is a misleading name and to make matters worse, has 2 different
// meanings depending on the context :(
Expand Down Expand Up @@ -1022,6 +1026,7 @@
</span><span class="prelude-val">Ok</span>(<span class="self">Self </span>{
name: meta.name,
module_path: meta.module_path,
discr_type: meta.discr_type,
variants: meta
.variants
.into_iter()
Expand Down Expand Up @@ -1411,6 +1416,7 @@
<span class="kw">let </span><span class="kw-2">mut </span>e = Enum {
module_path: <span class="string">&quot;test&quot;</span>.to_string(),
name: <span class="string">&quot;test&quot;</span>.to_string(),
discr_type: <span class="prelude-val">None</span>,
variants: <span class="macro">vec!</span>[],
flat: <span class="bool-val">false</span>,
non_exhaustive: <span class="bool-val">false</span>,
Expand Down
4 changes: 4 additions & 0 deletions internals/api/src/uniffi_bindgen/interface/mod.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -1239,6 +1239,8 @@
<a href="#1239" id="1239">1239</a>
<a href="#1240" id="1240">1240</a>
<a href="#1241" id="1241">1241</a>
<a href="#1242" id="1242">1242</a>
<a href="#1243" id="1243">1243</a>
</pre></div><pre class="rust"><code><span class="comment">/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Expand Down Expand Up @@ -2307,6 +2309,7 @@
existing definition: Enum {
name: \&quot;Testing\&quot;,
module_path: \&quot;crate_name\&quot;,
discr_type: None,
variants: [
Variant {
name: \&quot;one\&quot;,
Expand All @@ -2328,6 +2331,7 @@
new definition: Enum {
name: \&quot;Testing\&quot;,
module_path: \&quot;crate_name\&quot;,
discr_type: None,
variants: [
Variant {
name: \&quot;three\&quot;,
Expand Down
64 changes: 62 additions & 2 deletions internals/api/src/uniffi_macros/enum_.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,41 @@
<a href="#299" id="299">299</a>
<a href="#300" id="300">300</a>
<a href="#301" id="301">301</a>
<a href="#302" id="302">302</a>
<a href="#303" id="303">303</a>
<a href="#304" id="304">304</a>
<a href="#305" id="305">305</a>
<a href="#306" id="306">306</a>
<a href="#307" id="307">307</a>
<a href="#308" id="308">308</a>
<a href="#309" id="309">309</a>
<a href="#310" id="310">310</a>
<a href="#311" id="311">311</a>
<a href="#312" id="312">312</a>
<a href="#313" id="313">313</a>
<a href="#314" id="314">314</a>
<a href="#315" id="315">315</a>
<a href="#316" id="316">316</a>
<a href="#317" id="317">317</a>
<a href="#318" id="318">318</a>
<a href="#319" id="319">319</a>
<a href="#320" id="320">320</a>
<a href="#321" id="321">321</a>
<a href="#322" id="322">322</a>
<a href="#323" id="323">323</a>
<a href="#324" id="324">324</a>
<a href="#325" id="325">325</a>
<a href="#326" id="326">326</a>
<a href="#327" id="327">327</a>
<a href="#328" id="328">328</a>
<a href="#329" id="329">329</a>
<a href="#330" id="330">330</a>
<a href="#331" id="331">331</a>
</pre></div><pre class="rust"><code><span class="kw">use </span>proc_macro2::{Ident, Span, TokenStream};
<span class="kw">use </span>quote::quote;
<span class="kw">use </span>syn::{
parse::{Parse, ParseStream},
Data, DataEnum, DeriveInput, Expr, Field, Index, Lit, Variant,
Attribute, Data, DataEnum, DeriveInput, Expr, Field, Index, Lit, Variant,
};

<span class="kw">use </span><span class="kw">crate</span>::util::{
Expand All @@ -312,6 +342,30 @@
try_metadata_value_from_usize, try_read_field, AttributeSliceExt, UniffiAttributeArgs,
};

<span class="kw">fn </span>extract_repr(attrs: <span class="kw-2">&amp;</span>[Attribute]) -&gt; syn::Result&lt;<span class="prelude-ty">Option</span>&lt;Ident&gt;&gt; {
<span class="kw">let </span><span class="kw-2">mut </span>result = <span class="prelude-val">None</span>;
<span class="kw">for </span>attr <span class="kw">in </span>attrs {
<span class="kw">if </span>attr.path().is_ident(<span class="string">&quot;repr&quot;</span>) {
attr.parse_nested_meta(|meta| {
result = <span class="kw">match </span>meta.path.get_ident() {
<span class="prelude-val">Some</span>(i) =&gt; {
<span class="kw">let </span>s = i.to_string();
<span class="kw">match </span>s.as_str() {
<span class="string">&quot;u8&quot; </span>| <span class="string">&quot;u16&quot; </span>| <span class="string">&quot;u32&quot; </span>| <span class="string">&quot;u64&quot; </span>| <span class="string">&quot;usize&quot; </span>| <span class="string">&quot;i8&quot; </span>| <span class="string">&quot;i16&quot; </span>| <span class="string">&quot;i32&quot;
</span>| <span class="string">&quot;i64&quot; </span>| <span class="string">&quot;isize&quot; </span>=&gt; <span class="prelude-val">Some</span>(i.clone()),
<span class="comment">// while the default repr for an enum is `isize` we don&#39;t apply that default here.
</span><span class="kw">_ </span>=&gt; <span class="prelude-val">None</span>,
}
}
<span class="kw">_ </span>=&gt; <span class="prelude-val">None</span>,
};
<span class="prelude-val">Ok</span>(())
})<span class="question-mark">?
</span>}
}
<span class="prelude-val">Ok</span>(result)
}

<span class="kw">pub fn </span>expand_enum(
input: DeriveInput,
<span class="comment">// Attributes from #[derive_error_for_udl()], if we are in udl mode
Expand All @@ -329,14 +383,15 @@
};
<span class="kw">let </span>ident = <span class="kw-2">&amp;</span>input.ident;
<span class="kw">let </span>docstring = extract_docstring(<span class="kw-2">&amp;</span>input.attrs)<span class="question-mark">?</span>;
<span class="kw">let </span>discr_type = extract_repr(<span class="kw-2">&amp;</span>input.attrs)<span class="question-mark">?</span>;
<span class="kw">let </span><span class="kw-2">mut </span>attr: EnumAttr = input.attrs.parse_uniffi_attr_args()<span class="question-mark">?</span>;
<span class="kw">if let </span><span class="prelude-val">Some</span>(attr_from_udl_mode) = attr_from_udl_mode {
attr = attr.merge(attr_from_udl_mode)<span class="question-mark">?</span>;
}
<span class="kw">let </span>ffi_converter_impl = enum_ffi_converter_impl(ident, <span class="kw-2">&amp;</span>enum_, udl_mode, <span class="kw-2">&amp;</span>attr);

<span class="kw">let </span>meta_static_var = (!udl_mode).then(|| {
enum_meta_static_var(ident, docstring, <span class="kw-2">&amp;</span>enum_, <span class="kw-2">&amp;</span>attr)
enum_meta_static_var(ident, docstring, discr_type, <span class="kw-2">&amp;</span>enum_, <span class="kw-2">&amp;</span>attr)
.unwrap_or_else(syn::Error::into_compile_error)
});

Expand Down Expand Up @@ -470,6 +525,7 @@
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn </span>enum_meta_static_var(
ident: <span class="kw-2">&amp;</span>Ident,
docstring: String,
discr_type: <span class="prelude-ty">Option</span>&lt;Ident&gt;,
enum_: <span class="kw-2">&amp;</span>DataEnum,
attr: <span class="kw-2">&amp;</span>EnumAttr,
) -&gt; syn::Result&lt;TokenStream&gt; {
Expand All @@ -483,6 +539,10 @@
.concat_str(#name)
.concat_option_bool(<span class="prelude-val">None</span>) <span class="comment">// forced_flatness
</span>};
metadata_expr.extend(<span class="kw">match </span>discr_type {
<span class="prelude-val">None </span>=&gt; <span class="macro">quote! </span>{ .concat_bool(<span class="bool-val">false</span>) },
<span class="prelude-val">Some</span>(t) =&gt; <span class="macro">quote! </span>{ .concat_bool(<span class="bool-val">true</span>).concat(&lt;#t <span class="kw">as </span>::uniffi::Lower&lt;<span class="kw">crate</span>::UniFfiTag&gt;&gt;::TYPE_ID_META) }
});
metadata_expr.extend(variant_metadata(enum_)<span class="question-mark">?</span>);
metadata_expr.extend(<span class="macro">quote! </span>{
.concat_bool(#non_exhaustive)
Expand Down
4 changes: 3 additions & 1 deletion internals/api/src/uniffi_macros/error.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@
<a href="#309" id="309">309</a>
<a href="#310" id="310">310</a>
<a href="#311" id="311">311</a>
<a href="#312" id="312">312</a>
</pre></div><pre class="rust"><code><span class="kw">use </span>proc_macro2::{Ident, Span, TokenStream};
<span class="kw">use </span>quote::quote;
<span class="kw">use </span>syn::{
Expand Down Expand Up @@ -522,7 +523,8 @@
.concat_str(#module_path)
.concat_str(#name)
.concat_option_bool(<span class="prelude-val">Some</span>(#flat))
};
.concat_bool(<span class="bool-val">false</span>) <span class="comment">// discr_type: None
</span>};
<span class="kw">if </span>flat {
metadata_expr.extend(flat_error_variant_metadata(enum_)<span class="question-mark">?</span>)
} <span class="kw">else </span>{
Expand Down
2 changes: 1 addition & 1 deletion internals/api/uniffi_bindgen/interface/enum_/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Enum definitions for a `ComponentInterface`."><title>uniffi_bindgen::interface::enum_ - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-9bb858ba049f1f21.css" id="mainThemeStyle"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="uniffi_bindgen" data-themes="" data-resource-suffix="" data-rustdoc-version="1.72.0 (5680fa18f 2023-08-23)" data-channel="1.72.0" data-search-js="search-f6292fe389d70017.js" data-settings-js="settings-de11bff964e9d4e5.js" data-settings-css="settings-8c76f75bfb6bd192.css" data-theme-light-css="light-0f8c037637f9eb3e.css" data-theme-dark-css="dark-1097f8e92a01e3cf.css" data-theme-ayu-css="ayu-614652228113ac93.css" ><script src="../../../static.files/storage-59fd9b8ccb335783.js"></script><script defer src="../../../static.files/main-0795b7d26be81095.js"></script><noscript><link rel="stylesheet" media="(prefers-color-scheme:light)" href="../../../static.files/light-0f8c037637f9eb3e.css"><link rel="stylesheet" media="(prefers-color-scheme:dark)" href="../../../static.files/dark-1097f8e92a01e3cf.css"><link rel="stylesheet" href="../../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="logo-container" href="../../../uniffi_bindgen/index.html"><img class="rust-logo" src="../../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../../uniffi_bindgen/index.html"><img class="rust-logo" src="../../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">Module enum_</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../../index.html">uniffi_bindgen</a>::<wbr><a href="../index.html">interface</a>::<wbr><a class="mod" href="#">enum_</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/uniffi_bindgen/interface/enum_.rs.html#5-762">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="enum-definitions-for-a-componentinterface"><a href="#enum-definitions-for-a-componentinterface">Enum definitions for a <code>ComponentInterface</code>.</a></h2>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Enum definitions for a `ComponentInterface`."><title>uniffi_bindgen::interface::enum_ - Rust</title><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Regular-46f98efaafac5295.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Regular-018c141bf0843ffd.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/FiraSans-Medium-8f9a781e4970d388.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Regular-562dcc5011b6de7d.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceSerif4-Bold-a2c9cd1067f8b328.ttf.woff2"><link rel="preload" as="font" type="font/woff2" crossorigin href="../../../static.files/SourceCodePro-Semibold-d899c5a5c4aeb14a.ttf.woff2"><link rel="stylesheet" href="../../../static.files/normalize-76eba96aa4d2e634.css"><link rel="stylesheet" href="../../../static.files/rustdoc-9bb858ba049f1f21.css" id="mainThemeStyle"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="uniffi_bindgen" data-themes="" data-resource-suffix="" data-rustdoc-version="1.72.0 (5680fa18f 2023-08-23)" data-channel="1.72.0" data-search-js="search-f6292fe389d70017.js" data-settings-js="settings-de11bff964e9d4e5.js" data-settings-css="settings-8c76f75bfb6bd192.css" data-theme-light-css="light-0f8c037637f9eb3e.css" data-theme-dark-css="dark-1097f8e92a01e3cf.css" data-theme-ayu-css="ayu-614652228113ac93.css" ><script src="../../../static.files/storage-59fd9b8ccb335783.js"></script><script defer src="../../../static.files/main-0795b7d26be81095.js"></script><noscript><link rel="stylesheet" media="(prefers-color-scheme:light)" href="../../../static.files/light-0f8c037637f9eb3e.css"><link rel="stylesheet" media="(prefers-color-scheme:dark)" href="../../../static.files/dark-1097f8e92a01e3cf.css"><link rel="stylesheet" href="../../../static.files/noscript-13285aec31fa243e.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-16x16-8b506e7a72182f1c.png"><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-422f7d1d52889060.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-2c020d218678b618.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="mobile-topbar"><button class="sidebar-menu-toggle">&#9776;</button><a class="logo-container" href="../../../uniffi_bindgen/index.html"><img class="rust-logo" src="../../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2></h2></nav><nav class="sidebar"><a class="logo-container" href="../../../uniffi_bindgen/index.html"><img class="rust-logo" src="../../../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><h2 class="location"><a href="#">Module enum_</a></h2><div class="sidebar-elems"><section><ul class="block"><li><a href="#structs">Structs</a></li></ul></section></div></nav><main><div class="width-limiter"><nav class="sub"><form class="search-form"><span></span><input class="search-input" name="search" aria-label="Run search in the documentation" autocomplete="off" spellcheck="false" placeholder="Click or press ‘S’ to search, ‘?’ for more options…" type="search"><div id="help-button" title="help" tabindex="-1"><a href="../../../help.html">?</a></div><div id="settings-menu" tabindex="-1"><a href="../../../settings.html" title="settings"><img width="22" height="22" alt="Change settings" src="../../../static.files/wheel-7b819b6101059cd0.svg"></a></div></form></nav><section id="main-content" class="content"><div class="main-heading"><h1>Module <a href="../../index.html">uniffi_bindgen</a>::<wbr><a href="../index.html">interface</a>::<wbr><a class="mod" href="#">enum_</a><button id="copy-path" title="Copy item path to clipboard"><img src="../../../static.files/clipboard-7571035ce49a181d.svg" width="19" height="18" alt="Copy item path"></button></h1><span class="out-of-band"><a class="srclink" href="../../../src/uniffi_bindgen/interface/enum_.rs.html#5-765">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><h2 id="enum-definitions-for-a-componentinterface"><a href="#enum-definitions-for-a-componentinterface">Enum definitions for a <code>ComponentInterface</code>.</a></h2>
<p>This module converts enum definition from UDL into structures that can be
added to a <code>ComponentInterface</code>. A declaration in the UDL like this:</p>

Expand Down
Loading

0 comments on commit eec7a90

Please sign in to comment.