Commit 4f9d4da8 authored by Steven vanZyl's avatar Steven vanZyl
Browse files

Spec change and tweaks

Change something in the spec and tweaked the binaries.
Will come back to those and flesh them out later.
parent ca2b2895
......@@ -58,8 +58,8 @@ The second byte is defines the "run" length of this color, or the horizontal
length along this row of pixels to use this color. This is a form of basic
compression. A length of 1 means this is only one pixel, a length of 100
means this is a line 100 pixels long.
Runs longer than or going off the end of a row are considered invalid and will
be truncated to the length of the row.
Runs longer than or going off the end of a row are considered **valid** and will
wrap onto the next line.
## License
use ssif::{encode_to_file, SSIFError};
// TODO pipe to stdout
fn main() -> Result<(), SSIFError> {
use ssif::{decode_file_json, SSIFError};
use ssif::{decode_file, SSIFError};
// TODO get file from stdin
fn main() -> Result<(), SSIFError> {
if let Some(path) = std::env::args().skip(1).next() {
Ok(println!("{}", decode_file_json(&*path)?))
Ok(println!("{}", serde_json::to_string(&decode_file(&*path)?).unwrap()))
} else {
use std::io::{Error, ErrorKind};
......@@ -87,11 +87,6 @@ pub fn decode_wasm_json(bytes: &str) -> String {
/// A special wrapper for use with the to_json binary
pub fn decode_file_json(path: &str) -> Result<String, SSIFError> {
Ok(serde_json::to_string(&decode_file(path)?).expect("Failed to serialize to JSON"))
fn to_u16<T>(bytes: T) -> u16
......@@ -72,4 +72,4 @@ where
T: AsRef<str>,
Ok(File::create(path.as_ref())?.write(&*encode_to_bytes(image, compress)?)?)
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment