use super::BigIntegerLimits;
use crate::resource::ResourceLimit;
use crate::resource::ResourceQuantity;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct BigIntegerLimitsBuilder<R, Q = u64>
where
Q: ResourceQuantity,
{
limits: BigIntegerLimits<R, Q>,
}
impl<R, Q> Default for BigIntegerLimitsBuilder<R, Q>
where
Q: ResourceQuantity,
{
fn default() -> Self {
Self::new()
}
}
impl<R, Q> BigIntegerLimitsBuilder<R, Q>
where
Q: ResourceQuantity,
{
#[inline]
#[must_use]
pub const fn new() -> Self {
Self {
limits: BigIntegerLimits::new(),
}
}
#[inline]
#[must_use]
pub(crate) const fn from_limits(limits: BigIntegerLimits<R, Q>) -> Self {
Self { limits }
}
#[inline]
#[must_use]
pub fn magnitude_bits_limit(mut self, limit: ResourceLimit<R, Q>) -> Self {
self.limits.set_magnitude_bits_limit(limit);
self
}
#[inline]
#[must_use]
pub fn significant_decimal_digits_limit(mut self, limit: ResourceLimit<R, Q>) -> Self {
self.limits.set_significant_decimal_digits_limit(limit);
self
}
#[inline]
#[must_use]
pub fn build(self) -> BigIntegerLimits<R, Q> {
self.limits
}
}