summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/achernar.php22
-rw-r--r--include/benoit.php2
-rw-r--r--include/bzipper.php52
-rw-r--r--include/pollex.php4
4 files changed, 69 insertions, 11 deletions
diff --git a/include/achernar.php b/include/achernar.php
index fb6229b..fb63513 100644
--- a/include/achernar.php
+++ b/include/achernar.php
@@ -66,7 +66,21 @@
<?php add_heading("Roadmap", "roadmap"); ?>
<section>
- <p>Currently, our roadmap is as follows:</p>
+ <p>Currently, the following tasks are our highest priorities (in order of decreasing priority):</p>
+ <br>
+ <ul>
+ <li>
+ <p>Implement derive macros for the <code>Serialise</code> and <code>Deserialise</code> traits in <a href="?p=bzipper">bzipper</a></p>
+ </li>
+ <li>
+ <p>Develop <a href="?p=bowshock">Bowshock</a> to a semi-playable state and begin marketing hereof</p>
+ </li>
+ <li>
+ <p>Implement the graphical front-end (<code>benoit-cli</code>) for <a href="?p=benoit">Benoit</a><a></a></p>
+ </li>
+ </ul>
+ <br>
+ <p>The following additional goals denote company objectives:</p>
<br>
<ul>
<li>
@@ -79,11 +93,11 @@
<p>Release early-access for Bowshock (on Steam) by <strong>2025</strong></p>
</li>
<li>
- <p>Restructure to a normal sole proprietorship</p>
+ <p>Restructure to a normal sole proprietorship <strong>sometime</strong></p>
</li>
</ul>
<br>
- <p>This roadmap is, however, also subject to change, altough we do strive to live up to it.</p>
+ <p>These roadmaps are, however, also subject to change, altough we do strive to fullfil our goals.</p>
</section>
<?php add_heading("Team", "team"); ?>
@@ -109,7 +123,7 @@
<?php add_heading("Credits", "credits"); ?>
<section class="fullWidth">
- <p>Thanks to <strong>Nicolas Gallagher</strong> for the <a href="https://necolas.github.io/normalize.css/"><code>normalize.css</code></a> stylesheet. Additionally thanks to the following creators for the fonts which we use on our website:</p>
+ <p>Thanks to <strong>Nicolas Gallagher</strong> for the <a href="https://necolas.github.io/normalize.css/">Normalize.css</a> stylesheet. Additionally thanks to the following creators for the fonts which we use on our website:</p>
<br>
<ul>
<li>
diff --git a/include/benoit.php b/include/benoit.php
index 79e4bd9..a8cb23d 100644
--- a/include/benoit.php
+++ b/include/benoit.php
@@ -47,5 +47,5 @@
<?php add_heading("Docs", "docs"); ?>
<section>
- <p>Documentation is written in source. Documentation for the main library is hosted on <a href="https://docs.rs/benoit/latest/benoit/"><code>docs.rs</code></a>.</p>
+ <p>Documentation is written in source. Documentation for the main library is hosted on <a href="https://docs.rs/benoit/latest/benoit/">Docs.rs</a>.</p>
</section>
diff --git a/include/bzipper.php b/include/bzipper.php
index 023f30b..645deca 100644
--- a/include/bzipper.php
+++ b/include/bzipper.php
@@ -6,13 +6,13 @@
<p>See more at <code><a href="https://crates.io/crates/bzipper/">crates.io</a></code>.</p>
</section>
-<?php add_heading("rationale", "rationale"); ?>
+<?php add_heading("Rationale", "rationale"); ?>
<section>
<p>Contrary to <a href="https://crates.io/crates/serde/">Serde</a>/<a href="https://crates.io/crates/bincode/">Bincode</a>, the goal of this crate is to serialise data with a known size limit. Therefore, this crate may be more suited for networking or other cases where a fixed-sized buffer is needed.</p>
</section>
-<?php add_heading("data model", "dataModel"); ?>
+<?php add_heading("Data model", "dataModel"); ?>
<section>
<p>Most primitive types serialise losslessly, with the exception being <code>usize</code> and <code>isize</code>. These serialise as <code>u16</code> and <code>u32</code>, respectively, for portability reasons.</p>
@@ -20,8 +20,52 @@
<p>Unsized types, such as <code>str</code> and slices, are not supported. Instead, array should be used. For strings, the <code>FixedString</code> type is also provided.</p>
</section>
-<?php add_heading("docs", "docs"); ?>
+<?php add_heading("Usage", "usage"); ?>
<section>
- <p>Documentation is written in-source. See <a href="https://docs.rs/pollex/latest/pollex/"><code>docs.rs</code></a> for a rendered instance.</p>
+ <p>This crate revolves around the <code>Serialise</code> and <code>Deserialise</code> traits, both of which work around streams (more specifically, d-streams and s-streams).</p>
+ <br>
+ <p>Many core types come implemented with bzipper, including primitives as well as some standard library types such as <code>Option</code> and <code>Result</code>.</p>
+</section>
+
+<?php add_heading("Serialisation", "serialisation"); ?>
+
+<section>
+ <p>To serialise an object implementing <code>Serialise</code>, simply allocate a so-called &ldquo;s-stream&rdquo; (short for <em>serialisation stream</em>) with the <code>Sstream</code> type:</p>
+ <br>
+ <p class="codeblock">let mut buf: [u8; 16] = Default::default();<br><br>let mut stream = bzipper::Sstream::new(&mut buf);</p>
+ <br>
+ <p>The resulting stream is immutable in the sense that it cannot grow its buffer, altough it does keep track of the buffer's state.</p>
+ <br>
+ <p>A byte sequence can be added to our new stream by passing the stream to a call to the <code>serialise</code> method:</p>
+ <br>
+ <p class="codeblock">use bzipper::Serialise;<br><br>let mut buf: [u8; 2] = Default::default();<br>let mut stream = bzipper::Sstream::new(&mut buf);<br><br>0x4554_u16.serialise(&mut stream).unwrap();</p>
+ <br>
+ <p>The ammount of bytes used by the serialiser (that is, the ammount of bytes written to the stream) is indicated by its return value (i.e. it has the type <code>Result<usize, Serialise::Error></code>).</p>
+ <br>
+ <p>Whilst the <em>maximum</em> ammount of bytes is specified by the <code>SERIALISE_LIMIT</code> constant, this can in cases be lower (for example with <code>None</code> variants which are always encoded as a single, null byte).</p>
+ <br>
+ <p>When serialising primitives, the resulting byte stream is in big endian (a.k.a. network endian). It is recommended for implementors to adhere to this convention as well.</p>
+ <br>
+ <p>After serialisation, the s-stream records the new write-to position of the buffer. This allows for <em>chaining</em> of serialisations, which can prove useful when implementing the trait for custom types.</p>
+</section>
+
+<?php add_heading("Deserialisation", "deserialisation"); ?>
+
+<section>
+ <p>As with serialisation, deserialisation uses streams (just with the <code>Dstream</code> type; short for <em>deserialisation stream</em>):</p>
+ <br>
+ <p class="codeblock">let data = [0x45, 0x54];<br><br>let mut stream = bzipper::Dstream::new(&data);</p>
+ <br>
+ <p>Using these streams is also just as simple as with s-streams:</p>
+ <br>
+ <p class="codeblock">use bzipper::Deserialise;<br><br>let data = [0x45, 0x54];<br>let mut stream = bzipper::Dstream::new(&data);<br><br>assert_eq!(u16::deserialise(&mut stream).unwrap(), 0x4554);</p>
+ <br>
+ <p>When chaining serialisations, keep in mind that appropriate deserialisations should come in <strong>reverse order</strong> (streams function similarly to stacks in this sense).</p>
+</section>
+
+<?php add_heading("Docs", "docs"); ?>
+
+<section>
+ <p>Documentation is written in-source. See <a href="https://docs.rs/pollex/latest/pollex/">Docs.rs</a> for a rendered instance.</p>
</section>
diff --git a/include/pollex.php b/include/pollex.php
index 6056aad..71bd0ed 100644
--- a/include/pollex.php
+++ b/include/pollex.php
@@ -5,11 +5,11 @@
<br>
<p>Currently, only the legacy 32-bit architectures are supported (if barely), but complete support is planned in the future.</p>
<br>
- <p>See more at <a href="https://crates.io/crates/pollex/"><code>crates.io</code></a>.</p>
+ <p>See more at <a href="https://crates.io/crates/pollex/">crates.io</a>.</p>
</section>
<?php add_heading("Docs", "docs"); ?>
<section>
- <p>As per usual, documentation for <em>Pollex</em> can be found on <a href="https://docs.rs/pollex/latest/pollex/"><code>docs.rs</code></a>.</p>
+ <p>As per usual, documentation for <em>Pollex</em> can be found on <a href="https://docs.rs/pollex/latest/pollex/">Docs.rs</a>.</p>
</section>