Skip to content

Commit

Permalink
Merge pull request #3630 from oasisprotocol/kostko/feature/minor-updates
Browse files Browse the repository at this point in the history
Various minor updates
  • Loading branch information
kostko authored Jan 13, 2021
2 parents 8814b32 + 1d88833 commit eba3342
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions .changelog/3630.internal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
go/common/cbor: Re-export Marshaler and Unmarshaler interfaces
9 changes: 9 additions & 0 deletions go/common/cbor/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ import (
// precompute a CBOR encoding.
type RawMessage = cbor.RawMessage

// Marshaler is the interface implemented by types that can marshal themselves
// into valid CBOR.
type Marshaler = cbor.Marshaler

// Unmarshaler is the interface implemented by types that wish to unmarshal
// CBOR data themselves. The input is a valid CBOR value. UnmarshalCBOR
// must copy the CBOR data if it needs to use it after returning.
type Unmarshaler = cbor.Unmarshaler

var (
encOptions = cbor.EncOptions{
Sort: cbor.SortCanonical,
Expand Down
6 changes: 6 additions & 0 deletions runtime/src/common/quantity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ impl<'a> AddAssign<&'a Quantity> for Quantity {
}
}

impl fmt::Display for Quantity {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
self.0.fmt(f)
}
}

impl serde::Serialize for Quantity {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
Expand Down

0 comments on commit eba3342

Please sign in to comment.