Skip to content

Commit

Permalink
Deploying to gh-pages from @ a1359e4 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
branpk committed Oct 14, 2023
1 parent 40bc3b4 commit 33fdc85
Show file tree
Hide file tree
Showing 17 changed files with 113 additions and 59 deletions.
2 changes: 1 addition & 1 deletion docs/dev/implementors/core/fmt/trait.Debug.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dev/implementors/core/marker/trait.Freeze.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dev/implementors/core/marker/trait.Send.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dev/implementors/core/marker/trait.Sync.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dev/implementors/core/marker/trait.Unpin.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/dev/sm64_var_dump/fn.print_vars.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!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="API documentation for the Rust `print_vars` fn in crate `sm64_var_dump`."><title>print_vars in sm64_var_dump - 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-cb6f1f67f1bcd037.css" id="mainThemeStyle"><meta name="rustdoc-vars" data-root-path="../" data-static-root-path="../static.files/" data-current-crate="sm64_var_dump" data-themes="" data-resource-suffix="" data-rustdoc-version="1.73.0 (cc66ad468 2023-10-03)" data-channel="1.73.0" data-search-js="search-6dfdfced5eff6596.js" data-settings-js="settings-de11bff964e9d4e5.js" data-settings-css="settings-8c76f75bfb6bd192.css" data-theme-light-css="light-1596385f77d47ef2.css" data-theme-dark-css="dark-0a43001d3fc2282c.css" data-theme-ayu-css="ayu-fd19013d6ce078bf.css" ><script src="../static.files/storage-db41da1a38ea3cb8.js"></script><script defer src="sidebar-items.js"></script><script defer src="../static.files/main-0795b7d26be81095.js"></script><noscript><link rel="stylesheet" media="(prefers-color-scheme:light)" href="../static.files/light-1596385f77d47ef2.css"><link rel="stylesheet" media="(prefers-color-scheme:dark)" href="../static.files/dark-0a43001d3fc2282c.css"><link rel="stylesheet" href="../static.files/noscript-cffde32267a19fd6.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 fn"><!--[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="../sm64_var_dump/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="../sm64_var_dump/index.html"><img class="rust-logo" src="../static.files/rust-logo-151179464ae7ed46.svg" alt="logo"></a><div class="sidebar-elems"><h2><a href="index.html">In sm64_var_dump</a></h2></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>Function <a href="index.html">sm64_var_dump</a>::<wbr><a class="fn" href="#">print_vars</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="src" href="../src/sm64_var_dump/main.rs.html#252-273">source</a> · <button id="toggle-all-docs" title="collapse all docs">[<span>&#x2212;</span>]</button></span></div><pre class="rust item-decl"><code>pub(crate) fn print_vars(
streams: &amp;mut [<a class="struct" href="https://doc.rust-lang.org/1.73.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/1.73.0/std/io/trait.Write.html" title="trait std::io::Write">Write</a>&gt;],
vars: &amp;[<a class="struct" href="https://doc.rust-lang.org/1.73.0/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>],
read: impl <a class="trait" href="https://doc.rust-lang.org/1.73.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;<a class="primitive" href="https://doc.rust-lang.org/1.73.0/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.73.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="../wafel_data_type/value/enum.Value.html" title="enum wafel_data_type::value::Value">Value</a>, <a class="enum" href="../wafel_api/error/enum.Error.html" title="enum wafel_api::error::Error">Error</a>&gt;
read: impl <a class="trait" href="https://doc.rust-lang.org/1.73.0/core/ops/function/trait.FnMut.html" title="trait core::ops::function::FnMut">FnMut</a>(&amp;<a class="primitive" href="https://doc.rust-lang.org/1.73.0/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.73.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="enum" href="../wafel_data_type/value/enum.Value.html" title="enum wafel_data_type::value::Value">Value</a>, Error&gt;
) -&gt; <a class="enum" href="https://doc.rust-lang.org/1.73.0/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/1.73.0/std/primitive.unit.html">()</a>, <a class="struct" href="https://doc.rust-lang.org/1.73.0/alloc/boxed/struct.Box.html" title="struct alloc::boxed::Box">Box</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/1.73.0/core/error/trait.Error.html" title="trait core::error::Error">Error</a>&gt;&gt;</code></pre></section></div></main></body></html>
86 changes: 70 additions & 16 deletions docs/dev/src/wafel_layout/sm64_extra.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,33 @@
<a href="#149" id="149">149</a>
<a href="#150" id="150">150</a>
<a href="#151" id="151">151</a>
<a href="#152" id="152">152</a>
<a href="#153" id="153">153</a>
<a href="#154" id="154">154</a>
<a href="#155" id="155">155</a>
<a href="#156" id="156">156</a>
<a href="#157" id="157">157</a>
<a href="#158" id="158">158</a>
<a href="#159" id="159">159</a>
<a href="#160" id="160">160</a>
<a href="#161" id="161">161</a>
<a href="#162" id="162">162</a>
<a href="#163" id="163">163</a>
<a href="#164" id="164">164</a>
<a href="#165" id="165">165</a>
<a href="#166" id="166">166</a>
<a href="#167" id="167">167</a>
<a href="#168" id="168">168</a>
<a href="#169" id="169">169</a>
<a href="#170" id="170">170</a>
<a href="#171" id="171">171</a>
<a href="#172" id="172">172</a>
<a href="#173" id="173">173</a>
<a href="#174" id="174">174</a>
<a href="#175" id="175">175</a>
<a href="#176" id="176">176</a>
<a href="#177" id="177">177</a>
<a href="#178" id="178">178</a>
</pre></div><pre class="rust"><code><span class="kw">use </span>std::convert::TryFrom;

<span class="kw">use </span>indexmap::IndexMap;
Expand All @@ -170,10 +197,10 @@
<span class="kw">let </span>json: JsonValue = serde_json::from_slice(<span class="macro">include_bytes!</span>(<span class="string">&quot;../sm64_macro_defns.json&quot;</span>))
.expect(<span class="string">&quot;failed to deserialize sm64 macro defns&quot;</span>);
<span class="kw">let </span>fields = as_object(<span class="kw-2">&amp;</span>json);
<span class="kw">let </span>constants_json = field(<span class="kw-2">&amp;</span>fields, <span class="string">&quot;constants&quot;</span>);
<span class="kw">let </span>object_fields_json = field(<span class="kw-2">&amp;</span>fields, <span class="string">&quot;object_fields&quot;</span>);
load_object_fields(<span class="self">self</span>, <span class="kw-2">&amp;</span>object_fields_json)<span class="question-mark">?</span>;
load_constants(<span class="self">self</span>, <span class="kw-2">&amp;</span>constants_json);
<span class="kw">let </span>constants_json = field(fields, <span class="string">&quot;constants&quot;</span>);
<span class="kw">let </span>object_fields_json = field(fields, <span class="string">&quot;object_fields&quot;</span>);
load_object_fields(<span class="self">self</span>, object_fields_json)<span class="question-mark">?</span>;
load_constants(<span class="self">self</span>, constants_json);
<span class="prelude-val">Ok</span>(())
}
}
Expand All @@ -187,7 +214,7 @@

