Skip to content

Commit

Permalink
Bump version to 0.12.2 (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
yunjhongwu authored Dec 3, 2024
1 parent dbd27d3 commit 5c8530c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 31 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ use strong_type::StrongType;

#[derive(StrongType)]
#[strong_type(auto_operators)]

struct IsTrue(bool);

let x = IsTrue::new(true);
Expand All @@ -157,7 +156,6 @@ use strong_type::StrongType;

#[derive(StrongType)]
#[strong_type(custom_display)]

struct Second(f64);

impl Display for Second {
Expand Down
2 changes: 1 addition & 1 deletion strong-type-derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "strong-type-derive"
description = "Macro implemenation for #[derive(StrongType)]"
version = "0.12.1"
version = "0.12.2"
edition = "2021"

license = "MIT OR Apache-2.0"
Expand Down
2 changes: 0 additions & 2 deletions strong-type-tests/tests/auto_operators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ mod tests {
fn test_float_arithmetic() {
#[derive(StrongType)]
#[strong_type(auto_operators)]

struct Second(f64);

let x = Second::new(2.0);
Expand Down Expand Up @@ -182,7 +181,6 @@ mod tests {
fn test_bool_ops() {
#[derive(StrongType)]
#[strong_type(auto_operators)]

struct IsTrue(bool);

let x = IsTrue::new(true);
Expand Down
9 changes: 4 additions & 5 deletions strong-type-tests/tests/custom_underlying.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#[cfg(test)]
mod tests {
use std::mem;
use strong_type::StrongType;

fn test_type<T: std::fmt::Debug + Clone + Send + Sync + Default + PartialEq>() {}
Expand All @@ -15,7 +14,7 @@ mod tests {
#[strong_type(auto_operators, underlying=i32)]
struct Cash(Dollar);
test_type::<Cash>();
assert_eq!(mem::size_of::<Cash>(), mem::size_of::<i32>());
assert_eq!(size_of::<Cash>(), size_of::<i32>());

assert_eq!(
Cash::new(Dollar::new(10)),
Expand All @@ -32,7 +31,7 @@ mod tests {
#[strong_type(underlying=i32)]
struct Coin(Cash);
test_type::<Coin>();
assert_eq!(mem::size_of::<Coin>(), mem::size_of::<i32>());
assert_eq!(size_of::<Coin>(), size_of::<i32>());
assert_eq!(
format!("{}", Coin::new(Cash::new(Dollar::new(10)))),
"Coin(Cash(Dollar(10)))"
Expand All @@ -54,7 +53,7 @@ mod tests {
struct Name(Tag);

test_type::<Name>();
assert_eq!(mem::size_of::<Name>(), mem::size_of::<String>());
assert_eq!(size_of::<Name>(), size_of::<String>());
assert_eq!(
format!("{}", Name::new(Tag::new("tag".to_string()))),
"Name(Tag(tag))"
Expand All @@ -63,7 +62,7 @@ mod tests {
#[derive(StrongType)]
#[strong_type(underlying=String)]
struct Surname(Name);
assert_eq!(mem::size_of::<Surname>(), mem::size_of::<String>());
assert_eq!(size_of::<Surname>(), size_of::<String>());
assert_eq!(
format!("{}", Surname::new(Name::new(Tag::new("tag".to_string())))),
"Surname(Name(Tag(tag)))"
Expand Down
1 change: 0 additions & 1 deletion strong-type-tests/tests/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mod tests {

#[derive(StrongType)]
#[strong_type(custom_display)]

struct Mile(f64);

impl Display for Mile {
Expand Down
35 changes: 17 additions & 18 deletions strong-type-tests/tests/strong_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
mod tests {
use std::any::Any;
use std::collections::HashSet;
use std::mem;
use strong_type::StrongType;

fn test_type<T: std::fmt::Debug + Clone + Send + Sync + Default + PartialEq>() {}
Expand All @@ -12,87 +11,87 @@ mod tests {
#[derive(StrongType)]
struct NamedI8(i8);
test_type::<NamedI8>();
assert_eq!(mem::size_of::<NamedI8>(), mem::size_of::<i8>());
assert_eq!(size_of::<NamedI8>(),size_of::<i8>());

#[derive(StrongType)]
struct NamedI16(i16);
test_type::<NamedI16>();
assert_eq!(mem::size_of::<NamedI16>(), mem::size_of::<i16>());
assert_eq!(size_of::<NamedI16>(),size_of::<i16>());

#[derive(StrongType)]
struct NamedI32(i32);
test_type::<NamedI32>();
assert_eq!(mem::size_of::<NamedI32>(), mem::size_of::<i32>());
assert_eq!(size_of::<NamedI32>(),size_of::<i32>());

#[derive(StrongType)]
struct NamedI64(i64);
test_type::<NamedI64>();
assert_eq!(mem::size_of::<NamedI64>(), mem::size_of::<i64>());
assert_eq!(size_of::<NamedI64>(),size_of::<i64>());

#[derive(StrongType)]
struct NamedI128(i128);
test_type::<NamedI128>();
assert_eq!(mem::size_of::<NamedI128>(), mem::size_of::<i128>());
assert_eq!(size_of::<NamedI128>(),size_of::<i128>());

#[derive(StrongType)]
struct NamedISize(isize);
test_type::<NamedISize>();
assert_eq!(mem::size_of::<NamedISize>(), mem::size_of::<isize>());
assert_eq!(size_of::<NamedISize>(),size_of::<isize>());

#[derive(StrongType)]
struct NamedU8(u8);
test_type::<NamedU8>();
assert_eq!(mem::size_of::<NamedU8>(), mem::size_of::<u8>());
assert_eq!(size_of::<NamedU8>(),size_of::<u8>());

#[derive(StrongType)]
struct NamedU16(u16);
test_type::<NamedU16>();
assert_eq!(mem::size_of::<NamedU16>(), mem::size_of::<u16>());
assert_eq!(size_of::<NamedU16>(),size_of::<u16>());

#[derive(StrongType)]
struct NamedU32(u32);
test_type::<NamedU32>();
assert_eq!(mem::size_of::<NamedU32>(), mem::size_of::<u32>());
assert_eq!(size_of::<NamedU32>(),size_of::<u32>());

#[derive(StrongType)]
struct NamedU64(u64);
test_type::<NamedU64>();
assert_eq!(mem::size_of::<NamedU64>(), mem::size_of::<u64>());
assert_eq!(size_of::<NamedU64>(), size_of::<u64>());

#[derive(StrongType)]
struct NamedU128(u128);
test_type::<NamedU128>();
assert_eq!(mem::size_of::<NamedU128>(), mem::size_of::<u128>());
assert_eq!(size_of::<NamedU128>(), size_of::<u128>());

#[derive(StrongType)]
struct NamedUSize(usize);
test_type::<NamedUSize>();
assert_eq!(mem::size_of::<NamedUSize>(), mem::size_of::<usize>());
assert_eq!(size_of::<NamedUSize>(), size_of::<usize>());

#[derive(StrongType)]
struct NamedF32(f32);
test_type::<NamedF32>();
assert_eq!(mem::size_of::<NamedF32>(), mem::size_of::<f32>());
assert_eq!(size_of::<NamedF32>(), size_of::<f32>());

#[derive(StrongType)]
struct NamedF64(f64);
test_type::<NamedF64>();
assert_eq!(mem::size_of::<NamedF64>(), mem::size_of::<f64>());
assert_eq!(size_of::<NamedF64>(), size_of::<f64>());

#[derive(StrongType)]
struct NamedBool(bool);
test_type::<NamedBool>();
assert_eq!(mem::size_of::<NamedBool>(), mem::size_of::<bool>());
assert_eq!(size_of::<NamedBool>(), size_of::<bool>());

#[derive(StrongType)]
struct NamedChar(char);
test_type::<NamedChar>();
assert_eq!(mem::size_of::<NamedChar>(), mem::size_of::<char>());
assert_eq!(size_of::<NamedChar>(), size_of::<char>());

#[derive(StrongType)]
struct NamedString(String);
test_type::<NamedString>();
assert_eq!(mem::size_of::<NamedString>(), mem::size_of::<String>());
assert_eq!(size_of::<NamedString>(), size_of::<String>());
}

#[test]
Expand Down
4 changes: 2 additions & 2 deletions strong-type/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "strong-type"
description = "Procedural macros for naming and strong-typing pritimives and strings"
version = "0.12.1"
version = "0.12.2"
edition = "2021"

license = "MIT OR Apache-2.0"
Expand All @@ -10,4 +10,4 @@ repository = "https://github.com/yunjhongwu/strong-type"
readme = "../README.md"

[dependencies]
strong-type-derive = { version = "0.12.1", path = "../strong-type-derive" }
strong-type-derive = { version = "0.12.2", path = "../strong-type-derive" }

0 comments on commit 5c8530c

Please sign in to comment.