Skip to content

Commit

Permalink
Fix default value for Option<T>
Browse files Browse the repository at this point in the history
  • Loading branch information
fafhrd91 committed Nov 14, 2022
1 parent b1b7b44 commit b9e0379
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 4 additions & 0 deletions ntex-grpc/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## [0.2.0-b.1] - 2022-11-14

* Fix default value for Option<T>, None is always default

## [0.2.0-b.0] - 2022-11-01

* Add request context for client calls
Expand Down
2 changes: 1 addition & 1 deletion ntex-grpc/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ntex-grpc"
version = "0.2.0-b.0"
version = "0.2.0-b.1"
license = "MIT"
authors = ["Nikolay Kim <[email protected]>"]
description = "GRPC Client/Server framework"
Expand Down
8 changes: 2 additions & 6 deletions ntex-grpc/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,11 +243,7 @@ impl<T: NativeType> NativeType for Option<T> {

#[inline]
fn is_default(&self) -> bool {
if let Some(ref inner) = self {
inner.is_default()
} else {
true
}
self.is_none()
}

#[inline]
Expand Down Expand Up @@ -496,7 +492,7 @@ macro_rules! varint {
}

varint!(bool, false,
to_uint64(self) if *self { 1u64 } else { 0u64 },
to_uint64(self) u64::from(*self),
from_uint64(value) value != 0);
varint!(i32, 0i32);
varint!(i64, 0i64);
Expand Down

0 comments on commit b9e0379

Please sign in to comment.