-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
65 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
name = "twyne" | ||
description = "A Rust library for parsing Twine story/game export files (JSON format)" | ||
readme = "README.md" | ||
version = "0.2.0-dev" | ||
version = "0.2.0" | ||
license = "Apache-2.0" | ||
authors = ["Duncan McGreggor <[email protected]>"] | ||
repository = "https://github.com/oxur/twyne" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
use super::schema; | ||
use serde_json; | ||
use std::error::Error; | ||
use std::fs::File; | ||
use std::io::BufReader; | ||
use std::path::Path; | ||
use serde_json; | ||
use super::schema; | ||
|
||
pub fn parse_file<P: AsRef<Path>>(path: P) -> Result<schema::Game, Box<dyn Error>> { | ||
let file = File::open(path)?; | ||
let file = File::open(path)?; | ||
let reader = BufReader::new(file); | ||
let g = serde_json::from_reader(reader)?; | ||
Ok(g) | ||
} | ||
|
||
pub fn parse_bytes<'a>(data: &'a [u8]) -> serde_json::Result<schema::Game> { | ||
pub fn parse_bytes(data: &[u8]) -> serde_json::Result<schema::Game> { | ||
serde_json::from_slice(data) | ||
} | ||
|
||
pub fn parse_str<'a>(data: &'a str) -> serde_json::Result<schema::Game> { | ||
pub fn parse_str(data: &str) -> serde_json::Result<schema::Game> { | ||
serde_json::from_str(data) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters