Skip to content

Commit f627b8e

Browse files
committed
merge
2 parents d9f2ab9 + 0cbb62e commit f627b8e

File tree

7 files changed

+54
-11
lines changed

7 files changed

+54
-11
lines changed

.github/workflows/rust.yml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Rust
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Install nightly
20+
run: rustup toolchain install nightly
21+
- name: Build (nightly)
22+
run: cargo +nightly build --workspace
23+
- name: Run tests (nightly)
24+
run: cargo +nightly test --workspace
25+
- name: Build min-deps (nightly)
26+
run: cargo +nightly build -p savefile-min-build
27+
- name: Build (stable)
28+
run: cargo +stable build --workspace
29+
- name: Run tests (stable)
30+
run: cargo +stable test --workspace
31+
- name: Build min-deps (stable)
32+
run: cargo +stable build -p savefile-min-build

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
![build](https://github.com/avl/savefile/actions/workflows/rust.yml/badge.svg)
2+
13
# Introduction to Savefile
24

35
Savefile is a library to effortlessly serialize rust structs and enums. It uses
@@ -63,6 +65,10 @@ fn main() {
6365

6466
# Changelog
6567

68+
## 0.16.3
69+
70+
Just some fixes to the test suite, needed to make github actions CI work.
71+
6672
## 0.16.2
6773

6874
Fixes multiple problems. The most impactful being that 0.16.1 could only be built

savefile-derive/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "savefile-derive"
3-
version = "0.16.2"
3+
version = "0.16.3"
44
authors = ["Anders Musikka <[email protected]>"]
55

66
description = "Custom derive macros for savefile crate - simple, convenient, fast, versioned, binary serialization/deserialization library."

savefile-test/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "savefile-test"
33
version = "0.0.1"
44
authors = ["Anders Musikka <[email protected]>"]
5-
5+
resolver = "2"
66
[features]
77
default = ["external_benchmarks"]
88
# Enable this to reduce risk of crashing on corrupt input. Provides sanity checks for sizes of objects.
@@ -12,11 +12,11 @@ nightly=["savefile/nightly"]
1212

1313
[dependencies]
1414
savefile = { path = "../savefile", features = ["size_sanity_checks", "encryption", "compression","bit-set","bit-vec","rustc-hash"]}
15-
savefile-derive = { path = "../savefile-derive" }
15+
savefile-derive = { path = "../savefile-derive", version = "=0.16.3" }
1616
bit-vec = "0.6"
1717
arrayvec="0.7"
1818
smallvec="*"
19-
indexmap="*"
19+
indexmap = { version = "1.9"}
2020
byteorder="*"
2121
rand="0.8"
2222
parking_lot="0.12"

savefile-test/src/lib.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#![cfg_attr(feature="nightly", feature(integer_atomics))]
21
#![allow(unused_imports)]
32
#![cfg_attr(feature="nightly", feature(test))]
43
#![deny(warnings)]
@@ -1413,7 +1412,7 @@ pub fn test_struct_with_ignored_member() {
14131412
pub fn test_indexmap() {
14141413
let mut imap = IndexMap::new();
14151414
assert_roundtrip(imap.clone());
1416-
imap.insert(43,"hej".to_string());
1415+
imap.insert(43u32,"hej".to_string());
14171416
assert_roundtrip(imap.clone());
14181417

14191418
imap.insert(44,"hej".to_string());
@@ -1426,7 +1425,7 @@ pub fn test_indexmap() {
14261425
pub fn test_indexset() {
14271426
let mut iset = IndexSet::new();
14281427
assert_roundtrip(iset.clone());
1429-
iset.insert((43,44));
1428+
iset.insert((43u32,44u32));
14301429
assert_roundtrip(iset.clone());
14311430

14321431
iset.insert((43,43));

savefile/Cargo.toml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "savefile"
3-
version = "0.16.2"
3+
version = "0.16.3"
44
authors = ["Anders Musikka <[email protected]>"]
55
documentation = "https://docs.rs/savefile/"
66
homepage = "https://github.com/avl/savefile/"
@@ -52,10 +52,10 @@ bit-set = {version = "0.5", optional = true}
5252
rustc-hash = {version = "1.1", optional = true}
5353
memoffset = "0.9"
5454
byteorder = "1.4"
55-
savefile-derive = {path="../savefile-derive",version = "=0.16.2", optional = true }
55+
savefile-derive = {path="../savefile-derive", version = "=0.16.3", optional = true }
5656

5757
[dev-dependencies]
58-
savefile-derive = { path="../savefile-derive" }
58+
savefile-derive = { path="../savefile-derive", version = "=0.16.3" }
5959

6060
[build-dependencies]
6161
rustc_version="0.2"

savefile/src/lib.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ Mark the struct like so:
9999
```
100100
extern crate savefile;
101101
use savefile::prelude::*;
102-
102+
use std::path::Path;
103103
#[macro_use]
104104
extern crate savefile_derive;
105105
@@ -126,6 +126,8 @@ fn load_player(file:&'static str) -> Player {
126126
}
127127
128128
fn main() {
129+
if Path::new("save.bin").exists() == false { /* error handling */ return;}
130+
129131
let mut player = load_player("save.bin"); //Load from previous save
130132
assert_eq!("Steve",&player.name); //The name from the previous version saved will remain
131133
assert_eq!(0,player.skills.len()); //Skills didn't exist when this was saved
@@ -470,6 +472,7 @@ Rules for using the #\[savefile_versions] attribute:
470472
```
471473
extern crate savefile;
472474
use savefile::prelude::*;
475+
use std::path::Path;
473476
474477
#[macro_use]
475478
extern crate savefile_derive;
@@ -503,6 +506,9 @@ Rules for using the #\[savefile_versions] attribute:
503506
}
504507
505508
fn main() {
509+
510+
if Path::new("newsave.bin").exists() == false { /* error handling */ return;}
511+
506512
let mut player = load_player("newsave.bin"); //Load from previous save
507513
player.history.push(Position{x:1,y:1});
508514
player.history.push(Position{x:2,y:1});

0 commit comments

Comments
 (0)