<span class="kw">let </span>object_struct = DataTypeRef::get_mut(object_struct_ref).ok_or(ObjectStructInUse)<span class="question-mark">?</span>;
<span class="kw">if let </span>DataType::Struct { fields } = object_struct {
<span class="kw">let </span>extra_fields = read_object_fields(<span class="kw-2">&amp;</span>json, fields)<span class="question-mark">?</span>;
<span class="kw">let </span>extra_fields = read_object_fields(json, fields)<span class="question-mark">?</span>;
fields.extend(extra_fields);
<span class="prelude-val">Ok</span>(())
} <span class="kw">else </span>{
Expand All @@ -197,7 +224,7 @@

<span class="doccomment">/// Load constants from the given json string.
</span><span class="kw">fn </span>load_constants(layout: <span class="kw-2">&amp;mut </span>DataLayout, json: <span class="kw-2">&amp;</span>JsonValue) {
<span class="kw">for </span>(name, info) <span class="kw">in </span>as_object(<span class="kw-2">&amp;</span>json) {
<span class="kw">for </span>(name, info) <span class="kw">in </span>as_object(json) {
<span class="kw">let </span>info = as_object(info);
<span class="kw">let </span>value_field = field(info, <span class="string">&quot;value&quot;</span>);

Expand Down Expand Up @@ -225,25 +252,18 @@
<span class="prelude-val">Some</span>(field) =&gt; field,
<span class="prelude-val">None </span>=&gt; <span class="kw">return </span><span class="prelude-val">Err</span>(MissingRawData),
};
<span class="kw">let </span>raw_data_arrays = <span class="kw">if let </span>DataType::Union { fields } = raw_data_field.data_type.as_ref() {
fields
} <span class="kw">else </span>{
<span class="kw">return </span><span class="prelude-val">Err</span>(RawDataNotUnion);
};

<span class="kw">let </span><span class="kw-2">mut </span>object_fields: IndexMap&lt;String, Field&gt; = IndexMap::new();
<span class="kw">for </span>(name, defn) <span class="kw">in </span>as_object(json) {
<span class="kw">let </span>defn_fields = as_object(defn);

<span class="kw">let </span>array_name = as_str(field(defn_fields, <span class="string">&quot;array&quot;</span>));
<span class="kw">let </span><span class="kw-2">mut </span>data_type = <span class="kw">match </span>raw_data_arrays.get(array_name) {
<span class="prelude-val">Some</span>(array) =&gt; DataTypeRef::clone(<span class="kw-2">&amp;</span>array.data_type),
<span class="prelude-val">None </span>=&gt; <span class="kw">return </span><span class="prelude-val">Err</span>(MissingRawDataArray(array_name.to_string())),
};

<span class="kw">let </span><span class="kw-2">mut </span>data_type = get_object_field_data_type(object_struct_fields, array_name)<span class="question-mark">?</span>;

<span class="kw">let </span>indices: Vec&lt;usize&gt; = as_array(field(defn_fields, <span class="string">&quot;indices&quot;</span>))
.iter()
.map(|v| as_usize(v))
.map(as_usize)
.collect();

<span class="kw">let </span><span class="kw-2">mut </span>offset = raw_data_field.offset;
Expand Down Expand Up @@ -273,6 +293,40 @@
<span class="prelude-val">Ok</span>(object_fields)
}

<span class="kw">fn </span>get_object_field_data_type(
object_struct_fields: <span class="kw-2">&amp;</span>IndexMap&lt;String, Field&gt;,
array_name: <span class="kw-2">&amp;</span>str,
) -&gt; <span class="prelude-ty">Result</span>&lt;DataTypeRef, SM64LayoutError&gt; {
<span class="kw">let </span>raw_data_field = <span class="kw">match </span>object_struct_fields.get(<span class="string">&quot;rawData&quot;</span>) {
<span class="prelude-val">Some</span>(field) =&gt; field,
<span class="prelude-val">None </span>=&gt; <span class="kw">return </span><span class="prelude-val">Err</span>(MissingRawData),
};
<span class="kw">let </span>raw_data_arrays = <span class="kw">if let </span>DataType::Union { fields } = raw_data_field.data_type.as_ref() {
fields
} <span class="kw">else </span>{
<span class="kw">return </span><span class="prelude-val">Err</span>(RawDataNotUnion);
};

<span class="kw">if let </span><span class="prelude-val">Some</span>(array) = raw_data_arrays.get(array_name) {
<span class="kw">return </span><span class="prelude-val">Ok</span>(array.data_type.clone());
}

<span class="kw">if let </span><span class="prelude-val">Some</span>(ptr_data_field) = object_struct_fields.get(<span class="string">&quot;ptrData&quot;</span>) {
<span class="kw">let </span>ptr_data_arrays = <span class="kw">if let </span>DataType::Union { fields } = ptr_data_field.data_type.as_ref()
{
fields
} <span class="kw">else </span>{
<span class="kw">return </span><span class="prelude-val">Err</span>(RawDataNotUnion);
};

<span class="kw">if let </span><span class="prelude-val">Some</span>(array) = ptr_data_arrays.get(array_name) {
<span class="kw">return </span><span class="prelude-val">Ok</span>(array.data_type.clone());
}
}

<span class="prelude-val">Err</span>(MissingRawDataArray(array_name.to_string()))
}

<span class="kw">fn </span>as_object(json: <span class="kw-2">&amp;</span>JsonValue) -&gt; <span class="kw-2">&amp;</span>Map&lt;String, JsonValue&gt; {
json.as_object()
.unwrap_or_else(|| <span class="macro">panic!</span>(<span class="string">&quot;expect object, found: {}&quot;</span>, json))
Expand Down
Loading

0 comments on commit 33fdc85

Please sign in to comment.