Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to jomini 0.4 #10

Merged
merged 1 commit into from Sep 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -16,7 +16,7 @@ mmap = ['memmap']
serialize = []

[dependencies]
jomini = "0.3"
jomini = "0.4"
once_cell = "1"
zip = { version = "0.5", default-features = false, features = ["deflate"] }
serde = { version = "1", features = ["derive"] }
Expand Down
6 changes: 3 additions & 3 deletions src/extraction.rs
@@ -1,6 +1,6 @@
use crate::models::{Eu4Save, Eu4SaveMeta, GameState, Meta};
use crate::{tokens::TokenLookup, Eu4Error, Eu4ErrorKind, FailedResolveStrategy};
use jomini::{BinaryDeserializerBuilder, TextDeserializer, TextTape};
use jomini::{BinaryDeserializer, TextDeserializer, TextTape};
use serde::de::DeserializeOwned;
use std::fmt;
use std::io::{Read, Seek, SeekFrom};
Expand Down Expand Up @@ -269,7 +269,7 @@ where
.map_err(|e| Eu4ErrorKind::ZipExtraction(name, e))?;

if let Some(data) = is_bin(&buffer) {
let res = BinaryDeserializerBuilder::new()
let res = BinaryDeserializer::builder()
.on_failed_resolve(on_failed_resolve)
.from_slice(data, &TokenLookup)
.map_err(|e| Eu4ErrorKind::Deserialize {
Expand Down Expand Up @@ -310,7 +310,7 @@ where
let buffer = &mmap[..];

if let Some(data) = is_bin(&buffer) {
let res = BinaryDeserializerBuilder::new()
let res = BinaryDeserializer::builder()
.on_failed_resolve(on_failed_resolve)
.from_slice(data, &TokenLookup)
.map_err(|e| Eu4ErrorKind::Deserialize {
Expand Down
4 changes: 2 additions & 2 deletions src/melt.rs
Expand Up @@ -85,8 +85,8 @@ fn melter(
writer.push(b'"');
}
}
BinaryToken::F32(x) => write!(writer, "{}", x).map_err(Eu4ErrorKind::IoErr)?,
BinaryToken::Q16(x) => write!(writer, "{}", x).map_err(Eu4ErrorKind::IoErr)?,
BinaryToken::F32_1(x) => write!(writer, "{}", x).map_err(Eu4ErrorKind::IoErr)?,
BinaryToken::F32_2(x) => write!(writer, "{}", x).map_err(Eu4ErrorKind::IoErr)?,
BinaryToken::Token(x) => match TokenLookup.resolve(*x) {
Some(id)
if (id == "is_ironman" || (id == "checksum" && !write_checksum))
Expand Down