pub struct IntervalLimit<T: Display + Clone + Hash + Ord> { /* private fields */ }
Expand description
A struct that represents a “limit” in an interval.
In order to understand this struct, it is important to correctly recognize the distinction between limit
and value
.
The limit is the value represented by this struct self
, and the value represented by value
is the limit value.
When a limit is “closed”, it means that the limit itself is not considered to be exceeded. An “open” limit means that it is considered to be exceeded.
An infinite limit is an unbounded limit, and we express this state by saying that value
is Limitless
.
Infinite limits are always considered to be open.
Conversely, a limit that is not an infinite limit (one whose value
is not Limitless
) is called a finite limit.
The lower limit represents the limit where values below (or below) the limit are considered to be exceeded, and the upper limit represents the limit where values above (or above) the limit are considered to be exceeded.
closed: if the limit is closed true lower:
truefor the lower limit,
false` for the upper limit
value: limit value, in the case of Limitless, it indicates that there is no limit.
Implementations§
Source§impl<T: Display + Clone + Hash + Eq + Ord + PartialEq + PartialOrd> IntervalLimit<T>
impl<T: Display + Clone + Hash + Eq + Ord + PartialEq + PartialOrd> IntervalLimit<T>
Sourcepub fn is_closed(&self) -> bool
pub fn is_closed(&self) -> bool
Verify whether this limit is closed or not.
- return: if it is closed,
true
, otherwisefalse
.
Sourcepub fn is_open(&self) -> bool
pub fn is_open(&self) -> bool
Verify whether this limit is open or not.
- return: if it is open,
true
, otherwisefalse
.
Sourcepub fn is_lower(&self) -> bool
pub fn is_lower(&self) -> bool
Verify whether or not this limit is the lower side limit.
- return:
true
for an lower limit,false
otherwise
Sourcepub fn is_upper(&self) -> bool
pub fn is_upper(&self) -> bool
Verify whether or not this limit is the upper side limit.
- return:
true
for an upper limit,false
otherwise
Sourcepub fn is_infinity(&self) -> bool
pub fn is_infinity(&self) -> bool
Verify whether this limit is an infinite limit.
- return: if it is an infinite limit, it is
true
, otherwise it is `false
Sourcepub fn is_finite(&self) -> bool
pub fn is_finite(&self) -> bool
Verify whether this limit is an finite limit.
- return: if it is an finite limit, it is
true
, otherwise it is `false
Sourcepub fn as_value(&self) -> &LimitValue<T>
pub fn as_value(&self) -> &LimitValue<T>
Get limit value.
- return: limit value
Sourcepub fn new(closed: bool, lower: bool, value: LimitValue<T>) -> Self
pub fn new(closed: bool, lower: bool, value: LimitValue<T>) -> Self
Generate a limit
- params
- closed: if the limit is closed `true
- lower:
true
for the lower limit,false
for the upper limit - value: limit value, in the case of Limitless, it indicates that there is no limit.
- return: a new limit
Sourcepub fn lower(closed: bool, value: LimitValue<T>) -> Self
pub fn lower(closed: bool, value: LimitValue<T>) -> Self
Generate a lower limit
- params
- closed: if the limit is closed `true
- value: limit value, in the case of Limitless, it indicates that there is no limit.
- return: a new limit
Sourcepub fn upper(closed: bool, value: LimitValue<T>) -> Self
pub fn upper(closed: bool, value: LimitValue<T>) -> Self
Generate a upper limit
- params
- closed: if the limit is closed `true
- value: limit value, in the case of Limitless, it indicates that there is no limit.
- return: a new limit
Trait Implementations§
Source§impl<T: Clone + Display + Clone + Hash + Ord> Clone for IntervalLimit<T>
impl<T: Clone + Display + Clone + Hash + Ord> Clone for IntervalLimit<T>
Source§fn clone(&self) -> IntervalLimit<T>
fn clone(&self) -> IntervalLimit<T>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more