This commit is contained in:
sagie gur ari 2020-02-21 11:03:41 +00:00
parent 1a4e0da4e7
commit 3b47706990
44 changed files with 493 additions and 522 deletions

View file

@ -1,6 +1,6 @@
## CHANGELOG
### v0.2.1
### v0.2.1 (2020-02-21)
* New temp_file command #85
* New spawn command #87

View file

@ -1,2 +1,2 @@
<!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 `version` fn in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, version"><title>duckscript::version - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../duckscript/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>duckscript</a></p><script>window.sidebarCurrent = {name: 'version', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/duckscript/lib.rs.html#143-145' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='index.html'>duckscript</a>::<wbr><a class="fn" href=''>version</a></span></h1><pre class='rust fn'>pub fn version() -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></pre><div class='docblock'><p>Returns the library version.</p>
<!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 `version` fn in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, version"><title>duckscript::version - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../duckscript/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='index.html'>duckscript</a></p><script>window.sidebarCurrent = {name: 'version', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/duckscript/lib.rs.html#142-144' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='index.html'>duckscript</a>::<wbr><a class="fn" href=''>version</a></span></h1><pre class='rust fn'>pub fn version() -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a></pre><div class='docblock'><p>Returns the library version.</p>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../";window.currentCrate = "duckscript";</script><script src="../aliases.js"></script><script src="../main.js"></script><script defer src="../search-index.js"></script></body></html>

View file

@ -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="API documentation for the Rust `duckscript` crate."><meta name="keywords" content="rust, rustlang, rust-lang, duckscript"><title>duckscript - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../duckscript/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Crate duckscript</p><div class="sidebar-elems"><a id='all-types' href='all.html'><p>See all duckscript's items</p></a><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#functions">Functions</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'duckscript', ty: 'mod', relpath: '../'};</script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/duckscript/lib.rs.html#1-145' title='goto source code'>[src]</a></span><span class='in-band'>Crate <a class="mod" href=''>duckscript</a></span></h1><div class='docblock'><h1 id="duckscript" class="section-header"><a href="#duckscript">duckscript</a></h1>
<!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 `duckscript` crate."><meta name="keywords" content="rust, rustlang, rust-lang, duckscript"><title>duckscript - Rust</title><link rel="stylesheet" type="text/css" href="../normalize.css"><link rel="stylesheet" type="text/css" href="../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../dark.css"><link rel="stylesheet" type="text/css" href="../light.css" id="themeStyle"><script src="../storage.js"></script><noscript><link rel="stylesheet" href="../noscript.css"></noscript><link rel="shortcut icon" href="../favicon.ico"><style type="text/css">#crate-search{background-image:url("../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../duckscript/index.html'><div class='logo-container'><img src='../rust-logo.png' alt='logo'></div></a><p class='location'>Crate duckscript</p><div class="sidebar-elems"><a id='all-types' href='all.html'><p>See all duckscript's items</p></a><div class="block items"><ul><li><a href="#modules">Modules</a></li><li><a href="#functions">Functions</a></li></ul></div><p class='location'></p><script>window.sidebarCurrent = {name: 'duckscript', ty: 'mod', relpath: '../'};</script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../settings.html"><img src="../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../src/duckscript/lib.rs.html#1-144' title='goto source code'>[src]</a></span><span class='in-band'>Crate <a class="mod" href=''>duckscript</a></span></h1><div class='docblock'><h1 id="duckscript" class="section-header"><a href="#duckscript">duckscript</a></h1>
<p>Simple, extendable and embeddable scripting language.</p>
<p>This library is the actual script parser and runner.<br>
On it's own, it has no actual commands as those need to be provided externally (see duckscript_sdk).</p>

View file

@ -1,2 +1,2 @@
<!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 `parse_file` fn in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, parse_file"><title>duckscript::parser::parse_file - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../duckscript/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='../index.html'>duckscript</a>::<wbr><a href='index.html'>parser</a></p><script>window.sidebarCurrent = {name: 'parse_file', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/duckscript/parser.rs.html#22-30' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='../index.html'>duckscript</a>::<wbr><a href='index.html'>parser</a>::<wbr><a class="fn" href=''>parse_file</a></span></h1><pre class='rust fn'>pub fn parse_file(file: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../duckscript/types/instruction/struct.Instruction.html" title="struct duckscript::types::instruction::Instruction">Instruction</a>&gt;, <a class="struct" href="../../duckscript/types/error/struct.ScriptError.html" title="struct duckscript::types::error::ScriptError">ScriptError</a>&gt;</pre><div class='docblock'><p>parses the file and returns a vector of instructions</p>
<!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 `parse_file` fn in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, parse_file"><title>duckscript::parser::parse_file - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../duckscript/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='../index.html'>duckscript</a>::<wbr><a href='index.html'>parser</a></p><script>window.sidebarCurrent = {name: 'parse_file', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/duckscript/parser.rs.html#22-32' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='../index.html'>duckscript</a>::<wbr><a href='index.html'>parser</a>::<wbr><a class="fn" href=''>parse_file</a></span></h1><pre class='rust fn'>pub fn parse_file(file: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../duckscript/types/instruction/struct.Instruction.html" title="struct duckscript::types::instruction::Instruction">Instruction</a>&gt;, <a class="struct" href="../../duckscript/types/error/struct.ScriptError.html" title="struct duckscript::types::error::ScriptError">ScriptError</a>&gt;</pre><div class='docblock'><p>parses the file and returns a vector of instructions</p>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "duckscript";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

View file

