Skip to main content

Mrs

Struct Mrs 

Source
pub struct Mrs<T> { /* private fields */ }
Expand description

Mrs Minimal Range Span

In a nut shell this is the minimal struct to represent a range for crate. Requires that GetBeginEnd and std::ops::RangeBounds be imported to use all implemented traits.

use common_range_tools::{
  Mrs,
  GetBeginEnd  // only required for the self.get_begin() and self.get_end() methods.
};
use std::ops::{RangeBounds,Bound};

fn main () {
   let r=Mrs::new(1,2);
   assert_eq!(r.start_bound(),Bound::Included(&1));
   assert_eq!(r.end_bound(),Bound::Included(&2));
   assert_eq!(r.get_begin(),&1);
   assert_eq!(r.get_end(),&2);
}

Implementations§

Source§

impl<T> Mrs<T>

Source

pub fn new(a: T, z: T) -> Self

Constructs a new Mrs instance.

Trait Implementations§

Source§

impl<T> From<(T, T)> for Mrs<T>

Source§

fn from(value: (T, T)) -> Mrs<T>

Converts to this type from the input type.
Source§

impl<T> From<Mrs<T>> for RangeInclusive<T>

Source§

fn from(value: Mrs<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Mrs<T>> for (T, T)

Source§

fn from(value: Mrs<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<RangeInclusive<T>> for Mrs<T>

Source§

fn from(value: RangeInclusive<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> GetBeginEnd<T> for Mrs<T>

Source§

fn get_begin(&self) -> &T

Should return a borrowed instance of the begin value.
Source§

fn get_end(&self) -> &T

Should return a borrowed instance of the end value.
Source§

fn to_tuple(self) -> (T, T)

Source§

fn to_tuple_ref(&self) -> (&T, &T)

Source§

impl<T> GetBeginEndOption<T, Mrs<T>> for MrsFactory<T>

Source§

fn new_range(&self, src: (T, T)) -> Mrs<T>

Source§

fn factory(&self, opt: Option<(T, T)>) -> Option<Mrs<T>>

Source§

impl<T> RangeBounds<T> for Mrs<T>

Source§

fn start_bound(&self) -> Bound<&T>

Wraps the return value from self.get_begin() in a std::ops::Bound::Included.

Source§

fn end_bound(&self) -> Bound<&T>

Wraps the return value from self.get_end() in a std::ops::Bound::Included.

1.35.0 (const: unstable) · Source§

fn contains<U>(&self, item: &U) -> bool
where T: PartialOrd<U>, U: PartialOrd<T> + ?Sized,

Returns true if item is contained in the range. Read more
Source§

fn is_empty(&self) -> bool
where T: PartialOrd,

🔬This is a nightly-only experimental API. (range_bounds_is_empty)
Returns true if the range contains no items. One-sided ranges (RangeFrom, etc) always return false. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Mrs<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Mrs<T>
where T: RefUnwindSafe,

§

impl<T> Send for Mrs<T>
where T: Send,

§

impl<T> Sync for Mrs<T>
where T: Sync,

§

impl<T> Unpin for Mrs<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Mrs<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Mrs<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.