-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Basis point struct should not expose inner value:
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
-pub struct BasisPoint(pub u64);
+pub struct BasisPoint(u64);As you're violating encapsulation, and struct becomes pointless. Also, probably get method can be replaced with Deref trait implementation, and will be easier to use.
For constants, you can create convenience method BasisPoint::new_unchecked:
-pub const PROPOSER_REORG_CUTOFF_BPS: BasisPoint = match BasisPoint::new(2_500) { Some(x) => x, None => panic!() };
+pub const PROPOSER_REORG_CUTOFF_BPS: BasisPoint = BasisPoint::new_unchecked(2_500);Just make sure to not make it public.
Metadata
Metadata
Assignees
Labels
No labels