@ -1,2 +1,2 @@
<!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 `parse_text` fn in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, parse_text"><title>duckscript::parser::parse_text - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../duckscript/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='../index.html'>duckscript</a>::<wbr><a href='index.html'>parser</a></p><script>window.sidebarCurrent = {name: 'parse_text', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/duckscript/parser.rs.html#33-35' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='../index.html'>duckscript</a>::<wbr><a href='index.html'>parser</a>::<wbr><a class="fn" href=''>parse_text</a></span></h1><pre class='rust fn'>pub fn parse_text(text: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../duckscript/types/instruction/struct.Instruction.html" title="struct duckscript::types::instruction::Instruction">Instruction</a>&gt;, <a class="struct" href="../../duckscript/types/error/struct.ScriptError.html" title="struct duckscript::types::error::ScriptError">ScriptError</a>&gt;</pre><div class='docblock'><p>parses the provided script text and returns a vector of instructions</p>
<!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 `parse_text` fn in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, parse_text"><title>duckscript::parser::parse_text - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc fn"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../duckscript/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><div class="sidebar-elems"><p class='location'><a href='../index.html'>duckscript</a>::<wbr><a href='index.html'>parser</a></p><script>window.sidebarCurrent = {name: 'parse_text', ty: 'fn', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/duckscript/parser.rs.html#35-37' title='goto source code'>[src]</a></span><span class='in-band'>Function <a href='../index.html'>duckscript</a>::<wbr><a href='index.html'>parser</a>::<wbr><a class="fn" href=''>parse_text</a></span></h1><pre class='rust fn'>pub fn parse_text(text: &amp;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.str.html">str</a>) -&gt; <a class="enum" href="https://doc.rust-lang.org/nightly/core/result/enum.Result.html" title="enum core::result::Result">Result</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../duckscript/types/instruction/struct.Instruction.html" title="struct duckscript::types::instruction::Instruction">Instruction</a>&gt;, <a class="struct" href="../../duckscript/types/error/struct.ScriptError.html" title="struct duckscript::types::error::ScriptError">ScriptError</a>&gt;</pre><div class='docblock'><p>parses the provided script text and returns a vector of instructions</p>
</div></section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "duckscript";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script defer src="../../search-index.js"></script></body></html>

View file

@ -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="API documentation for the Rust `parser` mod in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, parser"><title>duckscript::parser - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../duckscript/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Module parser</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#functions">Functions</a></li></ul></div><p class='location'><a href='../index.html'>duckscript</a></p><script>window.sidebarCurrent = {name: 'parser', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/duckscript/parser.rs.html#1-467' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../index.html'>duckscript</a>::<wbr><a class="mod" href=''>parser</a></span></h1><div class='docblock'><h1 id="parser" class="section-header"><a href="#parser">parser</a></h1>
<!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 `parser` mod in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, parser"><title>duckscript::parser - Rust</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../duckscript/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a><p class='location'>Module parser</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#functions">Functions</a></li></ul></div><p class='location'><a href='../index.html'>duckscript</a></p><script>window.sidebarCurrent = {name: 'parser', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../src/duckscript/parser.rs.html#1-469' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../index.html'>duckscript</a>::<wbr><a class="mod" href=''>parser</a></span></h1><div class='docblock'><h1 id="parser" class="section-header"><a href="#parser">parser</a></h1>
<p>The duck script parser.</p>
</div><h2 id='functions' class='section-header'><a href="#functions">Functions</a></h2>
<table><tr class='module-item'><td><a class="fn" href="fn.parse_file.html" title='duckscript::parser::parse_file fn'>parse_file</a></td><td class='docblock-short'><p>parses the file and returns a vector of instructions</p>

View file

@ -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 `ErrorInfo` enum in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, ErrorInfo"><title>duckscript::types::error::ErrorInfo - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc enum"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../duckscript/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Enum ErrorInfo</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#variants">Variants</a><div class="sidebar-links"><a href="#variant.ErrorReadingFile">ErrorReadingFile</a><a href="#variant.Initialization">Initialization</a><a href="#variant.Runtime">Runtime</a><a href="#variant.PreProcessNoCommandFound">PreProcessNoCommandFound</a><a href="#variant.ControlWithoutValidValue">ControlWithoutValidValue</a><a href="#variant.InvalidControlLocation">InvalidControlLocation</a><a href="#variant.MissingEndQuotes">MissingEndQuotes</a><a href="#variant.MissingOutputVariableName">MissingOutputVariableName</a><a href="#variant.InvalidEqualsLocation">InvalidEqualsLocation</a><a href="#variant.InvalidQuotesLocation">InvalidQuotesLocation</a><a href="#variant.EmptyLabel">EmptyLabel</a><a href="#variant.UnknownPreProcessorCommand">UnknownPreProcessorCommand</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Debug">Debug</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class='location'><a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>error</a></p><script>window.sidebarCurrent = {name: 'ErrorInfo', ty: 'enum', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/duckscript/types/error.rs.html#34-59' title='goto source code'>[src]</a></span><span class='in-band'>Enum <a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>error</a>::<wbr><a class="enum" href=''>ErrorInfo</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust enum'>pub enum ErrorInfo {
ErrorReadingFile(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,&nbsp;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;),
ErrorReadingFile(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,&nbsp;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;FsIOError&gt;),
Initialization(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>),
Runtime(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,&nbsp;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../../duckscript/types/instruction/struct.InstructionMetaInfo.html" title="struct duckscript::types::instruction::InstructionMetaInfo">InstructionMetaInfo</a>&gt;),
PreProcessNoCommandFound(<a class="struct" href="../../../duckscript/types/instruction/struct.InstructionMetaInfo.html" title="struct duckscript::types::instruction::InstructionMetaInfo">InstructionMetaInfo</a>),
@ -14,7 +14,7 @@
}</pre></div><div class='docblock'><p>Holds the error information</p>
</div><h2 id='variants' class='variants small-section-header'>
Variants<a href='#variants' class='anchor'></a></h2>
<div id="variant.ErrorReadingFile" class="variant small-section-header"><a href="#variant.ErrorReadingFile" class="anchor field"></a><code id='ErrorReadingFile.v'>ErrorReadingFile(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,&nbsp;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/std/io/error/struct.Error.html" title="struct std::io::error::Error">Error</a>&gt;)</code></div><div class='docblock'><p>Error Info Type</p>
<div id="variant.ErrorReadingFile" class="variant small-section-header"><a href="#variant.ErrorReadingFile" class="anchor field"></a><code id='ErrorReadingFile.v'>ErrorReadingFile(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,&nbsp;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;FsIOError&gt;)</code></div><div class='docblock'><p>Error Info Type</p>
</div><div id="variant.Initialization" class="variant small-section-header"><a href="#variant.Initialization" class="anchor field"></a><code id='Initialization.v'>Initialization(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>)</code></div><div class='docblock'><p>Error Info Type</p>
</div><div id="variant.Runtime" class="variant small-section-header"><a href="#variant.Runtime" class="anchor field"></a><code id='Runtime.v'>Runtime(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>,&nbsp;<a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="../../../duckscript/types/instruction/struct.InstructionMetaInfo.html" title="struct duckscript::types::instruction::InstructionMetaInfo">InstructionMetaInfo</a>&gt;)</code></div><div class='docblock'><p>Error Info Type</p>
</div><div id="variant.PreProcessNoCommandFound" class="variant small-section-header"><a href="#variant.PreProcessNoCommandFound" class="anchor field"></a><code id='PreProcessNoCommandFound.v'>PreProcessNoCommandFound(<a class="struct" href="../../../duckscript/types/instruction/struct.InstructionMetaInfo.html" title="struct duckscript::types::instruction::InstructionMetaInfo">InstructionMetaInfo</a>)</code></div><div class='docblock'><p>Error Info Type</p>

View file

@ -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="API documentation for the Rust `StateValue` enum in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, StateValue"><title>duckscript::types::runtime::StateValue - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc enum"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../duckscript/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Enum StateValue</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#variants">Variants</a><div class="sidebar-links"><a href="#variant.Boolean">Boolean</a><a href="#variant.Number">Number</a><a href="#variant.UnsignedNumber">UnsignedNumber</a><a href="#variant.Number32Bit">Number32Bit</a><a href="#variant.UnsignedNumber32Bit">UnsignedNumber32Bit</a><a href="#variant.Number64Bit">Number64Bit</a><a href="#variant.UnsignedNumber64Bit">UnsignedNumber64Bit</a><a href="#variant.String">String</a><a href="#variant.ByteArray">ByteArray</a><a href="#variant.List">List</a><a href="#variant.SubState">SubState</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">RefUnwindSafe</a><a href="#impl-Send">Send</a><a href="#impl-Sync">Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class='location'><a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>runtime</a></p><script>window.sidebarCurrent = {name: 'StateValue', ty: 'enum', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#16-39' title='goto source code'>[src]</a></span><span class='in-band'>Enum <a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>runtime</a>::<wbr><a class="enum" href=''>StateValue</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust enum'>pub enum StateValue {
<!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 `StateValue` enum in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, StateValue"><title>duckscript::types::runtime::StateValue - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc enum"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../duckscript/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Enum StateValue</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#variants">Variants</a><div class="sidebar-links"><a href="#variant.Boolean">Boolean</a><a href="#variant.Number">Number</a><a href="#variant.UnsignedNumber">UnsignedNumber</a><a href="#variant.Number32Bit">Number32Bit</a><a href="#variant.UnsignedNumber32Bit">UnsignedNumber32Bit</a><a href="#variant.Number64Bit">Number64Bit</a><a href="#variant.UnsignedNumber64Bit">UnsignedNumber64Bit</a><a href="#variant.String">String</a><a href="#variant.ByteArray">ByteArray</a><a href="#variant.List">List</a><a href="#variant.SubState">SubState</a><a href="#variant.Any">Any</a></div><a class="sidebar-title" href="#implementations">Trait Implementations</a><div class="sidebar-links"><a href="#impl-Clone">Clone</a><a href="#impl-Debug">Debug</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-ToOwned">ToOwned</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class='location'><a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>runtime</a></p><script>window.sidebarCurrent = {name: 'StateValue', ty: 'enum', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#19-44' title='goto source code'>[src]</a></span><span class='in-band'>Enum <a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>runtime</a>::<wbr><a class="enum" href=''>StateValue</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust enum'>pub enum StateValue {
Boolean(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.bool.html">bool</a>),
Number(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.isize.html">isize</a>),
UnsignedNumber(<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>),
@ -10,6 +10,7 @@
ByteArray(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;),
List(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a>&gt;),
SubState(<a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a>&gt;),
Any(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/rc/struct.Rc.html" title="struct alloc::rc::Rc">Rc</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.RefCell.html" title="struct core::cell::RefCell">RefCell</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a>&gt;&gt;),
}</pre></div><div class='docblock'><p>enum defining what values can be stored in the state map</p>
</div><h2 id='variants' class='variants small-section-header'>
Variants<a href='#variants' class='anchor'></a></h2>
@ -24,10 +25,11 @@
</div><div id="variant.ByteArray" class="variant small-section-header"><a href="#variant.ByteArray" class="anchor field"></a><code id='ByteArray.v'>ByteArray(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.u8.html">u8</a>&gt;)</code></div><div class='docblock'><p>byte (u8) array</p>
</div><div id="variant.List" class="variant small-section-header"><a href="#variant.List" class="anchor field"></a><code id='List.v'>List(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a>&gt;)</code></div><div class='docblock'><p>list</p>
</div><div id="variant.SubState" class="variant small-section-header"><a href="#variant.SubState" class="anchor field"></a><code id='SubState.v'>SubState(<a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a>&gt;)</code></div><div class='docblock'><p>sub state value</p>
</div><h2 id='implementations' class='small-section-header'>Trait Implementations<a href='#implementations' class='anchor'></a></h2><div id='implementations-list'><h3 id='impl-Clone' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-Clone' class='anchor'></a><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#15' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.clone' class="method hidden"><code id='clone.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#15' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><div id="variant.Any" class="variant small-section-header"><a href="#variant.Any" class="anchor field"></a><code id='Any.v'>Any(<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/rc/struct.Rc.html" title="struct alloc::rc::Rc">Rc</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/core/cell/struct.RefCell.html" title="struct core::cell::RefCell">RefCell</a>&lt;dyn <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a>&gt;&gt;)</code></div><div class='docblock'><p>any value</p>
</div><h2 id='implementations' class='small-section-header'>Trait Implementations<a href='#implementations' class='anchor'></a></h2><div id='implementations-list'><h3 id='impl-Clone' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html" title="trait core::clone::Clone">Clone</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-Clone' class='anchor'></a><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#18' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.clone' class="method hidden"><code id='clone.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone' class='fnname'>clone</a>(&amp;self) -&gt; <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#18' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Returns a copy of the value. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#tymethod.clone">Read more</a></p>
</div><h4 id='method.clone_from' class="method hidden"><code id='clone_from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from' class='fnname'>clone_from</a>(&amp;mut self, source: <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>Self)</code><span class='since' title='Stable since Rust version 1.0.0'>1.0.0</span><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/clone.rs.html#131-133' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs copy-assignment from <code>source</code>. <a href="https://doc.rust-lang.org/nightly/core/clone/trait.Clone.html#method.clone_from">Read more</a></p>
</div></div><h3 id='impl-Debug' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-Debug' class='anchor'></a><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#15' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt' class="method hidden"><code id='fmt.v'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#15' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-RefUnwindSafe' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-RefUnwindSafe' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Send' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-UnwindSafe' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-UnwindSafe' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-Any' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#108-112' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#109-111' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div><h3 id='impl-Debug' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html" title="trait core::fmt::Debug">Debug</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-Debug' class='anchor'></a><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#18' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.fmt' class="method hidden"><code id='fmt.v'>fn <a href='https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt' class='fnname'>fmt</a>(&amp;self, f: &amp;mut <a class="struct" href="https://doc.rust-lang.org/nightly/core/fmt/struct.Formatter.html" title="struct core::fmt::Formatter">Formatter</a>) -&gt; <a class="type" href="https://doc.rust-lang.org/nightly/core/fmt/type.Result.html" title="type core::fmt::Result">Result</a></code><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#18' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Formats the value using the given formatter. <a href="https://doc.rust-lang.org/nightly/core/fmt/trait.Debug.html#tymethod.fmt">Read more</a></p>
</div></div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-RefUnwindSafe' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-RefUnwindSafe' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Send' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-UnwindSafe' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a></code><a href='#impl-UnwindSafe' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-Any' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#108-112' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#109-111' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-217' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-216' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220-224' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221-223' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>
</div></div><h3 id='impl-From%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/convert/trait.From.html" title="trait core::convert::From">From</a>&lt;T&gt; for T</code><a href='#impl-From%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#564-568' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.from' class="method hidden"><code id='from.v'>fn <a href='https://doc.rust-lang.org/nightly/core/convert/trait.From.html#tymethod.from' class='fnname'>from</a>(t: T) -&gt; T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/convert/mod.rs.html#565-567' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Performs the conversion.</p>

View file

@ -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="API documentation for the Rust `runtime` mod in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, runtime"><title>duckscript::types::runtime - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../duckscript/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Module runtime</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li></ul></div><p class='location'><a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a></p><script>window.sidebarCurrent = {name: 'runtime', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#1-81' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a class="mod" href=''>runtime</a></span></h1><div class='docblock'><h1 id="runtime" class="section-header"><a href="#runtime">runtime</a></h1>
<!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 `runtime` mod in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, runtime"><title>duckscript::types::runtime - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc mod"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../duckscript/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Module runtime</p><div class="sidebar-elems"><div class="block items"><ul><li><a href="#structs">Structs</a></li><li><a href="#enums">Enums</a></li></ul></div><p class='location'><a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a></p><script>window.sidebarCurrent = {name: 'runtime', ty: 'mod', relpath: '../'};</script><script defer src="../sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#1-86' title='goto source code'>[src]</a></span><span class='in-band'>Module <a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a class="mod" href=''>runtime</a></span></h1><div class='docblock'><h1 id="runtime" class="section-header"><a href="#runtime">runtime</a></h1>
<p>The runtime context structures.</p>
</div><h2 id='structs' class='section-header'><a href="#structs">Structs</a></h2>
<table><tr class='module-item'><td><a class="struct" href="struct.Context.html" title='duckscript::types::runtime::Context struct'>Context</a></td><td class='docblock-short'><p>The context structure</p>

View file

@ -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="API documentation for the Rust `Context` struct in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, Context"><title>duckscript::types::runtime::Context - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../duckscript/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Struct Context</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#fields">Fields</a><div class="sidebar-links"><a href="#structfield.variables">variables</a><a href="#structfield.state">state</a><a href="#structfield.commands">commands</a></div><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.new">new</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class='location'><a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>runtime</a></p><script>window.sidebarCurrent = {name: 'Context', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#42-49' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>runtime</a>::<wbr><a class="struct" href=''>Context</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct Context {
<!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 `Context` struct in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, Context"><title>duckscript::types::runtime::Context - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../duckscript/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Struct Context</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#fields">Fields</a><div class="sidebar-links"><a href="#structfield.variables">variables</a><a href="#structfield.state">state</a><a href="#structfield.commands">commands</a></div><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.new">new</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class='location'><a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>runtime</a></p><script>window.sidebarCurrent = {name: 'Context', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#47-54' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>runtime</a>::<wbr><a class="struct" href=''>Context</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct Context {
pub variables: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;,
pub state: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a>&gt;,
pub commands: <a class="struct" href="../../../duckscript/types/command/struct.Commands.html" title="struct duckscript::types::command::Commands">Commands</a>,
@ -7,7 +7,7 @@
Fields<a href='#fields' class='anchor'></a></h2><span id="structfield.variables" class="structfield small-section-header"><a href="#structfield.variables" class="anchor field"></a><code id="variables.v">variables: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>&gt;</code></span><div class='docblock'><p>The runtime variables</p>
</div><span id="structfield.state" class="structfield small-section-header"><a href="#structfield.state" class="anchor field"></a><code id="state.v">state: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="enum" href="../../../duckscript/types/runtime/enum.StateValue.html" title="enum duckscript::types::runtime::StateValue">StateValue</a>&gt;</code></span><div class='docblock'><p>The runtime state</p>
</div><span id="structfield.commands" class="structfield small-section-header"><a href="#structfield.commands" class="anchor field"></a><code id="commands.v">commands: <a class="struct" href="../../../duckscript/types/command/struct.Commands.html" title="struct duckscript::types::command::Commands">Commands</a></code></span><div class='docblock'><p>The command implementations</p>
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl <a class="struct" href="../../../duckscript/types/runtime/struct.Context.html" title="struct duckscript::types::runtime::Context">Context</a></code><a href='#impl' class='anchor'></a><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#51-60' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.new' class="method"><code id='new.v'>pub fn <a href='#method.new' class='fnname'>new</a>() -&gt; <a class="struct" href="../../../duckscript/types/runtime/struct.Context.html" title="struct duckscript::types::runtime::Context">Context</a></code><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#53-59' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates and returns a new instance.</p>
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl <a class="struct" href="../../../duckscript/types/runtime/struct.Context.html" title="struct duckscript::types::runtime::Context">Context</a></code><a href='#impl' class='anchor'></a><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#56-65' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.new' class="method"><code id='new.v'>pub fn <a href='#method.new' class='fnname'>new</a>() -&gt; <a class="struct" href="../../../duckscript/types/runtime/struct.Context.html" title="struct duckscript::types::runtime::Context">Context</a></code><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#58-64' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates and returns a new instance.</p>
</div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-RefUnwindSafe' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../../duckscript/types/runtime/struct.Context.html" title="struct duckscript::types::runtime::Context">Context</a></code><a href='#impl-RefUnwindSafe' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Send' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../../duckscript/types/runtime/struct.Context.html" title="struct duckscript::types::runtime::Context">Context</a></code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../../duckscript/types/runtime/struct.Context.html" title="struct duckscript::types::runtime::Context">Context</a></code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../../duckscript/types/runtime/struct.Context.html" title="struct duckscript::types::runtime::Context">Context</a></code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-UnwindSafe' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../../duckscript/types/runtime/struct.Context.html" title="struct duckscript::types::runtime::Context">Context</a></code><a href='#impl-UnwindSafe' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-Any' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#108-112' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#109-111' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-217' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-216' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220-224' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221-223' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>

View file

@ -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="API documentation for the Rust `Runtime` struct in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, Runtime"><title>duckscript::types::runtime::Runtime - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../duckscript/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Struct Runtime</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#fields">Fields</a><div class="sidebar-links"><a href="#structfield.instructions">instructions</a><a href="#structfield.label_to_line">label_to_line</a><a href="#structfield.context">context</a></div><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.new">new</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class='location'><a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>runtime</a></p><script>window.sidebarCurrent = {name: 'Runtime', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#63-70' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>runtime</a>::<wbr><a class="struct" href=''>Runtime</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct Runtime {
<!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 `Runtime` struct in crate `duckscript`."><meta name="keywords" content="rust, rustlang, rust-lang, Runtime"><title>duckscript::types::runtime::Runtime - Rust</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc struct"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../duckscript/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a><p class='location'>Struct Runtime</p><div class="sidebar-elems"><div class="block items"><a class="sidebar-title" href="#fields">Fields</a><div class="sidebar-links"><a href="#structfield.instructions">instructions</a><a href="#structfield.label_to_line">label_to_line</a><a href="#structfield.context">context</a></div><a class="sidebar-title" href="#methods">Methods</a><div class="sidebar-links"><a href="#method.new">new</a></div><a class="sidebar-title" href="#synthetic-implementations">Auto Trait Implementations</a><div class="sidebar-links"><a href="#impl-RefUnwindSafe">!RefUnwindSafe</a><a href="#impl-Send">!Send</a><a href="#impl-Sync">!Sync</a><a href="#impl-Unpin">Unpin</a><a href="#impl-UnwindSafe">!UnwindSafe</a></div><a class="sidebar-title" href="#blanket-implementations">Blanket Implementations</a><div class="sidebar-links"><a href="#impl-Any">Any</a><a href="#impl-Borrow%3CT%3E">Borrow&lt;T&gt;</a><a href="#impl-BorrowMut%3CT%3E">BorrowMut&lt;T&gt;</a><a href="#impl-From%3CT%3E">From&lt;T&gt;</a><a href="#impl-Into%3CU%3E">Into&lt;U&gt;</a><a href="#impl-TryFrom%3CU%3E">TryFrom&lt;U&gt;</a><a href="#impl-TryInto%3CU%3E">TryInto&lt;U&gt;</a></div></div><p class='location'><a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>runtime</a></p><script>window.sidebarCurrent = {name: 'Runtime', ty: 'struct', relpath: ''};</script><script defer src="sidebar-items.js"></script></div></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><h1 class='fqn'><span class='out-of-band'><span id='render-detail'><a id="toggle-all-docs" href="javascript:void(0)" title="collapse all docs">[<span class='inner'>&#x2212;</span>]</a></span><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#68-75' title='goto source code'>[src]</a></span><span class='in-band'>Struct <a href='../../index.html'>duckscript</a>::<wbr><a href='../index.html'>types</a>::<wbr><a href='index.html'>runtime</a>::<wbr><a class="struct" href=''>Runtime</a></span></h1><div class="docblock type-decl hidden-by-usual-hider"><pre class='rust struct'>pub struct Runtime {
pub instructions: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../../duckscript/types/instruction/struct.Instruction.html" title="struct duckscript::types::instruction::Instruction">Instruction</a>&gt;&gt;,
pub label_to_line: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;,
pub context: <a class="struct" href="../../../duckscript/types/runtime/struct.Context.html" title="struct duckscript::types::runtime::Context">Context</a>,
@ -7,7 +7,7 @@
Fields<a href='#fields' class='anchor'></a></h2><span id="structfield.instructions" class="structfield small-section-header"><a href="#structfield.instructions" class="anchor field"></a><code id="instructions.v">instructions: <a class="enum" href="https://doc.rust-lang.org/nightly/core/option/enum.Option.html" title="enum core::option::Option">Option</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/vec/struct.Vec.html" title="struct alloc::vec::Vec">Vec</a>&lt;<a class="struct" href="../../../duckscript/types/instruction/struct.Instruction.html" title="struct duckscript::types::instruction::Instruction">Instruction</a>&gt;&gt;</code></span><div class='docblock'><p>The script instructions</p>
</div><span id="structfield.label_to_line" class="structfield small-section-header"><a href="#structfield.label_to_line" class="anchor field"></a><code id="label_to_line.v">label_to_line: <a class="struct" href="https://doc.rust-lang.org/nightly/std/collections/hash/map/struct.HashMap.html" title="struct std::collections::hash::map::HashMap">HashMap</a>&lt;<a class="struct" href="https://doc.rust-lang.org/nightly/alloc/string/struct.String.html" title="struct alloc::string::String">String</a>, <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.usize.html">usize</a>&gt;</code></span><div class='docblock'><p>Label to line number mapping</p>
</div><span id="structfield.context" class="structfield small-section-header"><a href="#structfield.context" class="anchor field"></a><code id="context.v">context: <a class="struct" href="../../../duckscript/types/runtime/struct.Context.html" title="struct duckscript::types::runtime::Context">Context</a></code></span><div class='docblock'><p>The runtime context</p>
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl <a class="struct" href="../../../duckscript/types/runtime/struct.Runtime.html" title="struct duckscript::types::runtime::Runtime">Runtime</a></code><a href='#impl' class='anchor'></a><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#72-81' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.new' class="method"><code id='new.v'>pub fn <a href='#method.new' class='fnname'>new</a>(context: <a class="struct" href="../../../duckscript/types/runtime/struct.Context.html" title="struct duckscript::types::runtime::Context">Context</a>) -&gt; <a class="struct" href="../../../duckscript/types/runtime/struct.Runtime.html" title="struct duckscript::types::runtime::Runtime">Runtime</a></code><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#74-80' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates and returns a new instance.</p>
</div><h2 id='methods' class='small-section-header'>Methods<a href='#methods' class='anchor'></a></h2><h3 id='impl' class='impl'><code class='in-band'>impl <a class="struct" href="../../../duckscript/types/runtime/struct.Runtime.html" title="struct duckscript::types::runtime::Runtime">Runtime</a></code><a href='#impl' class='anchor'></a><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#77-86' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.new' class="method"><code id='new.v'>pub fn <a href='#method.new' class='fnname'>new</a>(context: <a class="struct" href="../../../duckscript/types/runtime/struct.Context.html" title="struct duckscript::types::runtime::Context">Context</a>) -&gt; <a class="struct" href="../../../duckscript/types/runtime/struct.Runtime.html" title="struct duckscript::types::runtime::Runtime">Runtime</a></code><a class='srclink' href='../../../src/duckscript/types/runtime.rs.html#79-85' title='goto source code'>[src]</a></h4><div class='docblock'><p>Creates and returns a new instance.</p>
</div></div><h2 id='synthetic-implementations' class='small-section-header'>Auto Trait Implementations<a href='#synthetic-implementations' class='anchor'></a></h2><div id='synthetic-implementations-list'><h3 id='impl-RefUnwindSafe' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.RefUnwindSafe.html" title="trait std::panic::RefUnwindSafe">RefUnwindSafe</a> for <a class="struct" href="../../../duckscript/types/runtime/struct.Runtime.html" title="struct duckscript::types::runtime::Runtime">Runtime</a></code><a href='#impl-RefUnwindSafe' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Send' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Send.html" title="trait core::marker::Send">Send</a> for <a class="struct" href="../../../duckscript/types/runtime/struct.Runtime.html" title="struct duckscript::types::runtime::Runtime">Runtime</a></code><a href='#impl-Send' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Sync' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html" title="trait core::marker::Sync">Sync</a> for <a class="struct" href="../../../duckscript/types/runtime/struct.Runtime.html" title="struct duckscript::types::runtime::Runtime">Runtime</a></code><a href='#impl-Sync' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-Unpin' class='impl'><code class='in-band'>impl <a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Unpin.html" title="trait core::marker::Unpin">Unpin</a> for <a class="struct" href="../../../duckscript/types/runtime/struct.Runtime.html" title="struct duckscript::types::runtime::Runtime">Runtime</a></code><a href='#impl-Unpin' class='anchor'></a></h3><div class='impl-items'></div><h3 id='impl-UnwindSafe' class='impl'><code class='in-band'>impl !<a class="trait" href="https://doc.rust-lang.org/nightly/std/panic/trait.UnwindSafe.html" title="trait std::panic::UnwindSafe">UnwindSafe</a> for <a class="struct" href="../../../duckscript/types/runtime/struct.Runtime.html" title="struct duckscript::types::runtime::Runtime">Runtime</a></code><a href='#impl-UnwindSafe' class='anchor'></a></h3><div class='impl-items'></div></div><h2 id='blanket-implementations' class='small-section-header'>Blanket Implementations<a href='#blanket-implementations' class='anchor'></a></h2><div id='blanket-implementations-list'><h3 id='impl-Any' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html" title="trait core::any::Any">Any</a> for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: 'static + ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Any' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#108-112' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.type_id' class="method hidden"><code id='type_id.v'>fn <a href='https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id' class='fnname'>type_id</a>(&amp;self) -&gt; <a class="struct" href="https://doc.rust-lang.org/nightly/core/any/struct.TypeId.html" title="struct core::any::TypeId">TypeId</a></code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/any.rs.html#109-111' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Gets the <code>TypeId</code> of <code>self</code>. <a href="https://doc.rust-lang.org/nightly/core/any/trait.Any.html#tymethod.type_id">Read more</a></p>
</div></div><h3 id='impl-Borrow%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html" title="trait core::borrow::Borrow">Borrow</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-Borrow%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#213-217' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow' class="method hidden"><code id='borrow.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow' class='fnname'>borrow</a>(&amp;self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;</a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#214-216' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Immutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.Borrow.html#tymethod.borrow">Read more</a></p>
</div></div><h3 id='impl-BorrowMut%3CT%3E' class='impl'><code class='in-band'>impl&lt;T&gt; <a class="trait" href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html" title="trait core::borrow::BorrowMut">BorrowMut</a>&lt;T&gt; for T <span class="where fmt-newline">where<br>&nbsp;&nbsp;&nbsp;&nbsp;T: ?<a class="trait" href="https://doc.rust-lang.org/nightly/core/marker/trait.Sized.html" title="trait core::marker::Sized">Sized</a>,&nbsp;</span></code><a href='#impl-BorrowMut%3CT%3E' class='anchor'></a><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#220-224' title='goto source code'>[src]</a></h3><div class='impl-items'><h4 id='method.borrow_mut' class="method hidden"><code id='borrow_mut.v'>fn <a href='https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut' class='fnname'>borrow_mut</a>(&amp;mut self) -&gt; <a class="primitive" href="https://doc.rust-lang.org/nightly/std/primitive.reference.html">&amp;mut </a>T</code><a class='srclink' href='https://doc.rust-lang.org/nightly/src/core/borrow.rs.html#221-223' title='goto source code'>[src]</a></h4><div class='docblock hidden'><p>Mutably borrows from an owned value. <a href="https://doc.rust-lang.org/nightly/core/borrow/trait.BorrowMut.html#tymethod.borrow_mut">Read more</a></p>

View file

@ -1,5 +1,5 @@
(function() {var implementors = {};
implementors["duckscript"] = [{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/command/struct.Commands.html\" title=\"struct duckscript::types::command::Commands\">Commands</a>","synthetic":true,"types":["duckscript::types::command::Commands"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"enum\" href=\"duckscript/types/command/enum.GoToValue.html\" title=\"enum duckscript::types::command::GoToValue\">GoToValue</a>","synthetic":true,"types":["duckscript::types::command::GoToValue"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"enum\" href=\"duckscript/types/command/enum.CommandResult.html\" title=\"enum duckscript::types::command::CommandResult\">CommandResult</a>","synthetic":true,"types":["duckscript::types::command::CommandResult"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/error/struct.ScriptError.html\" title=\"struct duckscript::types::error::ScriptError\">ScriptError</a>","synthetic":true,"types":["duckscript::types::error::ScriptError"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"enum\" href=\"duckscript/types/error/enum.ErrorInfo.html\" title=\"enum duckscript::types::error::ErrorInfo\">ErrorInfo</a>","synthetic":true,"types":["duckscript::types::error::ErrorInfo"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.PreProcessInstruction.html\" title=\"struct duckscript::types::instruction::PreProcessInstruction\">PreProcessInstruction</a>","synthetic":true,"types":["duckscript::types::instruction::PreProcessInstruction"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.ScriptInstruction.html\" title=\"struct duckscript::types::instruction::ScriptInstruction\">ScriptInstruction</a>","synthetic":true,"types":["duckscript::types::instruction::ScriptInstruction"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.InstructionMetaInfo.html\" title=\"struct duckscript::types::instruction::InstructionMetaInfo\">InstructionMetaInfo</a>","synthetic":true,"types":["duckscript::types::instruction::InstructionMetaInfo"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.Instruction.html\" title=\"struct duckscript::types::instruction::Instruction\">Instruction</a>","synthetic":true,"types":["duckscript::types::instruction::Instruction"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"enum\" href=\"duckscript/types/instruction/enum.InstructionType.html\" title=\"enum duckscript::types::instruction::InstructionType\">InstructionType</a>","synthetic":true,"types":["duckscript::types::instruction::InstructionType"]},{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/runtime/struct.Context.html\" title=\"struct duckscript::types::runtime::Context\">Context</a>","synthetic":true,"types":["duckscript::types::runtime::Context"]},{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/runtime/struct.Runtime.html\" title=\"struct duckscript::types::runtime::Runtime\">Runtime</a>","synthetic":true,"types":["duckscript::types::runtime::Runtime"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"enum\" href=\"duckscript/types/runtime/enum.StateValue.html\" title=\"enum duckscript::types::runtime::StateValue\">StateValue</a>","synthetic":true,"types":["duckscript::types::runtime::StateValue"]}];
implementors["duckscript"] = [{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/command/struct.Commands.html\" title=\"struct duckscript::types::command::Commands\">Commands</a>","synthetic":true,"types":["duckscript::types::command::Commands"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"enum\" href=\"duckscript/types/command/enum.GoToValue.html\" title=\"enum duckscript::types::command::GoToValue\">GoToValue</a>","synthetic":true,"types":["duckscript::types::command::GoToValue"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"enum\" href=\"duckscript/types/command/enum.CommandResult.html\" title=\"enum duckscript::types::command::CommandResult\">CommandResult</a>","synthetic":true,"types":["duckscript::types::command::CommandResult"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/error/struct.ScriptError.html\" title=\"struct duckscript::types::error::ScriptError\">ScriptError</a>","synthetic":true,"types":["duckscript::types::error::ScriptError"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"enum\" href=\"duckscript/types/error/enum.ErrorInfo.html\" title=\"enum duckscript::types::error::ErrorInfo\">ErrorInfo</a>","synthetic":true,"types":["duckscript::types::error::ErrorInfo"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.PreProcessInstruction.html\" title=\"struct duckscript::types::instruction::PreProcessInstruction\">PreProcessInstruction</a>","synthetic":true,"types":["duckscript::types::instruction::PreProcessInstruction"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.ScriptInstruction.html\" title=\"struct duckscript::types::instruction::ScriptInstruction\">ScriptInstruction</a>","synthetic":true,"types":["duckscript::types::instruction::ScriptInstruction"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.InstructionMetaInfo.html\" title=\"struct duckscript::types::instruction::InstructionMetaInfo\">InstructionMetaInfo</a>","synthetic":true,"types":["duckscript::types::instruction::InstructionMetaInfo"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.Instruction.html\" title=\"struct duckscript::types::instruction::Instruction\">Instruction</a>","synthetic":true,"types":["duckscript::types::instruction::Instruction"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"enum\" href=\"duckscript/types/instruction/enum.InstructionType.html\" title=\"enum duckscript::types::instruction::InstructionType\">InstructionType</a>","synthetic":true,"types":["duckscript::types::instruction::InstructionType"]},{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/runtime/struct.Context.html\" title=\"struct duckscript::types::runtime::Context\">Context</a>","synthetic":true,"types":["duckscript::types::runtime::Context"]},{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"struct\" href=\"duckscript/types/runtime/struct.Runtime.html\" title=\"struct duckscript::types::runtime::Runtime\">Runtime</a>","synthetic":true,"types":["duckscript::types::runtime::Runtime"]},{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Send.html\" title=\"trait core::marker::Send\">Send</a> for <a class=\"enum\" href=\"duckscript/types/runtime/enum.StateValue.html\" title=\"enum duckscript::types::runtime::StateValue\">StateValue</a>","synthetic":true,"types":["duckscript::types::runtime::StateValue"]}];
if (window.register_implementors) {
window.register_implementors(implementors);

View file

@ -1,5 +1,5 @@
(function() {var implementors = {};
implementors["duckscript"] = [{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/command/struct.Commands.html\" title=\"struct duckscript::types::command::Commands\">Commands</a>","synthetic":true,"types":["duckscript::types::command::Commands"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"enum\" href=\"duckscript/types/command/enum.GoToValue.html\" title=\"enum duckscript::types::command::GoToValue\">GoToValue</a>","synthetic":true,"types":["duckscript::types::command::GoToValue"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"enum\" href=\"duckscript/types/command/enum.CommandResult.html\" title=\"enum duckscript::types::command::CommandResult\">CommandResult</a>","synthetic":true,"types":["duckscript::types::command::CommandResult"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/error/struct.ScriptError.html\" title=\"struct duckscript::types::error::ScriptError\">ScriptError</a>","synthetic":true,"types":["duckscript::types::error::ScriptError"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"enum\" href=\"duckscript/types/error/enum.ErrorInfo.html\" title=\"enum duckscript::types::error::ErrorInfo\">ErrorInfo</a>","synthetic":true,"types":["duckscript::types::error::ErrorInfo"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.PreProcessInstruction.html\" title=\"struct duckscript::types::instruction::PreProcessInstruction\">PreProcessInstruction</a>","synthetic":true,"types":["duckscript::types::instruction::PreProcessInstruction"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.ScriptInstruction.html\" title=\"struct duckscript::types::instruction::ScriptInstruction\">ScriptInstruction</a>","synthetic":true,"types":["duckscript::types::instruction::ScriptInstruction"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.InstructionMetaInfo.html\" title=\"struct duckscript::types::instruction::InstructionMetaInfo\">InstructionMetaInfo</a>","synthetic":true,"types":["duckscript::types::instruction::InstructionMetaInfo"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.Instruction.html\" title=\"struct duckscript::types::instruction::Instruction\">Instruction</a>","synthetic":true,"types":["duckscript::types::instruction::Instruction"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"enum\" href=\"duckscript/types/instruction/enum.InstructionType.html\" title=\"enum duckscript::types::instruction::InstructionType\">InstructionType</a>","synthetic":true,"types":["duckscript::types::instruction::InstructionType"]},{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/runtime/struct.Context.html\" title=\"struct duckscript::types::runtime::Context\">Context</a>","synthetic":true,"types":["duckscript::types::runtime::Context"]},{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/runtime/struct.Runtime.html\" title=\"struct duckscript::types::runtime::Runtime\">Runtime</a>","synthetic":true,"types":["duckscript::types::runtime::Runtime"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"enum\" href=\"duckscript/types/runtime/enum.StateValue.html\" title=\"enum duckscript::types::runtime::StateValue\">StateValue</a>","synthetic":true,"types":["duckscript::types::runtime::StateValue"]}];
implementors["duckscript"] = [{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/command/struct.Commands.html\" title=\"struct duckscript::types::command::Commands\">Commands</a>","synthetic":true,"types":["duckscript::types::command::Commands"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"enum\" href=\"duckscript/types/command/enum.GoToValue.html\" title=\"enum duckscript::types::command::GoToValue\">GoToValue</a>","synthetic":true,"types":["duckscript::types::command::GoToValue"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"enum\" href=\"duckscript/types/command/enum.CommandResult.html\" title=\"enum duckscript::types::command::CommandResult\">CommandResult</a>","synthetic":true,"types":["duckscript::types::command::CommandResult"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/error/struct.ScriptError.html\" title=\"struct duckscript::types::error::ScriptError\">ScriptError</a>","synthetic":true,"types":["duckscript::types::error::ScriptError"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"enum\" href=\"duckscript/types/error/enum.ErrorInfo.html\" title=\"enum duckscript::types::error::ErrorInfo\">ErrorInfo</a>","synthetic":true,"types":["duckscript::types::error::ErrorInfo"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.PreProcessInstruction.html\" title=\"struct duckscript::types::instruction::PreProcessInstruction\">PreProcessInstruction</a>","synthetic":true,"types":["duckscript::types::instruction::PreProcessInstruction"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.ScriptInstruction.html\" title=\"struct duckscript::types::instruction::ScriptInstruction\">ScriptInstruction</a>","synthetic":true,"types":["duckscript::types::instruction::ScriptInstruction"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.InstructionMetaInfo.html\" title=\"struct duckscript::types::instruction::InstructionMetaInfo\">InstructionMetaInfo</a>","synthetic":true,"types":["duckscript::types::instruction::InstructionMetaInfo"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/instruction/struct.Instruction.html\" title=\"struct duckscript::types::instruction::Instruction\">Instruction</a>","synthetic":true,"types":["duckscript::types::instruction::Instruction"]},{"text":"impl <a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"enum\" href=\"duckscript/types/instruction/enum.InstructionType.html\" title=\"enum duckscript::types::instruction::InstructionType\">InstructionType</a>","synthetic":true,"types":["duckscript::types::instruction::InstructionType"]},{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/runtime/struct.Context.html\" title=\"struct duckscript::types::runtime::Context\">Context</a>","synthetic":true,"types":["duckscript::types::runtime::Context"]},{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"struct\" href=\"duckscript/types/runtime/struct.Runtime.html\" title=\"struct duckscript::types::runtime::Runtime\">Runtime</a>","synthetic":true,"types":["duckscript::types::runtime::Runtime"]},{"text":"impl !<a class=\"trait\" href=\"https://doc.rust-lang.org/nightly/core/marker/trait.Sync.html\" title=\"trait core::marker::Sync\">Sync</a> for <a class=\"enum\" href=\"duckscript/types/runtime/enum.StateValue.html\" title=\"enum duckscript::types::runtime::StateValue\">StateValue</a>","synthetic":true,"types":["duckscript::types::runtime::StateValue"]}];
if (window.register_implementors) {
window.register_implementors(implementors);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,3 +1,3 @@
var N = null;var sourcesIndex = {};
sourcesIndex["duckscript"] = {"name":"","dirs":[{"name":"preprocessor","files":["include_files_preprocessor.rs","mod.rs","print_preprocessor.rs"]},{"name":"types","files":["command.rs","error.rs","instruction.rs","mod.rs","runtime.rs"]}],"files":["expansion.rs","io.rs","lib.rs","parser.rs","runner.rs"]};
sourcesIndex["duckscript"] = {"name":"","dirs":[{"name":"preprocessor","files":["include_files_preprocessor.rs","mod.rs","print_preprocessor.rs"]},{"name":"types","files":["command.rs","error.rs","instruction.rs","mod.rs","runtime.rs"]}],"files":["expansion.rs","lib.rs","parser.rs","runner.rs"]};
createSourceSidebar();

View file

@ -1,61 +0,0 @@
<!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="Source to the Rust file `duckscript/src/io.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>io.rs.html -- source</title><link rel="stylesheet" type="text/css" href="../../normalize.css"><link rel="stylesheet" type="text/css" href="../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../dark.css"><link rel="stylesheet" type="text/css" href="../../light.css" id="themeStyle"><script src="../../storage.js"></script><noscript><link rel="stylesheet" href="../../noscript.css"></noscript><link rel="shortcut icon" href="../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../down-arrow.svg");}</style></head><body class="rustdoc source"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../duckscript/index.html'><div class='logo-container'><img src='../../rust-logo.png' alt='logo'></div></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../settings.html"><img src="../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><pre class="line-numbers"><span id="1"> 1</span>
<span id="2"> 2</span>
<span id="3"> 3</span>
<span id="4"> 4</span>
<span id="5"> 5</span>
<span id="6"> 6</span>
<span id="7"> 7</span>
<span id="8"> 8</span>
<span id="9"> 9</span>
<span id="10">10</span>
<span id="11">11</span>
<span id="12">12</span>
<span id="13">13</span>
<span id="14">14</span>
<span id="15">15</span>
<span id="16">16</span>
<span id="17">17</span>
<span id="18">18</span>
<span id="19">19</span>
<span id="20">20</span>
<span id="21">21</span>
<span id="22">22</span>
<span id="23">23</span>
<span id="24">24</span>
<span id="25">25</span>
<span id="26">26</span>
<span id="27">27</span>
<span id="28">28</span>
<span id="29">29</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="doccomment">//! # io</span>
<span class="doccomment">//!</span>
<span class="doccomment">//! IO helper functions</span>
<span class="doccomment">//!</span>
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
<span class="attribute">#[<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;./io_test.rs&quot;</span>]</span>
<span class="kw">mod</span> <span class="ident">io_test</span>;
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">types</span>::<span class="ident">error</span>::{<span class="ident">ErrorInfo</span>, <span class="ident">ScriptError</span>};
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>::<span class="ident">File</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>::<span class="ident">Read</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">read_text_file</span>(<span class="ident">file</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">ScriptError</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">file_path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="ident">file</span>);
<span class="kw">match</span> <span class="ident">File</span>::<span class="ident">open</span>(<span class="kw-2">&amp;</span><span class="ident">file_path</span>) {
<span class="prelude-val">Ok</span>(<span class="kw-2">mut</span> <span class="ident">fd</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">content</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">new</span>();
<span class="ident">fd</span>.<span class="ident">read_to_string</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">content</span>).<span class="ident">unwrap</span>();
<span class="prelude-val">Ok</span>(<span class="ident">content</span>)
}
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">ScriptError</span> {
<span class="ident">info</span>: <span class="ident">ErrorInfo</span>::<span class="ident">ErrorReadingFile</span>(<span class="ident">file</span>.<span class="ident">to_string</span>(), <span class="prelude-val">Some</span>(<span class="ident">error</span>)),
}),
}
}
</pre></div>
</section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../";window.currentCrate = "duckscript";</script><script src="../../aliases.js"></script><script src="../../main.js"></script><script src="../../source-script.js"></script><script src="../../source-files.js"></script><script defer src="../../search-index.js"></script></body></html>

View file

@ -142,7 +142,6 @@
<span id="142">142</span>
<span id="143">143</span>
<span id="144">144</span>
<span id="145">145</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="attribute">#![<span class="ident">deny</span>(
<span class="ident">absolute_paths_not_starting_with_crate</span>,
@ -270,7 +269,6 @@
<span class="doccomment">//!</span>
<span class="kw">mod</span> <span class="ident">expansion</span>;
<span class="kw">mod</span> <span class="ident">io</span>;
<span class="kw">pub</span> <span class="kw">mod</span> <span class="ident">parser</span>;
<span class="kw">mod</span> <span class="ident">preprocessor</span>;
<span class="kw">pub</span> <span class="kw">mod</span> <span class="ident">runner</span>;

View file

@ -465,6 +465,8 @@
<span id="465">465</span>
<span id="466">466</span>
<span id="467">467</span>
<span id="468">468</span>
<span id="469">469</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="doccomment">//! # parser</span>
<span class="doccomment">//!</span>
@ -475,12 +477,12 @@
<span class="attribute">#[<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;./parser_test.rs&quot;</span>]</span>
<span class="kw">mod</span> <span class="ident">parser_test</span>;
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">io</span>;
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">preprocessor</span>;
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">types</span>::<span class="ident">error</span>::{<span class="ident">ErrorInfo</span>, <span class="ident">ScriptError</span>};
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">types</span>::<span class="ident">instruction</span>::{
<span class="ident">Instruction</span>, <span class="ident">InstructionMetaInfo</span>, <span class="ident">InstructionType</span>, <span class="ident">PreProcessInstruction</span>, <span class="ident">ScriptInstruction</span>,
};
<span class="kw">use</span> <span class="ident">fsio</span>::<span class="ident">file</span>::<span class="ident">read_text_file</span>;
<span class="kw">static</span> <span class="ident">COMMENT_PREFIX_STR</span>: <span class="kw-2">&amp;</span><span class="ident">str</span> <span class="op">=</span> <span class="string">&quot;#&quot;</span>;
<span class="kw">static</span> <span class="ident">PRE_PROCESS_PREFIX</span>: <span class="ident">char</span> <span class="op">=</span> <span class="string">&#39;!&#39;</span>;
@ -491,9 +493,11 @@
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">meta_info</span> <span class="op">=</span> <span class="ident">InstructionMetaInfo</span>::<span class="ident">new</span>();
<span class="ident">meta_info</span>.<span class="ident">source</span> <span class="op">=</span> <span class="prelude-val">Some</span>(<span class="ident">file</span>.<span class="ident">to_string</span>());
<span class="kw">match</span> <span class="ident">io</span>::<span class="ident">read_text_file</span>(<span class="ident">file</span>) {
<span class="kw">match</span> <span class="ident">read_text_file</span>(<span class="ident">file</span>) {
<span class="prelude-val">Ok</span>(<span class="ident">text</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">parse_lines</span>(<span class="kw-2">&amp;</span><span class="ident">text</span>, <span class="ident">meta_info</span>),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">error</span>),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">ScriptError</span> {
<span class="ident">info</span>: <span class="ident">ErrorInfo</span>::<span class="ident">ErrorReadingFile</span>(<span class="ident">file</span>.<span class="ident">to_string</span>(), <span class="prelude-val">Some</span>(<span class="ident">error</span>)),
}),
}
}

View file

@ -121,9 +121,9 @@
<span class="doccomment">//!</span>
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">types</span>::<span class="ident">instruction</span>::<span class="ident">InstructionMetaInfo</span>;
<span class="kw">use</span> <span class="ident">fsio</span>::<span class="ident">error</span>::<span class="ident">FsIOError</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fmt</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fmt</span>::<span class="ident">Display</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>;
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
<span class="attribute">#[<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;./error_test.rs&quot;</span>]</span>
@ -150,7 +150,7 @@
<span class="doccomment">/// Holds the error information</span>
<span class="kw">pub</span> <span class="kw">enum</span> <span class="ident">ErrorInfo</span> {
<span class="doccomment">/// Error Info Type</span>
<span class="ident">ErrorReadingFile</span>(<span class="ident">String</span>, <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">io</span>::<span class="ident">Error</span><span class="op">&gt;</span>),
<span class="ident">ErrorReadingFile</span>(<span class="ident">String</span>, <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">FsIOError</span><span class="op">&gt;</span>),
<span class="doccomment">/// Error Info Type</span>
<span class="ident">Initialization</span>(<span class="ident">String</span>),
<span class="doccomment">/// Error Info Type</span>

View file

@ -79,6 +79,11 @@
<span id="79">79</span>
<span id="80">80</span>
<span id="81">81</span>
<span id="82">82</span>
<span id="83">83</span>
<span id="84">84</span>
<span id="85">85</span>
<span id="86">86</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="doccomment">//! # runtime</span>
<span class="doccomment">//!</span>
@ -91,7 +96,10 @@
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">types</span>::<span class="ident">command</span>::<span class="ident">Commands</span>;
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">types</span>::<span class="ident">instruction</span>::<span class="ident">Instruction</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">any</span>::<span class="ident">Any</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">cell</span>::<span class="ident">RefCell</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::<span class="ident">HashMap</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">rc</span>::<span class="ident">Rc</span>;
<span class="doccomment">/// enum defining what values can be stored in the state map</span>
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Debug</span>, <span class="ident">Clone</span>)]</span>
@ -118,6 +126,8 @@
<span class="ident">List</span>(<span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">StateValue</span><span class="op">&gt;</span>),
<span class="doccomment">/// sub state value</span>
<span class="ident">SubState</span>(<span class="ident">HashMap</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">StateValue</span><span class="op">&gt;</span>),
<span class="doccomment">/// any value</span>
<span class="ident">Any</span>(<span class="ident">Rc</span><span class="op">&lt;</span><span class="ident">RefCell</span><span class="op">&lt;</span><span class="kw">dyn</span> <span class="ident">Any</span><span class="op">&gt;</span><span class="op">&gt;</span>),
}
<span class="doccomment">/// The context structure</span>

View file

@ -1,3 +1,3 @@
var searchIndex={};
searchIndex["duck"] = {"doc":"duckscript_cli","i":[[5,"main","duck","",null,[[]]],[5,"run_cli","","",null,[[],[["scripterror"],["result",["scripterror"]]]]],[5,"create_context","","",null,[[],[["scripterror"],["result",["context","scripterror"]],["context"]]]],[5,"run_script","","",null,[[["str"],["bool"]],[["scripterror"],["result",["scripterror"]]]]],[5,"run_repl","","",null,[[],[["scripterror"],["result",["scripterror"]]]]],[7,"VERSION","","",null,null],[7,"AUTHOR","","",null,null],[7,"DESCRIPTION","","",null,null]],"p":[]};
searchIndex["duck"] = {"doc":"duckscript_cli","i":[[5,"main","duck","",null,[[]]],[5,"run_cli","","",null,[[],[["result",["scripterror"]],["scripterror"]]]],[5,"create_context","","",null,[[],[["scripterror"],["result",["context","scripterror"]],["context"]]]],[5,"run_script","","",null,[[["str"],["bool"]],[["result",["scripterror"]],["scripterror"]]]],[5,"run_repl","","",null,[[],[["result",["scripterror"]],["scripterror"]]]],[7,"VERSION","","",null,null],[7,"AUTHOR","","",null,null],[7,"DESCRIPTION","","",null,null]],"p":[]};
addSearchOptions(searchIndex);initSearch(searchIndex);

View file

@ -1,3 +1,3 @@
var searchIndex={};
searchIndex["duckscriptsdk"] = {"doc":"duckscript_sdk","i":[[5,"version","duckscriptsdk","Returns the library version.",null,[[],["string"]]],[5,"load","","Loads all core commands",null,[[["commands"]],[["scripterror"],["result",["scripterror"]]]]]],"p":[]};
searchIndex["duckscriptsdk"] = {"doc":"duckscript_sdk","i":[[5,"version","duckscriptsdk","Returns the library version.",null,[[],["string"]]],[5,"load","","Loads all core commands",null,[[["commands"]],[["result",["scripterror"]],["scripterror"]]]]],"p":[]};
addSearchOptions(searchIndex);initSearch(searchIndex);

File diff suppressed because one or more lines are too long

View file

@ -42,9 +42,11 @@
<span id="42">42</span>
<span id="43">43</span>
<span id="44">44</span>
<span id="45">45</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::{<span class="ident">io</span>, <span class="ident">pckg</span>};
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::<span class="ident">pckg</span>;
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">command</span>::{<span class="ident">Command</span>, <span class="ident">CommandResult</span>};
<span class="kw">use</span> <span class="ident">fsio</span>::<span class="ident">path</span>::<span class="ident">get_basename</span>;
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
<span class="attribute">#[<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;./mod_test.rs&quot;</span>]</span>
@ -76,7 +78,7 @@
<span class="kw">if</span> <span class="ident">arguments</span>.<span class="ident">is_empty</span>() {
<span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="string">&quot;Path not provided.&quot;</span>.<span class="ident">to_string</span>())
} <span class="kw">else</span> {
<span class="kw">let</span> <span class="ident">basename</span> <span class="op">=</span> <span class="ident">io</span>::<span class="ident">get_base_name</span>(<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">0</span>]);
<span class="kw">let</span> <span class="ident">basename</span> <span class="op">=</span> <span class="ident">get_basename</span>(<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">0</span>]);
<span class="ident">CommandResult</span>::<span class="ident">Continue</span>(<span class="ident">basename</span>)
}
}

View file

@ -43,9 +43,11 @@
<span id="43">43</span>
<span id="44">44</span>
<span id="45">45</span>
<span id="46">46</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::{<span class="ident">io</span>, <span class="ident">pckg</span>};
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::<span class="ident">pckg</span>;
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">command</span>::{<span class="ident">Command</span>, <span class="ident">CommandResult</span>};
<span class="kw">use</span> <span class="ident">fsio</span>::<span class="ident">path</span>::<span class="ident">canonicalize_or</span>;
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
<span class="attribute">#[<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;./mod_test.rs&quot;</span>]</span>
@ -77,7 +79,7 @@
<span class="kw">if</span> <span class="ident">arguments</span>.<span class="ident">is_empty</span>() {
<span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="string">&quot;Path not provided.&quot;</span>.<span class="ident">to_string</span>())
} <span class="kw">else</span> {
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">io</span>::<span class="ident">get_canonical_path</span>(<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">0</span>]);
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">canonicalize_or</span>(<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">0</span>], <span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">0</span>]);
<span class="ident">CommandResult</span>::<span class="ident">Continue</span>(<span class="prelude-val">Some</span>(<span class="ident">path</span>.<span class="ident">to_string</span>()))
}

View file

@ -74,10 +74,12 @@
<span id="74">74</span>
<span id="75">75</span>
<span id="76">76</span>
<span id="77">77</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::{<span class="ident">io</span>, <span class="ident">pckg</span>};
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::<span class="ident">pckg</span>;
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">command</span>::{<span class="ident">Command</span>, <span class="ident">CommandResult</span>};
<span class="kw">use</span> <span class="ident">fs_extra</span>::<span class="ident">dir</span>;
<span class="kw">use</span> <span class="ident">fsio</span>::<span class="ident">directory</span>::<span class="ident">create_parent</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;
@ -121,7 +123,7 @@
<span class="kw">let</span> <span class="ident">target_path_str</span> <span class="op">=</span> <span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">1</span>];
<span class="kw">if</span> <span class="ident">source_file</span> {
<span class="kw">match</span> <span class="ident">io</span>::<span class="ident">create_parent_directory</span>(<span class="ident">target_path_str</span>) {
<span class="kw">match</span> <span class="ident">create_parent</span>(<span class="ident">target_path_str</span>) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="kw">match</span> <span class="ident">fs</span>::<span class="ident">copy</span>(<span class="ident">source_path_str</span>, <span class="ident">target_path_str</span>) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Continue</span>(<span class="prelude-val">Some</span>(<span class="string">&quot;true&quot;</span>.<span class="ident">to_string</span>())),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="ident">error</span>.<span class="ident">to_string</span>()),
@ -129,7 +131,7 @@
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="ident">error</span>.<span class="ident">to_string</span>()),
}
} <span class="kw">else</span> {
<span class="kw">match</span> <span class="ident">io</span>::<span class="ident">create_directory</span>(<span class="ident">target_path_str</span>) {
<span class="kw">match</span> <span class="ident">fsio</span>::<span class="ident">directory</span>::<span class="ident">create</span>(<span class="ident">target_path_str</span>) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">options</span> <span class="op">=</span> <span class="ident">dir</span>::<span class="ident">CopyOptions</span>::<span class="ident">new</span>();

View file

@ -42,9 +42,11 @@
<span id="42">42</span>
<span id="43">43</span>
<span id="44">44</span>
<span id="45">45</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::{<span class="ident">io</span>, <span class="ident">pckg</span>};
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::<span class="ident">pckg</span>;
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">command</span>::{<span class="ident">Command</span>, <span class="ident">CommandResult</span>};
<span class="kw">use</span> <span class="ident">fsio</span>::<span class="ident">path</span>::<span class="ident">get_parent_directory</span>;
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
<span class="attribute">#[<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;./mod_test.rs&quot;</span>]</span>
@ -76,7 +78,7 @@
<span class="kw">if</span> <span class="ident">arguments</span>.<span class="ident">is_empty</span>() {
<span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="string">&quot;Path not provided.&quot;</span>.<span class="ident">to_string</span>())
} <span class="kw">else</span> {
<span class="kw">let</span> <span class="ident">parent_path</span> <span class="op">=</span> <span class="ident">io</span>::<span class="ident">get_parent_directory_name</span>(<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">0</span>]);
<span class="kw">let</span> <span class="ident">parent_path</span> <span class="op">=</span> <span class="ident">get_parent_directory</span>(<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">0</span>]);
<span class="ident">CommandResult</span>::<span class="ident">Continue</span>(<span class="ident">parent_path</span>)
}
}

View file

@ -160,10 +160,12 @@
<span id="160">160</span>
<span id="161">161</span>
<span id="162">162</span>
<span id="163">163</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::{<span class="ident">flags</span>, <span class="ident">io</span>, <span class="ident">pckg</span>};
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::{<span class="ident">flags</span>, <span class="ident">pckg</span>};
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">command</span>::{<span class="ident">Command</span>, <span class="ident">CommandResult</span>};
<span class="kw">use</span> <span class="ident">fs_extra</span>::<span class="ident">dir</span>::{<span class="ident">ls</span>, <span class="ident">DirEntryAttr</span>, <span class="ident">DirEntryValue</span>};
<span class="kw">use</span> <span class="ident">fsio</span>::<span class="ident">path</span>::{<span class="ident">get_basename</span>, <span class="ident">get_parent_directory</span>};
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">collections</span>::{<span class="ident">HashMap</span>, <span class="ident">HashSet</span>};
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;
@ -276,7 +278,7 @@
}
<span class="kw">let</span> (<span class="ident">is_file</span>, <span class="ident">query_path</span>) <span class="op">=</span> <span class="kw">if</span> <span class="ident">path</span>.<span class="ident">is_file</span>() {
<span class="kw">match</span> <span class="ident">io</span>::<span class="ident">get_parent_directory_name</span>(<span class="ident">path_str</span>) {
<span class="kw">match</span> <span class="ident">get_parent_directory</span>(<span class="ident">path_str</span>) {
<span class="prelude-val">Some</span>(<span class="ident">value</span>) <span class="op">=</span><span class="op">&gt;</span> (<span class="bool-val">true</span>, <span class="ident">value</span>),
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> <span class="kw">return</span> <span class="ident">CommandResult</span>::<span class="ident">Continue</span>(<span class="prelude-val">Some</span>(<span class="string">&quot;false&quot;</span>.<span class="ident">to_string</span>())),
}
@ -291,7 +293,7 @@
<span class="kw">let</span> <span class="ident">items</span> <span class="op">=</span> <span class="ident">ls_result</span>.<span class="ident">items</span>;
<span class="kw">if</span> <span class="ident">is_file</span> {
<span class="kw">let</span> <span class="ident">file_name</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">io</span>::<span class="ident">get_base_name</span>(<span class="ident">path_str</span>) {
<span class="kw">let</span> <span class="ident">file_name</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">get_basename</span>(<span class="ident">path_str</span>) {
<span class="prelude-val">Some</span>(<span class="ident">value</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">value</span>,
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> <span class="ident">path_str</span>.<span class="ident">to_string</span>(),
};

View file

@ -44,9 +44,11 @@
<span id="44">44</span>
<span id="45">45</span>
<span id="46">46</span>
<span id="47">47</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::{<span class="ident">io</span>, <span class="ident">pckg</span>};
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::<span class="ident">pckg</span>;
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">command</span>::{<span class="ident">Command</span>, <span class="ident">CommandResult</span>};
<span class="kw">use</span> <span class="ident">fsio</span>;
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
<span class="attribute">#[<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;./mod_test.rs&quot;</span>]</span>
@ -78,7 +80,7 @@
<span class="kw">if</span> <span class="ident">arguments</span>.<span class="ident">is_empty</span>() {
<span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="string">&quot;Directory name not provided.&quot;</span>.<span class="ident">to_string</span>())
} <span class="kw">else</span> {
<span class="kw">match</span> <span class="ident">io</span>::<span class="ident">create_directory</span>(<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">0</span>]) {
<span class="kw">match</span> <span class="ident">fsio</span>::<span class="ident">directory</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">0</span>]) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Continue</span>(<span class="prelude-val">Some</span>(<span class="string">&quot;true&quot;</span>.<span class="ident">to_string</span>())),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="ident">error</span>.<span class="ident">to_string</span>()),
}

View file

@ -43,6 +43,8 @@
<span id="43">43</span>
<span id="44">44</span>
<span id="45">45</span>
<span id="46">46</span>
<span id="47">47</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">mod</span> <span class="ident">append</span>;
<span class="kw">mod</span> <span class="ident">basename</span>;
@ -57,6 +59,7 @@
<span class="kw">mod</span> <span class="ident">read_text</span>;
<span class="kw">mod</span> <span class="ident">rm</span>;
<span class="kw">mod</span> <span class="ident">rmdir</span>;
<span class="kw">mod</span> <span class="ident">temp_file</span>;
<span class="kw">mod</span> <span class="ident">touch</span>;
<span class="kw">mod</span> <span class="ident">write_bytes</span>;
<span class="kw">mod</span> <span class="ident">write_text</span>;
@ -83,6 +86,7 @@
<span class="ident">commands</span>.<span class="ident">set</span>(<span class="ident">read_text</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">package</span>))<span class="question-mark">?</span>;
<span class="ident">commands</span>.<span class="ident">set</span>(<span class="ident">rm</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">package</span>))<span class="question-mark">?</span>;
<span class="ident">commands</span>.<span class="ident">set</span>(<span class="ident">rmdir</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">package</span>))<span class="question-mark">?</span>;
<span class="ident">commands</span>.<span class="ident">set</span>(<span class="ident">temp_file</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">package</span>))<span class="question-mark">?</span>;
<span class="ident">commands</span>.<span class="ident">set</span>(<span class="ident">touch</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">package</span>))<span class="question-mark">?</span>;
<span class="ident">commands</span>.<span class="ident">set</span>(<span class="ident">write_bytes</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">package</span>))<span class="question-mark">?</span>;
<span class="ident">commands</span>.<span class="ident">set</span>(<span class="ident">write_text</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">package</span>))<span class="question-mark">?</span>;

View file

@ -71,10 +71,12 @@
<span id="71">71</span>
<span id="72">72</span>
<span id="73">73</span>
<span id="74">74</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::{<span class="ident">io</span>, <span class="ident">pckg</span>};
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::<span class="ident">pckg</span>;
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">command</span>::{<span class="ident">Command</span>, <span class="ident">CommandResult</span>};
<span class="kw">use</span> <span class="ident">fs_extra</span>::{<span class="ident">dir</span>, <span class="ident">move_items</span>};
<span class="kw">use</span> <span class="ident">fsio</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;
@ -123,7 +125,7 @@
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="ident">error</span>.<span class="ident">to_string</span>()),
}
} <span class="kw">else</span> {
<span class="kw">match</span> <span class="ident">io</span>::<span class="ident">create_directory</span>(<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">1</span>]) {
<span class="kw">match</span> <span class="ident">fsio</span>::<span class="ident">directory</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">1</span>]) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">options</span> <span class="op">=</span> <span class="ident">dir</span>::<span class="ident">CopyOptions</span>::<span class="ident">new</span>();
<span class="kw">let</span> <span class="ident">from_paths</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">0</span>]];

View file

@ -0,0 +1,105 @@
<!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="Source to the Rust file `duckscript_sdk/src/sdk/std/fs/temp_file/mod.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>mod.rs.html -- source</title><link rel="stylesheet" type="text/css" href="../../../../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../../../../light.css" id="themeStyle"><script src="../../../../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../../../../down-arrow.svg");}</style></head><body class="rustdoc source"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../../../../duckscriptsdk/index.html'><div class='logo-container'><img src='../../../../../../rust-logo.png' alt='logo'></div></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../../../../settings.html"><img src="../../../../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><pre class="line-numbers"><span id="1"> 1</span>
<span id="2"> 2</span>
<span id="3"> 3</span>
<span id="4"> 4</span>
<span id="5"> 5</span>
<span id="6"> 6</span>
<span id="7"> 7</span>
<span id="8"> 8</span>
<span id="9"> 9</span>
<span id="10">10</span>
<span id="11">11</span>
<span id="12">12</span>
<span id="13">13</span>
<span id="14">14</span>
<span id="15">15</span>
<span id="16">16</span>
<span id="17">17</span>
<span id="18">18</span>
<span id="19">19</span>
<span id="20">20</span>
<span id="21">21</span>
<span id="22">22</span>
<span id="23">23</span>
<span id="24">24</span>
<span id="25">25</span>
<span id="26">26</span>
<span id="27">27</span>
<span id="28">28</span>
<span id="29">29</span>
<span id="30">30</span>
<span id="31">31</span>
<span id="32">32</span>
<span id="33">33</span>
<span id="34">34</span>
<span id="35">35</span>
<span id="36">36</span>
<span id="37">37</span>
<span id="38">38</span>
<span id="39">39</span>
<span id="40">40</span>
<span id="41">41</span>
<span id="42">42</span>
<span id="43">43</span>
<span id="44">44</span>
<span id="45">45</span>
<span id="46">46</span>
<span id="47">47</span>
<span id="48">48</span>
<span id="49">49</span>
<span id="50">50</span>
<span id="51">51</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::{<span class="ident">io</span>, <span class="ident">pckg</span>};
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">command</span>::{<span class="ident">Command</span>, <span class="ident">CommandResult</span>};
<span class="kw">use</span> <span class="ident">fsio</span>::<span class="ident">path</span>::<span class="ident">get_temporary_file_path</span>;
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
<span class="attribute">#[<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;./mod_test.rs&quot;</span>]</span>
<span class="kw">mod</span> <span class="ident">mod_test</span>;
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Clone</span>)]</span>
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct</span> <span class="ident">CommandImpl</span> {
<span class="ident">package</span>: <span class="ident">String</span>,
}
<span class="kw">impl</span> <span class="ident">Command</span> <span class="kw">for</span> <span class="ident">CommandImpl</span> {
<span class="kw">fn</span> <span class="ident">name</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">String</span> {
<span class="ident">pckg</span>::<span class="ident">concat</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">package</span>, <span class="string">&quot;TempFile&quot;</span>)
}
<span class="kw">fn</span> <span class="ident">aliases</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span> {
<span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;temp_file&quot;</span>.<span class="ident">to_string</span>()]
}
<span class="kw">fn</span> <span class="ident">help</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">String</span> {
<span class="macro">include_str</span><span class="macro">!</span>(<span class="string">&quot;help.md&quot;</span>).<span class="ident">to_string</span>()
}
<span class="kw">fn</span> <span class="ident">clone_and_box</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Box</span><span class="op">&lt;</span><span class="kw">dyn</span> <span class="ident">Command</span><span class="op">&gt;</span> {
<span class="ident">Box</span>::<span class="ident">new</span>((<span class="kw-2">*</span><span class="self">self</span>).<span class="ident">clone</span>())
}
<span class="kw">fn</span> <span class="ident">run</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">arguments</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">CommandResult</span> {
<span class="kw">let</span> <span class="ident">extension</span> <span class="op">=</span> <span class="kw">if</span> <span class="ident">arguments</span>.<span class="ident">is_empty</span>() {
<span class="string">&quot;tmp&quot;</span>
} <span class="kw">else</span> {
<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">0</span>]
};
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">get_temporary_file_path</span>(<span class="ident">extension</span>);
<span class="kw">match</span> <span class="ident">io</span>::<span class="ident">create_empty_file</span>(<span class="kw-2">&amp;</span><span class="ident">path</span>) {
<span class="prelude-val">Ok</span>(()) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Continue</span>(<span class="prelude-val">Some</span>(<span class="ident">path</span>)),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="ident">error</span>),
}
}
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">create</span>(<span class="ident">package</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Box</span><span class="op">&lt;</span><span class="kw">dyn</span> <span class="ident">Command</span><span class="op">&gt;</span> {
<span class="ident">Box</span>::<span class="ident">new</span>(<span class="ident">CommandImpl</span> {
<span class="ident">package</span>: <span class="ident">package</span>.<span class="ident">to_string</span>(),
})
}
</pre></div>
</section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../../../../../";window.currentCrate = "duckscriptsdk";</script><script src="../../../../../../aliases.js"></script><script src="../../../../../../main.js"></script><script src="../../../../../../source-script.js"></script><script src="../../../../../../source-files.js"></script><script defer src="../../../../../../search-index.js"></script></body></html>

View file

@ -171,10 +171,14 @@
<span id="171">171</span>
<span id="172">172</span>
<span id="173">173</span>
<span id="174">174</span>
<span id="175">175</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::{<span class="ident">io</span>, <span class="ident">pckg</span>};
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::<span class="ident">pckg</span>;
<span class="kw">use</span> <span class="ident">attohttpc</span>;
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">command</span>::{<span class="ident">Command</span>, <span class="ident">CommandResult</span>};
<span class="kw">use</span> <span class="ident">fsio</span>::<span class="ident">directory</span>::<span class="ident">create_parent</span>;
<span class="kw">use</span> <span class="ident">fsio</span>::<span class="ident">file</span>::<span class="ident">delete</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>::<span class="ident">File</span>;
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
@ -270,8 +274,8 @@
<span class="prelude-val">Ok</span>(<span class="ident">response</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">if</span> <span class="ident">response</span>.<span class="ident">is_success</span>() {
<span class="kw">match</span> <span class="ident">options</span>.<span class="ident">output_file</span> {
<span class="prelude-val">Some</span>(<span class="ident">file</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="kw">match</span> <span class="ident">io</span>::<span class="ident">create_parent_directory</span>(<span class="kw-2">&amp;</span><span class="ident">file</span>) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="kw">match</span> <span class="ident">io</span>::<span class="ident">delete_file</span>(<span class="kw-2">&amp;</span><span class="ident">file</span>) {
<span class="prelude-val">Some</span>(<span class="ident">file</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="kw">match</span> <span class="ident">create_parent</span>(<span class="kw-2">&amp;</span><span class="ident">file</span>) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="kw">match</span> <span class="ident">delete</span>(<span class="kw-2">&amp;</span><span class="ident">file</span>) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="kw">match</span> <span class="ident">File</span>::<span class="ident">create</span>(<span class="ident">file</span>) {
<span class="prelude-val">Ok</span>(<span class="ident">file_struct</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="kw">match</span> <span class="ident">response</span>.<span class="ident">write_to</span>(<span class="ident">file_struct</span>) {
<span class="prelude-val">Ok</span>(<span class="ident">size</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Continue</span>(<span class="prelude-val">Some</span>(<span class="ident">size</span>.<span class="ident">to_string</span>())),
@ -279,7 +283,7 @@
},
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="ident">error</span>.<span class="ident">to_string</span>()),
},
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="ident">error</span>),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="ident">error</span>.<span class="ident">to_string</span>()),
},
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="ident">error</span>.<span class="ident">to_string</span>()),
},

View file

@ -19,10 +19,13 @@
<span id="19">19</span>
<span id="20">20</span>
<span id="21">21</span>
<span id="22">22</span>
<span id="23">23</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">mod</span> <span class="ident">exec</span>;
<span class="kw">mod</span> <span class="ident">exit</span>;
<span class="kw">mod</span> <span class="ident">process_id</span>;
<span class="kw">mod</span> <span class="ident">spawn</span>;
<span class="kw">mod</span> <span class="ident">watchdog</span>;
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::<span class="ident">pckg</span>;
@ -37,6 +40,7 @@
<span class="ident">commands</span>.<span class="ident">set</span>(<span class="ident">exec</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">package</span>))<span class="question-mark">?</span>;
<span class="ident">commands</span>.<span class="ident">set</span>(<span class="ident">exit</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">package</span>))<span class="question-mark">?</span>;
<span class="ident">commands</span>.<span class="ident">set</span>(<span class="ident">process_id</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">package</span>))<span class="question-mark">?</span>;
<span class="ident">commands</span>.<span class="ident">set</span>(<span class="ident">spawn</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">package</span>))<span class="question-mark">?</span>;
<span class="ident">commands</span>.<span class="ident">set</span>(<span class="ident">watchdog</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">package</span>))<span class="question-mark">?</span>;
<span class="prelude-val">Ok</span>(())

View file

@ -0,0 +1,95 @@
<!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="Source to the Rust file `duckscript_sdk/src/sdk/std/process/spawn/mod.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>mod.rs.html -- source</title><link rel="stylesheet" type="text/css" href="../../../../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../../../../light.css" id="themeStyle"><script src="../../../../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../../../../down-arrow.svg");}</style></head><body class="rustdoc source"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../../../../duckscriptsdk/index.html'><div class='logo-container'><img src='../../../../../../rust-logo.png' alt='logo'></div></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../../../../settings.html"><img src="../../../../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><pre class="line-numbers"><span id="1"> 1</span>
<span id="2"> 2</span>
<span id="3"> 3</span>
<span id="4"> 4</span>
<span id="5"> 5</span>
<span id="6"> 6</span>
<span id="7"> 7</span>
<span id="8"> 8</span>
<span id="9"> 9</span>
<span id="10">10</span>
<span id="11">11</span>
<span id="12">12</span>
<span id="13">13</span>
<span id="14">14</span>
<span id="15">15</span>
<span id="16">16</span>
<span id="17">17</span>
<span id="18">18</span>
<span id="19">19</span>
<span id="20">20</span>
<span id="21">21</span>
<span id="22">22</span>
<span id="23">23</span>
<span id="24">24</span>
<span id="25">25</span>
<span id="26">26</span>
<span id="27">27</span>
<span id="28">28</span>
<span id="29">29</span>
<span id="30">30</span>
<span id="31">31</span>
<span id="32">32</span>
<span id="33">33</span>
<span id="34">34</span>
<span id="35">35</span>
<span id="36">36</span>
<span id="37">37</span>
<span id="38">38</span>
<span id="39">39</span>
<span id="40">40</span>
<span id="41">41</span>
<span id="42">42</span>
<span id="43">43</span>
<span id="44">44</span>
<span id="45">45</span>
<span id="46">46</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::{<span class="ident">exec</span>, <span class="ident">pckg</span>};
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">command</span>::{<span class="ident">Command</span>, <span class="ident">CommandResult</span>};
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
<span class="attribute">#[<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;./mod_test.rs&quot;</span>]</span>
<span class="kw">mod</span> <span class="ident">mod_test</span>;
<span class="attribute">#[<span class="ident">derive</span>(<span class="ident">Clone</span>)]</span>
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">struct</span> <span class="ident">CommandImpl</span> {
<span class="ident">package</span>: <span class="ident">String</span>,
}
<span class="kw">impl</span> <span class="ident">Command</span> <span class="kw">for</span> <span class="ident">CommandImpl</span> {
<span class="kw">fn</span> <span class="ident">name</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">String</span> {
<span class="ident">pckg</span>::<span class="ident">concat</span>(<span class="kw-2">&amp;</span><span class="self">self</span>.<span class="ident">package</span>, <span class="string">&quot;Spawn&quot;</span>)
}
<span class="kw">fn</span> <span class="ident">aliases</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span> {
<span class="macro">vec</span><span class="macro">!</span>[<span class="string">&quot;spawn&quot;</span>.<span class="ident">to_string</span>()]
}
<span class="kw">fn</span> <span class="ident">help</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">String</span> {
<span class="macro">include_str</span><span class="macro">!</span>(<span class="string">&quot;help.md&quot;</span>).<span class="ident">to_string</span>()
}
<span class="kw">fn</span> <span class="ident">clone_and_box</span>(<span class="kw-2">&amp;</span><span class="self">self</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Box</span><span class="op">&lt;</span><span class="kw">dyn</span> <span class="ident">Command</span><span class="op">&gt;</span> {
<span class="ident">Box</span>::<span class="ident">new</span>((<span class="kw-2">*</span><span class="self">self</span>).<span class="ident">clone</span>())
}
<span class="kw">fn</span> <span class="ident">run</span>(<span class="kw-2">&amp;</span><span class="self">self</span>, <span class="ident">arguments</span>: <span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">CommandResult</span> {
<span class="kw">match</span> <span class="ident">exec</span>::<span class="ident">spawn</span>(<span class="kw-2">&amp;</span><span class="ident">arguments</span>, <span class="bool-val">false</span>, <span class="bool-val">false</span>, <span class="number">0</span>) {
<span class="prelude-val">Ok</span>(<span class="ident">child</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">pid</span> <span class="op">=</span> <span class="ident">child</span>.<span class="ident">id</span>();
<span class="ident">CommandResult</span>::<span class="ident">Continue</span>(<span class="prelude-val">Some</span>(<span class="ident">pid</span>.<span class="ident">to_string</span>()))
}
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">CommandResult</span>::<span class="ident">Error</span>(<span class="ident">error</span>),
}
}
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">create</span>(<span class="ident">package</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">Box</span><span class="op">&lt;</span><span class="kw">dyn</span> <span class="ident">Command</span><span class="op">&gt;</span> {
<span class="ident">Box</span>::<span class="ident">new</span>(<span class="ident">CommandImpl</span> {
<span class="ident">package</span>: <span class="ident">package</span>.<span class="ident">to_string</span>(),
})
}
</pre></div>
</section><section id="search" class="content hidden"></section><section class="footer"></section><script>window.rootPath = "../../../../../../";window.currentCrate = "duckscriptsdk";</script><script src="../../../../../../aliases.js"></script><script src="../../../../../../main.js"></script><script src="../../../../../../source-script.js"></script><script src="../../../../../../source-files.js"></script><script defer src="../../../../../../search-index.js"></script></body></html>

View file

@ -102,11 +102,9 @@
<span id="102">102</span>
<span id="103">103</span>
<span id="104">104</span>
<span id="105">105</span>
<span id="106">106</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::<span class="ident">pckg</span>;
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::<span class="ident">state</span>::<span class="ident">get_handles_sub_state</span>;
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::<span class="ident">state</span>::<span class="ident">remove_handle</span>;
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">command</span>::{<span class="ident">Command</span>, <span class="ident">CommandResult</span>, <span class="ident">Commands</span>};
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">instruction</span>::<span class="ident">Instruction</span>;
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">runtime</span>::<span class="ident">StateValue</span>;
@ -117,7 +115,7 @@
<span class="kw">mod</span> <span class="ident">mod_test</span>;
<span class="kw">fn</span> <span class="ident">remove</span>(<span class="ident">state</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">HashMap</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">StateValue</span><span class="op">&gt;</span>, <span class="ident">key</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>, <span class="ident">recursive</span>: <span class="ident">bool</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">bool</span> {
<span class="kw">match</span> <span class="ident">state</span>.<span class="ident">remove</span>(<span class="ident">key</span>) {
<span class="kw">match</span> <span class="ident">remove_handle</span>(<span class="ident">state</span>, <span class="ident">key</span>.<span class="ident">to_string</span>()) {
<span class="prelude-val">Some</span>(<span class="ident">state_value</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">if</span> <span class="ident">recursive</span> {
<span class="kw">match</span> <span class="ident">state_value</span> {
@ -190,8 +188,6 @@
<span class="kw">if</span> <span class="ident">arguments</span>.<span class="ident">is_empty</span>() {
<span class="ident">CommandResult</span>::<span class="ident">Continue</span>(<span class="prelude-val">Some</span>(<span class="string">&quot;false&quot;</span>.<span class="ident">to_string</span>()))
} <span class="kw">else</span> {
<span class="kw">let</span> <span class="ident">state</span> <span class="op">=</span> <span class="ident">get_handles_sub_state</span>(<span class="ident">state</span>);
<span class="kw">let</span> (<span class="ident">key</span>, <span class="ident">recursive</span>) <span class="op">=</span>
<span class="kw">if</span> <span class="ident">arguments</span>.<span class="ident">len</span>() <span class="op">&gt;</span> <span class="number">1</span> <span class="kw-2">&amp;</span><span class="op">&amp;</span> (<span class="ident">arguments</span>[<span class="number">0</span>] <span class="op">=</span><span class="op">=</span> <span class="string">&quot;-r&quot;</span> <span class="op">|</span><span class="op">|</span> <span class="ident">arguments</span>[<span class="number">0</span>] <span class="op">=</span><span class="op">=</span> <span class="string">&quot;--recursive&quot;</span>) {
(<span class="ident">arguments</span>[<span class="number">1</span>].<span class="ident">to_string</span>(), <span class="bool-val">true</span>)

View file

@ -52,9 +52,32 @@
<span id="52">52</span>
<span id="53">53</span>
<span id="54">54</span>
<span id="55">55</span>
<span id="56">56</span>
<span id="57">57</span>
<span id="58">58</span>
<span id="59">59</span>
<span id="60">60</span>
<span id="61">61</span>
<span id="62">62</span>
<span id="63">63</span>
<span id="64">64</span>
<span id="65">65</span>
<span id="66">66</span>
<span id="67">67</span>
<span id="68">68</span>
<span id="69">69</span>
<span id="70">70</span>
<span id="71">71</span>
<span id="72">72</span>
<span id="73">73</span>
<span id="74">74</span>
<span id="75">75</span>
<span id="76">76</span>
<span id="77">77</span>
<span id="78">78</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">process</span>::<span class="ident">Command</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">process</span>::<span class="ident">Stdio</span>;
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">process</span>::{<span class="ident">Child</span>, <span class="ident">Command</span>, <span class="ident">Stdio</span>};
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
<span class="attribute">#[<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;./exec_test.rs&quot;</span>]</span>
@ -66,6 +89,49 @@
<span class="ident">allow_input</span>: <span class="ident">bool</span>,
<span class="ident">start_index</span>: <span class="ident">usize</span>,
) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>(<span class="ident">String</span>, <span class="ident">String</span>, <span class="ident">i32</span>), <span class="ident">String</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">command</span> <span class="op">=</span> <span class="ident">create_command</span>(<span class="ident">arguments</span>, <span class="ident">print_output</span>, <span class="ident">allow_input</span>, <span class="ident">start_index</span>)<span class="question-mark">?</span>;
<span class="kw">match</span> <span class="ident">command</span>.<span class="ident">output</span>() {
<span class="prelude-val">Ok</span>(<span class="kw-2">ref</span> <span class="ident">output</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">stdout</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">from_utf8_lossy</span>(<span class="kw-2">&amp;</span><span class="ident">output</span>.<span class="ident">stdout</span>).<span class="ident">into_owned</span>();
<span class="kw">let</span> <span class="ident">stderr</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">from_utf8_lossy</span>(<span class="kw-2">&amp;</span><span class="ident">output</span>.<span class="ident">stderr</span>).<span class="ident">into_owned</span>();
<span class="kw">let</span> <span class="ident">exit_code</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">output</span>.<span class="ident">status</span>.<span class="ident">code</span>() {
<span class="prelude-val">Some</span>(<span class="ident">value</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">value</span>,
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="macro">format</span><span class="macro">!</span>(
<span class="string">&quot;Unable to extract exit code for command: {}&quot;</span>,
<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">0</span>]
)
.<span class="ident">to_string</span>());
}
};
<span class="prelude-val">Ok</span>((<span class="ident">stdout</span>, <span class="ident">stderr</span>, <span class="ident">exit_code</span>))
}
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">error</span>.<span class="ident">to_string</span>()),
}
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">spawn</span>(
<span class="ident">arguments</span>: <span class="kw-2">&amp;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>,
<span class="ident">print_output</span>: <span class="ident">bool</span>,
<span class="ident">allow_input</span>: <span class="ident">bool</span>,
<span class="ident">start_index</span>: <span class="ident">usize</span>,
) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="ident">Child</span>, <span class="ident">String</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">command</span> <span class="op">=</span> <span class="ident">create_command</span>(<span class="ident">arguments</span>, <span class="ident">print_output</span>, <span class="ident">allow_input</span>, <span class="ident">start_index</span>)<span class="question-mark">?</span>;
<span class="kw">match</span> <span class="ident">command</span>.<span class="ident">spawn</span>() {
<span class="prelude-val">Ok</span>(<span class="ident">child</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Ok</span>(<span class="ident">child</span>),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">error</span>.<span class="ident">to_string</span>()),
}
}
<span class="kw">fn</span> <span class="ident">create_command</span>(
<span class="ident">arguments</span>: <span class="kw-2">&amp;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span>,
<span class="ident">print_output</span>: <span class="ident">bool</span>,
<span class="ident">allow_input</span>: <span class="ident">bool</span>,
<span class="ident">start_index</span>: <span class="ident">usize</span>,
) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="ident">Command</span>, <span class="ident">String</span><span class="op">&gt;</span> {
<span class="kw">if</span> <span class="ident">arguments</span>.<span class="ident">len</span>() <span class="op">&lt;</span><span class="op">=</span> <span class="ident">start_index</span> {
<span class="prelude-val">Err</span>(<span class="string">&quot;Command not provided.&quot;</span>.<span class="ident">to_string</span>())
} <span class="kw">else</span> {
@ -86,25 +152,7 @@
<span class="ident">command</span>.<span class="ident">stdout</span>(<span class="ident">Stdio</span>::<span class="ident">inherit</span>()).<span class="ident">stderr</span>(<span class="ident">Stdio</span>::<span class="ident">inherit</span>());
}
<span class="kw">match</span> <span class="ident">command</span>.<span class="ident">output</span>() {
<span class="prelude-val">Ok</span>(<span class="kw-2">ref</span> <span class="ident">output</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">stdout</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">from_utf8_lossy</span>(<span class="kw-2">&amp;</span><span class="ident">output</span>.<span class="ident">stdout</span>).<span class="ident">into_owned</span>();
<span class="kw">let</span> <span class="ident">stderr</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">from_utf8_lossy</span>(<span class="kw-2">&amp;</span><span class="ident">output</span>.<span class="ident">stderr</span>).<span class="ident">into_owned</span>();
<span class="kw">let</span> <span class="ident">exit_code</span> <span class="op">=</span> <span class="kw">match</span> <span class="ident">output</span>.<span class="ident">status</span>.<span class="ident">code</span>() {
<span class="prelude-val">Some</span>(<span class="ident">value</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">value</span>,
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="macro">format</span><span class="macro">!</span>(
<span class="string">&quot;Unable to extract exit code for command: {}&quot;</span>,
<span class="kw-2">&amp;</span><span class="ident">arguments</span>[<span class="number">0</span>]
)
.<span class="ident">to_string</span>());
}
};
<span class="prelude-val">Ok</span>((<span class="ident">stdout</span>, <span class="ident">stderr</span>, <span class="ident">exit_code</span>))
}
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">error</span>.<span class="ident">to_string</span>()),
}
<span class="prelude-val">Ok</span>(<span class="ident">command</span>)
}
}
</pre></div>

View file

@ -1,293 +1,68 @@
<!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="Source to the Rust file `duckscript_sdk/src/utils/io.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>io.rs.html -- source</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc source"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../duckscriptsdk/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><pre class="line-numbers"><span id="1"> 1</span>
<span id="2"> 2</span>
<span id="3"> 3</span>
<span id="4"> 4</span>
<span id="5"> 5</span>
<span id="6"> 6</span>
<span id="7"> 7</span>
<span id="8"> 8</span>
<span id="9"> 9</span>
<span id="10"> 10</span>
<span id="11"> 11</span>
<span id="12"> 12</span>
<span id="13"> 13</span>
<span id="14"> 14</span>
<span id="15"> 15</span>
<span id="16"> 16</span>
<span id="17"> 17</span>
<span id="18"> 18</span>
<span id="19"> 19</span>
<span id="20"> 20</span>
<span id="21"> 21</span>
<span id="22"> 22</span>
<span id="23"> 23</span>
<span id="24"> 24</span>
<span id="25"> 25</span>
<span id="26"> 26</span>
<span id="27"> 27</span>
<span id="28"> 28</span>
<span id="29"> 29</span>
<span id="30"> 30</span>
<span id="31"> 31</span>
<span id="32"> 32</span>
<span id="33"> 33</span>
<span id="34"> 34</span>
<span id="35"> 35</span>
<span id="36"> 36</span>
<span id="37"> 37</span>
<span id="38"> 38</span>
<span id="39"> 39</span>
<span id="40"> 40</span>
<span id="41"> 41</span>
<span id="42"> 42</span>
<span id="43"> 43</span>
<span id="44"> 44</span>
<span id="45"> 45</span>
<span id="46"> 46</span>
<span id="47"> 47</span>
<span id="48"> 48</span>
<span id="49"> 49</span>
<span id="50"> 50</span>
<span id="51"> 51</span>
<span id="52"> 52</span>
<span id="53"> 53</span>
<span id="54"> 54</span>
<span id="55"> 55</span>
<span id="56"> 56</span>
<span id="57"> 57</span>
<span id="58"> 58</span>
<span id="59"> 59</span>
<span id="60"> 60</span>
<span id="61"> 61</span>
<span id="62"> 62</span>
<span id="63"> 63</span>
<span id="64"> 64</span>
<span id="65"> 65</span>
<span id="66"> 66</span>
<span id="67"> 67</span>
<span id="68"> 68</span>
<span id="69"> 69</span>
<span id="70"> 70</span>
<span id="71"> 71</span>
<span id="72"> 72</span>
<span id="73"> 73</span>
<span id="74"> 74</span>
<span id="75"> 75</span>
<span id="76"> 76</span>
<span id="77"> 77</span>
<span id="78"> 78</span>
<span id="79"> 79</span>
<span id="80"> 80</span>
<span id="81"> 81</span>
<span id="82"> 82</span>
<span id="83"> 83</span>
<span id="84"> 84</span>
<span id="85"> 85</span>
<span id="86"> 86</span>
<span id="87"> 87</span>
<span id="88"> 88</span>
<span id="89"> 89</span>
<span id="90"> 90</span>
<span id="91"> 91</span>
<span id="92"> 92</span>
<span id="93"> 93</span>
<span id="94"> 94</span>
<span id="95"> 95</span>
<span id="96"> 96</span>
<span id="97"> 97</span>
<span id="98"> 98</span>
<span id="99"> 99</span>
<span id="100">100</span>
<span id="101">101</span>
<span id="102">102</span>
<span id="103">103</span>
<span id="104">104</span>
<span id="105">105</span>
<span id="106">106</span>
<span id="107">107</span>
<span id="108">108</span>
<span id="109">109</span>
<span id="110">110</span>
<span id="111">111</span>
<span id="112">112</span>
<span id="113">113</span>
<span id="114">114</span>
<span id="115">115</span>
<span id="116">116</span>
<span id="117">117</span>
<span id="118">118</span>
<span id="119">119</span>
<span id="120">120</span>
<span id="121">121</span>
<span id="122">122</span>
<span id="123">123</span>
<span id="124">124</span>
<span id="125">125</span>
<span id="126">126</span>
<span id="127">127</span>
<span id="128">128</span>
<span id="129">129</span>
<span id="130">130</span>
<span id="131">131</span>
<span id="132">132</span>
<span id="133">133</span>
<span id="134">134</span>
<span id="135">135</span>
<span id="136">136</span>
<span id="137">137</span>
<span id="138">138</span>
<span id="139">139</span>
<span id="140">140</span>
<span id="141">141</span>
<span id="142">142</span>
<span id="143">143</span>
<span id="144">144</span>
<span id="145">145</span>
<span id="146">146</span>
<span id="147">147</span>
<span id="148">148</span>
<span id="149">149</span>
<span id="150">150</span>
<span id="151">151</span>
<span id="152">152</span>
<span id="153">153</span>
<span id="154">154</span>
<span id="155">155</span>
<span id="156">156</span>
<span id="157">157</span>
<span id="158">158</span>
<span id="159">159</span>
<span id="160">160</span>
<span id="161">161</span>
<span id="162">162</span>
<span id="163">163</span>
<span id="164">164</span>
<span id="165">165</span>
<span id="166">166</span>
<span id="167">167</span>
<span id="168">168</span>
<span id="169">169</span>
<span id="170">170</span>
<span id="171">171</span>
<span id="172">172</span>
<span id="173">173</span>
<span id="174">174</span>
<span id="175">175</span>
<span id="176">176</span>
<span id="177">177</span>
<span id="178">178</span>
<span id="179">179</span>
<span id="180">180</span>
<span id="181">181</span>
<span id="182">182</span>
<span id="183">183</span>
<span id="184">184</span>
<span id="185">185</span>
<span id="186">186</span>
<span id="187">187</span>
<span id="188">188</span>
<span id="189">189</span>
<span id="190">190</span>
<span id="191">191</span>
<span id="192">192</span>
<span id="193">193</span>
<span id="194">194</span>
<span id="195">195</span>
<span id="196">196</span>
<span id="197">197</span>
<span id="198">198</span>
<span id="199">199</span>
<span id="200">200</span>
<span id="201">201</span>
<span id="202">202</span>
<span id="203">203</span>
<span id="204">204</span>
<span id="205">205</span>
<span id="206">206</span>
<!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="Source to the Rust file `duckscript_sdk/src/utils/io.rs`."><meta name="keywords" content="rust, rustlang, rust-lang"><title>io.rs.html -- source</title><link rel="stylesheet" type="text/css" href="../../../normalize.css"><link rel="stylesheet" type="text/css" href="../../../rustdoc.css" id="mainThemeStyle"><link rel="stylesheet" type="text/css" href="../../../dark.css"><link rel="stylesheet" type="text/css" href="../../../light.css" id="themeStyle"><script src="../../../storage.js"></script><noscript><link rel="stylesheet" href="../../../noscript.css"></noscript><link rel="shortcut icon" href="../../../favicon.ico"><style type="text/css">#crate-search{background-image:url("../../../down-arrow.svg");}</style></head><body class="rustdoc source"><!--[if lte IE 8]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><nav class="sidebar"><div class="sidebar-menu">&#9776;</div><a href='../../../duckscriptsdk/index.html'><div class='logo-container'><img src='../../../rust-logo.png' alt='logo'></div></a></nav><div class="theme-picker"><button id="theme-picker" aria-label="Pick another theme!"><img src="../../../brush.svg" width="18" alt="Pick another theme!"></button><div id="theme-choices"></div></div><script src="../../../theme.js"></script><nav class="sub"><form class="search-form"><div class="search-container"><div><select id="crate-search"><option value="All crates">All crates</option></select><input class="search-input" name="search" disabled autocomplete="off" spellcheck="false" placeholder="Click or press S to search, ? for more options…" type="search"></div><a id="settings-menu" href="../../../settings.html"><img src="../../../wheel.svg" width="18" alt="Change settings"></a></div></form></nav><section id="main" class="content"><pre class="line-numbers"><span id="1"> 1</span>
<span id="2"> 2</span>
<span id="3"> 3</span>
<span id="4"> 4</span>
<span id="5"> 5</span>
<span id="6"> 6</span>
<span id="7"> 7</span>
<span id="8"> 8</span>
<span id="9"> 9</span>
<span id="10">10</span>
<span id="11">11</span>
<span id="12">12</span>
<span id="13">13</span>
<span id="14">14</span>
<span id="15">15</span>
<span id="16">16</span>
<span id="17">17</span>
<span id="18">18</span>
<span id="19">19</span>
<span id="20">20</span>
<span id="21">21</span>
<span id="22">22</span>
<span id="23">23</span>
<span id="24">24</span>
<span id="25">25</span>
<span id="26">26</span>
<span id="27">27</span>
<span id="28">28</span>
<span id="29">29</span>
<span id="30">30</span>
<span id="31">31</span>
<span id="32">32</span>
<span id="33">33</span>
<span id="34">34</span>
<span id="35">35</span>
<span id="36">36</span>
<span id="37">37</span>
<span id="38">38</span>
<span id="39">39</span>
<span id="40">40</span>
<span id="41">41</span>
<span id="42">42</span>
<span id="43">43</span>
<span id="44">44</span>
<span id="45">45</span>
<span id="46">46</span>
<span id="47">47</span>
<span id="48">48</span>
<span id="49">49</span>
<span id="50">50</span>
<span id="51">51</span>
<span id="52">52</span>
<span id="53">53</span>
<span id="54">54</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">error</span>::{<span class="ident">ErrorInfo</span>, <span class="ident">ScriptError</span>};
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">fs</span>::{<span class="ident">create_dir_all</span>, <span class="ident">remove_file</span>, <span class="ident">File</span>, <span class="ident">OpenOptions</span>};
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">io</span>::{<span class="ident">Read</span>, <span class="ident">Write</span>};
<span class="kw">use</span> <span class="ident">std</span>::<span class="ident">path</span>::<span class="ident">Path</span>;
<span class="kw">use</span> <span class="ident">fsio</span>::<span class="ident">file</span>::{<span class="ident">append_file</span>, <span class="ident">ensure_exists</span>, <span class="ident">read_file</span>, <span class="ident">write_file</span>};
<span class="attribute">#[<span class="ident">cfg</span>(<span class="ident">test</span>)]</span>
<span class="attribute">#[<span class="ident">path</span> <span class="op">=</span> <span class="string">&quot;./io_test.rs&quot;</span>]</span>
<span class="kw">mod</span> <span class="ident">io_test</span>;
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">get_canonical_path</span>(<span class="ident">path</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="ident">String</span> {
<span class="kw">let</span> <span class="ident">path_obj</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="ident">path</span>);
<span class="kw">match</span> <span class="ident">path_obj</span>.<span class="ident">canonicalize</span>() {
<span class="prelude-val">Ok</span>(<span class="ident">path_buf</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">path_buf</span>.<span class="ident">to_string_lossy</span>().<span class="ident">into_owned</span>(),
<span class="kw">_</span> <span class="op">=</span><span class="op">&gt;</span> <span class="ident">path</span>.<span class="ident">to_string</span>(),
}
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">get_base_name</span>(<span class="ident">path</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">canonical_path</span> <span class="op">=</span> <span class="ident">get_canonical_path</span>(<span class="ident">path</span>);
<span class="kw">let</span> <span class="ident">path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="kw-2">&amp;</span><span class="ident">canonical_path</span>);
<span class="kw">match</span> <span class="ident">path</span>.<span class="ident">file_name</span>() {
<span class="prelude-val">Some</span>(<span class="ident">name</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Some</span>(<span class="ident">name</span>.<span class="ident">to_string_lossy</span>().<span class="ident">into_owned</span>()),
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">None</span>,
}
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">get_parent_directory_name</span>(<span class="ident">path</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">String</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">file_path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="ident">path</span>);
<span class="kw">let</span> <span class="ident">directory</span> <span class="op">=</span> <span class="ident">file_path</span>.<span class="ident">parent</span>();
<span class="kw">match</span> <span class="ident">directory</span> {
<span class="prelude-val">Some</span>(<span class="ident">directory_path</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">directory</span> <span class="op">=</span> <span class="ident">directory_path</span>.<span class="ident">to_string_lossy</span>().<span class="ident">into_owned</span>();
<span class="kw">if</span> <span class="ident">directory</span>.<span class="ident">is_empty</span>() {
<span class="prelude-val">None</span>
} <span class="kw">else</span> {
<span class="prelude-val">Some</span>(<span class="ident">directory</span>)
}
}
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">None</span>,
}
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">create_directory</span>(<span class="ident">directory</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>(), <span class="ident">String</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">directory_path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="ident">directory</span>);
<span class="ident">create_directory_for_path</span>(<span class="kw-2">&amp;</span><span class="ident">directory_path</span>)
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">create_parent_directory</span>(<span class="ident">file</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>(), <span class="ident">String</span><span class="op">&gt;</span> {
<span class="kw">match</span> <span class="ident">get_parent_directory_name</span>(<span class="ident">file</span>) {
<span class="prelude-val">Some</span>(<span class="ident">parent</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="ident">create_directory</span>(<span class="kw-2">&amp;</span><span class="ident">parent</span>),
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Ok</span>(()),
}
}
<span class="kw">fn</span> <span class="ident">create_directory_for_path</span>(<span class="ident">directory_path</span>: <span class="kw-2">&amp;</span><span class="ident">Path</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>(), <span class="ident">String</span><span class="op">&gt;</span> {
<span class="kw">if</span> <span class="ident">directory_path</span>.<span class="ident">is_dir</span>() <span class="kw-2">&amp;</span><span class="op">&amp;</span> <span class="ident">directory_path</span>.<span class="ident">exists</span>() {
<span class="kw">return</span> <span class="prelude-val">Ok</span>(());
}
<span class="kw">match</span> <span class="ident">create_dir_all</span>(<span class="kw-2">&amp;</span><span class="ident">directory_path</span>) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Ok</span>(()),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">error</span>.<span class="ident">to_string</span>()),
}
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">read_text_file</span>(<span class="ident">file</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">ScriptError</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">file_path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="ident">file</span>);
<span class="kw">match</span> <span class="ident">File</span>::<span class="ident">open</span>(<span class="kw-2">&amp;</span><span class="ident">file_path</span>) {
<span class="prelude-val">Ok</span>(<span class="kw-2">mut</span> <span class="ident">fd</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">content</span> <span class="op">=</span> <span class="ident">String</span>::<span class="ident">new</span>();
<span class="kw">match</span> <span class="ident">fd</span>.<span class="ident">read_to_string</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">content</span>) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Ok</span>(<span class="ident">content</span>),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">ScriptError</span> {
<span class="ident">info</span>: <span class="ident">ErrorInfo</span>::<span class="ident">ErrorReadingFile</span>(<span class="ident">file</span>.<span class="ident">to_string</span>(), <span class="prelude-val">Some</span>(<span class="ident">error</span>)),
}),
}
}
<span class="kw">match</span> <span class="ident">fsio</span>::<span class="ident">file</span>::<span class="ident">read_text_file</span>(<span class="ident">file</span>) {
<span class="prelude-val">Ok</span>(<span class="ident">content</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Ok</span>(<span class="ident">content</span>),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">ScriptError</span> {
<span class="ident">info</span>: <span class="ident">ErrorInfo</span>::<span class="ident">ErrorReadingFile</span>(<span class="ident">file</span>.<span class="ident">to_string</span>(), <span class="prelude-val">Some</span>(<span class="ident">error</span>)),
}),
@ -295,18 +70,8 @@
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">read_raw_file</span>(<span class="ident">file</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span><span class="ident">Vec</span><span class="op">&lt;</span><span class="ident">u8</span><span class="op">&gt;</span>, <span class="ident">ScriptError</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">file_path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="ident">file</span>);
<span class="kw">match</span> <span class="ident">File</span>::<span class="ident">open</span>(<span class="kw-2">&amp;</span><span class="ident">file_path</span>) {
<span class="prelude-val">Ok</span>(<span class="kw-2">mut</span> <span class="ident">fd</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="kw-2">mut</span> <span class="ident">content</span> <span class="op">=</span> <span class="macro">vec</span><span class="macro">!</span>[];
<span class="kw">match</span> <span class="ident">fd</span>.<span class="ident">read_to_end</span>(<span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">content</span>) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Ok</span>(<span class="ident">content</span>),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">ScriptError</span> {
<span class="ident">info</span>: <span class="ident">ErrorInfo</span>::<span class="ident">ErrorReadingFile</span>(<span class="ident">file</span>.<span class="ident">to_string</span>(), <span class="prelude-val">Some</span>(<span class="ident">error</span>)),
}),
}
}
<span class="kw">match</span> <span class="ident">read_file</span>(<span class="ident">file</span>) {
<span class="prelude-val">Ok</span>(<span class="ident">content</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Ok</span>(<span class="ident">content</span>),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">ScriptError</span> {
<span class="ident">info</span>: <span class="ident">ErrorInfo</span>::<span class="ident">ErrorReadingFile</span>(<span class="ident">file</span>.<span class="ident">to_string</span>(), <span class="prelude-val">Some</span>(<span class="ident">error</span>)),
}),
@ -322,93 +87,24 @@
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">write_to_file</span>(<span class="ident">file</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>, <span class="ident">data</span>: <span class="kw-2">&amp;</span>[<span class="ident">u8</span>], <span class="ident">append</span>: <span class="ident">bool</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>(), <span class="ident">ScriptError</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">file_path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="ident">file</span>);
<span class="comment">// create parent directory</span>
<span class="kw">match</span> <span class="ident">create_parent_directory</span>(<span class="ident">file</span>) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> (),
<span class="prelude-val">Err</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="kw">return</span> <span class="prelude-val">Err</span>(<span class="ident">ScriptError</span> {
<span class="ident">info</span>: <span class="ident">ErrorInfo</span>::<span class="ident">Runtime</span>(
<span class="macro">format</span><span class="macro">!</span>(<span class="string">&quot;Error creating parent directory for file: {}&quot;</span>, <span class="ident">file</span>).<span class="ident">to_string</span>(),
<span class="prelude-val">None</span>,
),
});
}
}
<span class="kw">let</span> <span class="ident">result</span> <span class="op">=</span> <span class="kw">if</span> <span class="ident">append</span> <span class="kw-2">&amp;</span><span class="op">&amp;</span> <span class="ident">file_path</span>.<span class="ident">exists</span>() {
<span class="ident">OpenOptions</span>::<span class="ident">new</span>().<span class="ident">append</span>(<span class="bool-val">true</span>).<span class="ident">open</span>(<span class="ident">file</span>)
<span class="kw">let</span> <span class="ident">result</span> <span class="op">=</span> <span class="kw">if</span> <span class="ident">append</span> {
<span class="ident">append_file</span>(<span class="ident">file</span>, <span class="ident">data</span>)
} <span class="kw">else</span> {
<span class="ident">File</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">file_path</span>)
<span class="ident">write_file</span>(<span class="ident">file</span>, <span class="ident">data</span>)
};
<span class="kw">match</span> <span class="ident">result</span> {
<span class="prelude-val">Ok</span>(<span class="kw-2">mut</span> <span class="ident">fd</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="kw">match</span> <span class="ident">fd</span>.<span class="ident">write_all</span>(<span class="ident">data</span>) {
<span class="prelude-val">Err</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">ScriptError</span> {
<span class="ident">info</span>: <span class="ident">ErrorInfo</span>::<span class="ident">Runtime</span>(
<span class="macro">format</span><span class="macro">!</span>(<span class="string">&quot;Error writing to file: {}&quot;</span>, <span class="ident">file</span>).<span class="ident">to_string</span>(),
<span class="prelude-val">None</span>,
),
}),
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="kw">match</span> <span class="ident">fd</span>.<span class="ident">sync_all</span>() {
<span class="kw">_</span> <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Ok</span>(()),
},
},
<span class="prelude-val">Err</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">ScriptError</span> {
<span class="ident">info</span>: <span class="ident">ErrorInfo</span>::<span class="ident">Runtime</span>(
<span class="macro">format</span><span class="macro">!</span>(<span class="string">&quot;Error opening file: {} for writing.&quot;</span>, <span class="ident">file</span>).<span class="ident">to_string</span>(),
<span class="prelude-val">None</span>,
),
<span class="prelude-val">Ok</span>(<span class="ident">content</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Ok</span>(<span class="ident">content</span>),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">ScriptError</span> {
<span class="ident">info</span>: <span class="ident">ErrorInfo</span>::<span class="ident">Runtime</span>(<span class="ident">error</span>.<span class="ident">to_string</span>(), <span class="prelude-val">None</span>),
}),
}
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">create_empty_file</span>(<span class="ident">file</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>(), <span class="ident">String</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">file_path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="ident">file</span>);
<span class="kw">if</span> <span class="ident">file_path</span>.<span class="ident">exists</span>() {
<span class="kw">if</span> <span class="ident">file_path</span>.<span class="ident">is_file</span>() {
<span class="prelude-val">Ok</span>(())
} <span class="kw">else</span> {
<span class="prelude-val">Err</span>(<span class="macro">format</span><span class="macro">!</span>(
<span class="string">&quot;Unable to create file: {} directory with that path exists.&quot;</span>,
<span class="ident">file</span>
)
.<span class="ident">to_string</span>())
}
} <span class="kw">else</span> {
<span class="comment">// create parent directory</span>
<span class="kw">let</span> <span class="ident">directory</span> <span class="op">=</span> <span class="ident">file_path</span>.<span class="ident">parent</span>();
<span class="kw">match</span> <span class="ident">directory</span> {
<span class="prelude-val">Some</span>(<span class="ident">directory_path</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="kw">match</span> <span class="ident">create_directory_for_path</span>(<span class="kw-2">&amp;</span><span class="ident">directory_path</span>) {
<span class="kw">_</span> <span class="op">=</span><span class="op">&gt;</span> (),
},
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> (),
};
<span class="kw">match</span> <span class="ident">File</span>::<span class="ident">create</span>(<span class="kw-2">&amp;</span><span class="ident">file_path</span>) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Ok</span>(()),
<span class="kw">_</span> <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="macro">format</span><span class="macro">!</span>(<span class="string">&quot;Unable to create file: {}&quot;</span>, <span class="ident">file</span>).<span class="ident">to_string</span>()),
}
}
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">delete_file</span>(<span class="ident">file</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Result</span><span class="op">&lt;</span>(), <span class="ident">String</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">file_path</span> <span class="op">=</span> <span class="ident">Path</span>::<span class="ident">new</span>(<span class="ident">file</span>);
<span class="kw">if</span> <span class="ident">file_path</span>.<span class="ident">exists</span>() {
<span class="kw">match</span> <span class="ident">remove_file</span>(<span class="ident">file</span>) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Ok</span>(()),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="macro">format</span><span class="macro">!</span>(
<span class="string">&quot;Unable to delete file: {} error: {}&quot;</span>,
<span class="ident">file</span>,
<span class="ident">error</span>.<span class="ident">to_string</span>()
)
.<span class="ident">to_string</span>()),
}
} <span class="kw">else</span> {
<span class="prelude-val">Ok</span>(())
<span class="kw">match</span> <span class="ident">ensure_exists</span>(<span class="ident">file</span>) {
<span class="prelude-val">Ok</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Ok</span>(()),
<span class="prelude-val">Err</span>(<span class="ident">error</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="ident">error</span>.<span class="ident">to_string</span>()),
}
}
</pre></div>

View file

@ -270,6 +270,32 @@
<span id="270">270</span>
<span id="271">271</span>
<span id="272">272</span>
<span id="273">273</span>
<span id="274">274</span>
<span id="275">275</span>
<span id="276">276</span>
<span id="277">277</span>
<span id="278">278</span>
<span id="279">279</span>
<span id="280">280</span>
<span id="281">281</span>
<span id="282">282</span>
<span id="283">283</span>
<span id="284">284</span>
<span id="285">285</span>
<span id="286">286</span>
<span id="287">287</span>
<span id="288">288</span>
<span id="289">289</span>
<span id="290">290</span>
<span id="291">291</span>
<span id="292">292</span>
<span id="293">293</span>
<span id="294">294</span>
<span id="295">295</span>
<span id="296">296</span>
<span id="297">297</span>
<span id="298">298</span>
</pre><div class="example-wrap"><pre class="rust ">
<span class="kw">use</span> <span class="kw">crate</span>::<span class="ident">utils</span>::<span class="ident">pckg</span>;
<span class="kw">use</span> <span class="ident">duckscript</span>::<span class="ident">types</span>::<span class="ident">runtime</span>::<span class="ident">StateValue</span>;
@ -308,9 +334,7 @@
.<span class="ident">collect</span>();
<span class="ident">key</span>.<span class="ident">insert_str</span>(<span class="number">0</span>, <span class="string">&quot;handle:&quot;</span>);
<span class="kw">let</span> <span class="ident">handle_state</span> <span class="op">=</span> <span class="ident">get_handles_sub_state</span>(<span class="ident">state</span>);
<span class="ident">handle_state</span>.<span class="ident">insert</span>(<span class="ident">key</span>.<span class="ident">clone</span>(), <span class="ident">value</span>);
<span class="ident">return_handle</span>(<span class="ident">state</span>, <span class="ident">key</span>.<span class="ident">clone</span>(), <span class="ident">value</span>);
<span class="ident">key</span>
}
@ -324,6 +348,25 @@
<span class="ident">handle_state</span>.<span class="ident">get</span>(<span class="kw-2">&amp;</span><span class="ident">key</span>)
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">remove_handle</span>(
<span class="ident">state</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">HashMap</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">StateValue</span><span class="op">&gt;</span>,
<span class="ident">key</span>: <span class="ident">String</span>,
) <span class="op">-</span><span class="op">&gt;</span> <span class="prelude-ty">Option</span><span class="op">&lt;</span><span class="ident">StateValue</span><span class="op">&gt;</span> {
<span class="kw">let</span> <span class="ident">handle_state</span> <span class="op">=</span> <span class="ident">get_handles_sub_state</span>(<span class="ident">state</span>);
<span class="ident">handle_state</span>.<span class="ident">remove</span>(<span class="kw-2">&amp;</span><span class="ident">key</span>)
}
<span class="kw">pub</span>(<span class="kw">crate</span>) <span class="kw">fn</span> <span class="ident">return_handle</span>(
<span class="ident">state</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">HashMap</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">StateValue</span><span class="op">&gt;</span>,
<span class="ident">key</span>: <span class="ident">String</span>,
<span class="ident">value</span>: <span class="ident">StateValue</span>,
) {
<span class="kw">let</span> <span class="ident">handle_state</span> <span class="op">=</span> <span class="ident">get_handles_sub_state</span>(<span class="ident">state</span>);
<span class="ident">handle_state</span>.<span class="ident">insert</span>(<span class="ident">key</span>.<span class="ident">clone</span>(), <span class="ident">value</span>);
}
<span class="kw">fn</span> <span class="ident">ensure_sub_state</span>(<span class="ident">key</span>: <span class="kw-2">&amp;</span><span class="ident">str</span>, <span class="ident">state</span>: <span class="kw-2">&amp;</span><span class="kw-2">mut</span> <span class="ident">HashMap</span><span class="op">&lt;</span><span class="ident">String</span>, <span class="ident">StateValue</span><span class="op">&gt;</span>) {
<span class="kw">match</span> <span class="ident">state</span>.<span class="ident">get</span>(<span class="ident">key</span>) {
<span class="prelude-val">Some</span>(<span class="ident">value</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="kw">match</span> <span class="ident">value</span> {
@ -417,6 +460,7 @@
<span class="ident">StateValue</span>::<span class="ident">ByteArray</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="string">&quot;Unsupported value type.&quot;</span>.<span class="ident">to_string</span>()),
<span class="ident">StateValue</span>::<span class="ident">List</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="string">&quot;Unsupported value type.&quot;</span>.<span class="ident">to_string</span>()),
<span class="ident">StateValue</span>::<span class="ident">SubState</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="string">&quot;Unsupported value type.&quot;</span>.<span class="ident">to_string</span>()),
<span class="ident">StateValue</span>::<span class="ident">Any</span>(<span class="kw">_</span>) <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="string">&quot;Unsupported value type.&quot;</span>.<span class="ident">to_string</span>()),
}
}
@ -477,6 +521,10 @@
<span class="ident">state</span>.<span class="ident">insert</span>(<span class="ident">key</span>, <span class="ident">StateValue</span>::<span class="ident">List</span>(<span class="ident">value</span>));
<span class="prelude-val">Err</span>(<span class="string">&quot;Invalid handle provided.&quot;</span>.<span class="ident">to_string</span>())
}
<span class="ident">StateValue</span>::<span class="ident">Any</span>(<span class="ident">value</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">state</span>.<span class="ident">insert</span>(<span class="ident">key</span>, <span class="ident">StateValue</span>::<span class="ident">Any</span>(<span class="ident">value</span>));
<span class="prelude-val">Err</span>(<span class="string">&quot;Invalid handle provided.&quot;</span>.<span class="ident">to_string</span>())
}
},
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="macro">format</span><span class="macro">!</span>(<span class="string">&quot;Handle: {} not found.&quot;</span>, <span class="kw-2">&amp;</span><span class="ident">key</span>).<span class="ident">to_string</span>()),
}
@ -539,6 +587,10 @@
<span class="ident">state</span>.<span class="ident">insert</span>(<span class="ident">key</span>, <span class="ident">StateValue</span>::<span class="ident">SubState</span>(<span class="ident">value</span>));
<span class="prelude-val">Err</span>(<span class="string">&quot;Invalid handle provided.&quot;</span>.<span class="ident">to_string</span>())
}
<span class="ident">StateValue</span>::<span class="ident">Any</span>(<span class="ident">value</span>) <span class="op">=</span><span class="op">&gt;</span> {
<span class="ident">state</span>.<span class="ident">insert</span>(<span class="ident">key</span>, <span class="ident">StateValue</span>::<span class="ident">Any</span>(<span class="ident">value</span>));
<span class="prelude-val">Err</span>(<span class="string">&quot;Invalid handle provided.&quot;</span>.<span class="ident">to_string</span>())
}
},
<span class="prelude-val">None</span> <span class="op">=</span><span class="op">&gt;</span> <span class="prelude-val">Err</span>(<span class="macro">format</span><span class="macro">!</span>(<span class="string">&quot;Handle: {} not found.&quot;</span>, <span class="kw-2">&amp;</span><span class="ident">key</span>).<span class="ident">to_string</span>()),
}

View file

@ -1,6 +1,6 @@
[package]
name = "duckscript"
version = "0.2.0"
version = "0.2.1"
authors = ["Sagie Gur-Ari <sagiegurari@gmail.com>"]
description = "Simple, extendable and embeddable scripting language."
license = "Apache-2.0"

View file

@ -1,6 +1,6 @@
[package]
name = "duckscript_cli"
version = "0.2.0"
version = "0.2.1"
authors = ["Sagie Gur-Ari <sagiegurari@gmail.com>"]
description = "The duckscript command line executable."
license = "Apache-2.0"
@ -27,8 +27,8 @@ name = "duck"
path = "src/main.rs"
[dependencies]
duckscript = { version = "^0.2.0", path = "../duckscript" }
duckscriptsdk = { version = "^0.2.0", path = "../duckscript_sdk" }
duckscript = { version = "^0.2.1", path = "../duckscript" }
duckscriptsdk = { version = "^0.2.1", path = "../duckscript_sdk" }
[badges.travis-ci]
branch = "master"

View file

@ -1,6 +1,6 @@
[package]
name = "duckscriptsdk"
version = "0.2.0"
version = "0.2.1"
authors = ["Sagie Gur-Ari <sagiegurari@gmail.com>"]
description = "The duckscript SDK."
license = "Apache-2.0"
@ -25,7 +25,7 @@ include = [
[dependencies]
attohttpc = "^0.11"
base64 = "^0.11"
duckscript = { version = "^0.2.0", path = "../duckscript" }
duckscript = { version = "^0.2.1", path = "../duckscript" }
fs_extra = "^1"
fsio = { version = "^0.1", features = ["temp-path"] }
home = "^0.5"