<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Allow access to Node&#x27;s TextDecoder]]></title><description><![CDATA[<p>Re: <a href="/forum/topic/596/allow-access-to-node-s-buffer-class">Allow access to node's Buffer class</a></p>
<p>I'm working on getting Screeps to work with Rust's <code>wasm-bindgen</code> (the official way to run Rust in Node.js). The only thing blocking this is that the Rust/JS shim makes use of <code>TextDecoder</code> for performance. This API has existing in Node since Node 8 (screeps uses Node 10) and is also supported in most major browsers, so it would also work with the simulator.</p>
<p>In fact, <code>TextDecoder</code> is already available in the simulator at global scope, so Rust already works there. We just need <code>TextDecoder</code> to also be there when running in Node.</p>
<p>Previous discussions mentioned allowing access to Node's <code>Buffer</code> class, but that's no longer necessary as the Rust Shims now just use <code>TextDecoder</code> and <code>Uint8Array</code>.</p>
<p>This came up because the toolchain that <a href="https://github.com/rustyscreeps/screeps-game-api" rel="nofollow">the existing Rust API</a> uses (<a href="https://github.com/koute/stdweb" rel="nofollow"><code>stdweb</code></a>) is no longer maintained, and the <code>wasm-bindgen</code> alternative is officially supported by the Rust org.</p>
]]></description><link>http://screeps.com/forum/topic/3067/allow-access-to-node-s-textdecoder</link><generator>RSS for Node</generator><lastBuildDate>Fri, 15 May 2026 20:15:59 GMT</lastBuildDate><atom:link href="http://screeps.com/forum/topic/3067.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 14 Sep 2020 07:19:35 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Allow access to Node&#x27;s TextDecoder on Invalid Date]]></title><description><![CDATA[<p>Re: <a href="/forum/topic/596/allow-access-to-node-s-buffer-class">Allow access to node's Buffer class</a></p>
<p>I'm working on getting Screeps to work with Rust's <code>wasm-bindgen</code> (the official way to run Rust in Node.js). The only thing blocking this is that the Rust/JS shim makes use of <code>TextDecoder</code> for performance. This API has existing in Node since Node 8 (screeps uses Node 10) and is also supported in most major browsers, so it would also work with the simulator.</p>
<p>In fact, <code>TextDecoder</code> is already available in the simulator at global scope, so Rust already works there. We just need <code>TextDecoder</code> to also be there when running in Node.</p>
<p>Previous discussions mentioned allowing access to Node's <code>Buffer</code> class, but that's no longer necessary as the Rust Shims now just use <code>TextDecoder</code> and <code>Uint8Array</code>.</p>
<p>This came up because the toolchain that <a href="https://github.com/rustyscreeps/screeps-game-api" rel="nofollow">the existing Rust API</a> uses (<a href="https://github.com/koute/stdweb" rel="nofollow"><code>stdweb</code></a>) is no longer maintained, and the <code>wasm-bindgen</code> alternative is officially supported by the Rust org.</p>
]]></description><link>http://screeps.com/forum/post/15596</link><guid isPermaLink="true">http://screeps.com/forum/post/15596</guid><dc:creator><![CDATA[joerichey]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Allow access to Node&#x27;s TextDecoder on Invalid Date]]></title><description><![CDATA[<p>Github Issues:</p>
<ul>
<li><a href="https://github.com/rustyscreeps/screeps-game-api/issues/329" rel="nofollow">https://github.com/rustyscreeps/screeps-game-api/issues/329</a></li>
<li><a href="https://github.com/screeps/screeps/issues/120" rel="nofollow">https://github.com/screeps/screeps/issues/120</a></li>
</ul>
<p>Relevant APIs:</p>
<ul>
<li><a href="https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder" rel="nofollow">Web <code>TextDecoder</code></a></li>
<li><a href="https://nodejs.org/api/util.html#util_class_util_textdecoder" rel="nofollow">Node <code>TextDecoder</code></a></li>
</ul>
]]></description><link>http://screeps.com/forum/post/15597</link><guid isPermaLink="true">http://screeps.com/forum/post/15597</guid><dc:creator><![CDATA[joerichey]]></dc:creator><pubDate>Invalid Date</pubDate></item><item><title><![CDATA[Reply to Allow access to Node&#x27;s TextDecoder on Tue, 15 Sep 2020 09:17:07 GMT]]></title><description><![CDATA[<p>I was slightly wrong above, we could also solve this problem for Rust by exposing the <code>Buffer</code> class. However, as noted in the previous linked pull request, that requires a unnecessary polyfill for Browsers.</p>
<p>I think the best approach is to just expose  <code>TextDecoder</code>/<code>TextEncoder</code> either at global scope or in a <code>require('util')</code> module.</p>
]]></description><link>http://screeps.com/forum/post/15598</link><guid isPermaLink="true">http://screeps.com/forum/post/15598</guid><dc:creator><![CDATA[joerichey]]></dc:creator><pubDate>Tue, 15 Sep 2020 09:17:07 GMT</pubDate></item><item><title><![CDATA[Reply to Allow access to Node&#x27;s TextDecoder on Sun, 29 Nov 2020 01:18:12 GMT]]></title><description><![CDATA[<p>As I understand it, Node's Buffer is dangerous to expose from a security perspective. This is because it allows you to allocate and access uninitialised memory... though perhaps in the context of IVM this is cleared? Anyway, at the very least it's a bunch of pointer leaks they probably don't want.</p>
<p>Back to your original idea, providing TextEncoder and TextDecoder would be really useful not just for Rust users, but for anyone wanting to do custom memory or WASM modules. I'm in the JS crowd, but would love to have a proper way to store an ArrayBuffer in RawMemory or segments without an incredibly slow polyfill. JavaScript strings are just awful to deal with.</p>
]]></description><link>http://screeps.com/forum/post/15880</link><guid isPermaLink="true">http://screeps.com/forum/post/15880</guid><dc:creator><![CDATA[pruby]]></dc:creator><pubDate>Sun, 29 Nov 2020 01:18:12 GMT</pubDate></item></channel></rss>