Merge pull request #441 from str4d/memuse-0.2
`impl memuse::DynamicUsage for Amount`
This commit is contained in:
commit
a3df9dd47d
|
@ -51,6 +51,8 @@ and this library adheres to Rust's notion of
|
||||||
data, as described above.
|
data, as described above.
|
||||||
- `zcash_primitives::serialize` has been factored out as a new `zcash_encoding`
|
- `zcash_primitives::serialize` has been factored out as a new `zcash_encoding`
|
||||||
crate, which can be found in the `components` directory.
|
crate, which can be found in the `components` directory.
|
||||||
|
- `zcash_primitives::transaction::components::Amount` now implements
|
||||||
|
`memuse::DynamicUsage`, to enable `orchard::Bundle<_, Amount>::dynamic_usage`.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- MSRV is now 1.51.0.
|
- MSRV is now 1.51.0.
|
||||||
|
|
|
@ -33,6 +33,7 @@ incrementalmerkletree = "0.1"
|
||||||
jubjub = "0.8"
|
jubjub = "0.8"
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
memuse = "0.2"
|
||||||
nonempty = "0.7"
|
nonempty = "0.7"
|
||||||
orchard = "0.0"
|
orchard = "0.0"
|
||||||
pasta_curves = "0.2"
|
pasta_curves = "0.2"
|
||||||
|
|
|
@ -23,6 +23,18 @@ pub const DEFAULT_FEE: Amount = Amount(1000);
|
||||||
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord)]
|
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd, Eq, Ord)]
|
||||||
pub struct Amount(i64);
|
pub struct Amount(i64);
|
||||||
|
|
||||||
|
impl memuse::DynamicUsage for Amount {
|
||||||
|
#[inline(always)]
|
||||||
|
fn dynamic_usage(&self) -> usize {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
|
fn dynamic_usage_bounds(&self) -> (usize, Option<usize>) {
|
||||||
|
(0, Some(0))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Amount {
|
impl Amount {
|
||||||
/// Returns a zero-valued Amount.
|
/// Returns a zero-valued Amount.
|
||||||
pub const fn zero() -> Self {
|
pub const fn zero() -> Self {
|
||||||
|
|
Loading…
Reference in New Issue