apple_quant_algorithmic/volume/zeroable/
volume.rs1use apple_quant_core::{AddReleaseUnchecked, SubReleaseUnchecked};
2
3use crate::volume::FromVolumeTypeError;
4
5use super::Zeroable;
6
7pub trait ZeroableVolume:
8 AddReleaseUnchecked<Self, Self, Result<Self, FromVolumeTypeError>>
9 + SubReleaseUnchecked<Self, Self, Result<Self, FromVolumeTypeError>>
10 + std::fmt::Debug
11 + Clone
12 + Copy
13 + PartialEq
14 + Eq
15 + PartialOrd
16 + Ord
17where
18 Self: Into<Result<Self, FromVolumeTypeError>>,
19{
20 const ZERO: Self;
21
22 fn is_zero(
23 &self,
24 ) -> bool;
25
26 fn as_zeroable(
27 &self,
28 ) -> Zeroable<Self> {
29 Zeroable::from_zeroable(*self)
30 }
31
32 fn into_zeroable(
33 self,
34 ) -> Zeroable<Self> {
35 Zeroable::from_zeroable(self)
36 }
37}