Skip to content

Commit

Permalink
feat: Introspect for SystemTime and Duration (#63)
Browse files Browse the repository at this point in the history
* feat: Introspect for SystemTime and Duration

* chore:Update README

* chore: release (#62)
  • Loading branch information
avl committed Jul 2, 2024
1 parent 983c4b6 commit 1cce218
Show file tree
Hide file tree
Showing 12 changed files with 58 additions and 12 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ See the docs for more information, including schema-versioning: https://docs.rs/

# Changelog

## 0.17.6

Support for introspection of std::time::Duration and std::time::SystemTime .

## 0.17.5

Support for std::time::Duration and std::time::SystemTime .
Expand Down
5 changes: 5 additions & 0 deletions savefile-abi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.17.6](https://github.com/avl/savefile/compare/savefile-abi-v0.17.5...savefile-abi-v0.17.6) - 2024-07-02

### Added
- Introspect for SystemTime and Duration

## [0.17.5](https://github.com/avl/savefile/compare/savefile-abi-v0.17.4...savefile-abi-v0.17.5) - 2024-07-02

### Other
Expand Down
6 changes: 3 additions & 3 deletions savefile-abi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "savefile-abi"
version = "0.17.5"
version = "0.17.6"
edition = "2021"
authors = ["Anders Musikka <[email protected]>"]
documentation = "https://docs.rs/savefile-abi/"
Expand All @@ -17,8 +17,8 @@ keywords = ["dylib", "dlopen", "ffi"]
license = "MIT/Apache-2.0"

[dependencies]
savefile = { path="../savefile", version = "=0.17.5" }
savefile-derive = { path="../savefile-derive", version = "=0.17.5" }
savefile = { path="../savefile", version = "=0.17.6" }
savefile-derive = { path="../savefile-derive", version = "=0.17.6" }
byteorder = "1.4"
libloading = "0.8"

Expand Down
2 changes: 1 addition & 1 deletion savefile-abi/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
extern crate rustc_version;
use rustc_version::{version_meta, Channel, Version};
use rustc_version::{version_meta, Version};
fn main() {
let version = version_meta().unwrap();
if version.semver >= Version::new(1,78,0) {
Expand Down
5 changes: 5 additions & 0 deletions savefile-derive/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.17.6](https://github.com/avl/savefile/compare/savefile-derive-v0.17.5...savefile-derive-v0.17.6) - 2024-07-02

### Added
- Introspect for SystemTime and Duration

## [0.17.4](https://github.com/avl/savefile/compare/savefile-derive-v0.17.3...savefile-derive-v0.17.4) - 2024-05-12

### Added
Expand Down
2 changes: 1 addition & 1 deletion savefile-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "savefile-derive"
version = "0.17.5"
version = "0.17.6"
authors = ["Anders Musikka <[email protected]>"]
repository = "https://github.com/avl/savefile"
rust-version = "1.74"
Expand Down
1 change: 1 addition & 0 deletions savefile-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ use syn::spanned::Spanned;
use syn::token::{Paren};
use syn::Type::Tuple;
use syn::{DeriveInput, FnArg, GenericParam, Generics, Ident, ImplGenerics, Index, ItemTrait, Pat, ReturnType, TraitItem, Type, TypeGenerics, TypeParamBound, TypeTuple};

fn implement_fields_serialize(
field_infos: Vec<FieldInfo>,
implicit_self: bool,
Expand Down
2 changes: 1 addition & 1 deletion savefile-test/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ nightly=["savefile/nightly"]

[dependencies]
savefile = { path = "../savefile", features = ["size_sanity_checks", "encryption", "compression","bit-set","bit-vec","rustc-hash","serde_derive", "quickcheck"]}
savefile-derive = { path = "../savefile-derive", version = "=0.17.5" }
savefile-derive = { path = "../savefile-derive", version = "=0.17.6" }
savefile-abi = { path = "../savefile-abi" }
bit-vec = "0.6"
arrayvec="0.7"
Expand Down
5 changes: 5 additions & 0 deletions savefile/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.17.6](https://github.com/avl/savefile/compare/savefile-v0.17.5...savefile-v0.17.6) - 2024-07-02

### Added
- Introspect for SystemTime and Duration

## [0.17.5](https://github.com/avl/savefile/compare/savefile-v0.17.4...savefile-v0.17.5) - 2024-07-02

### Added
Expand Down
6 changes: 3 additions & 3 deletions savefile/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "savefile"
version = "0.17.5"
version = "0.17.6"
authors = ["Anders Musikka <[email protected]>"]
documentation = "https://docs.rs/savefile/"
homepage = "https://github.com/avl/savefile/"
Expand Down Expand Up @@ -59,13 +59,13 @@ bit-set = {version = "0.5", optional = true}
rustc-hash = {version = "1.1", optional = true}
memoffset = "0.9"
byteorder = "1.4"
savefile-derive = {path="../savefile-derive", version = "=0.17.5", optional = true }
savefile-derive = {path="../savefile-derive", version = "=0.17.6", optional = true }
serde_derive = {version= "1.0", optional = true}
serde = {version= "1.0", optional = true}
quickcheck = {version= "1.0", optional = true}

[dev-dependencies]
savefile-derive = { path="../savefile-derive", version = "=0.17.5" }
savefile-derive = { path="../savefile-derive", version = "=0.17.6" }

[build-dependencies]
rustc_version="0.2"
Expand Down
26 changes: 26 additions & 0 deletions savefile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7416,6 +7416,32 @@ impl Deserialize for Duration {
}
}

impl Introspect for Duration {
fn introspect_value(&self) -> String {
format!("{:?}", self)
}

fn introspect_child<'a>(&'a self, _index: usize) -> Option<Box<dyn IntrospectItem<'a> + 'a>> {
None
}

fn introspect_len(&self) -> usize {
0
}
}
impl Introspect for SystemTime {
fn introspect_value(&self) -> String {
format!("{:?}", self)
}

fn introspect_child<'a>(&'a self, _index: usize) -> Option<Box<dyn IntrospectItem<'a> + 'a>> {
None
}

fn introspect_len(&self) -> usize {
0
}
}
impl WithSchema for SystemTime {
fn schema(_version: u32, _context: &mut WithSchemaContext) -> Schema {
Schema::Struct(SchemaStruct{
Expand Down

0 comments on commit 1cce218

Please sign in to comment.