Struct std::ops::RangeFull

Overview

Type for a full range expression ...

Examples

let range = ..;

assert!(range.contains(-10));
assert!(range.contains(5));
assert!(range.contains(10));
assert!(range.contains(20));

assert!(range is std::ops::RangeFull);

Rust Examples

use rune::runtime::RangeFull;

let _ = RangeFull::new();

Methods

fn contains(self, _: any) -> bool

Test if the range contains the given value.

The check is performed using the [PARTIAL_CMP] protocol.

Examples

let range = ..;

assert!(range.contains(-10));
assert!(range.contains(5));
assert!(range.contains(10));
assert!(range.contains(20));

assert!(range is std::ops::RangeFull);

Trait Implementations

impl PartialEq for RangeFull
fn eq(value: any, value1: any) -> bool

Compare two values for equality.

Examples

assert_eq!(1.eq(2), false);
assert_eq!(2.eq(2), true);
assert_eq!(2.eq(1), false);
fn ne(value: any, value1: any) -> bool

Compare two values for inequality.

Examples

assert_eq!(1.ne(2), true);
assert_eq!(2.ne(2), false);
assert_eq!(2.ne(1), true);
impl Eq for RangeFull
impl PartialOrd for RangeFull
fn partial_cmp(value: any, value1: any) -> Option

Compare two values.

Examples

use std::cmp::Ordering;

assert_eq!(1.partial_cmp(2), Some(Ordering::Less));
assert_eq!(2.partial_cmp(2), Some(Ordering::Equal));
assert_eq!(2.partial_cmp(1), Some(Ordering::Greater));
fn lt(value: any, value1: any) -> bool

Tests less than (for self and other) and is used by the < operator.

Examples

assert_eq!(1.0 < 1.0, false);
assert_eq!(1.0 < 2.0, true);
assert_eq!(2.0 < 1.0, false);
fn le(value: any, value1: any) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator.

Examples

assert_eq!(1.0 <= 1.0, true);
assert_eq!(1.0 <= 2.0, true);
assert_eq!(2.0 <= 1.0, false);
fn gt(value: any, value1: any) -> bool

Tests greater than (for self and other) and is used by the > operator.

Examples

assert_eq!(1.0 > 1.0, false);
assert_eq!(1.0 > 2.0, false);
assert_eq!(2.0 > 1.0, true);
fn ge(value: any, value1: any) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator.

Examples

assert_eq!(1.0 >= 1.0, true);
assert_eq!(1.0 >= 2.0, false);
assert_eq!(2.0 >= 1.0, true);
impl Ord for RangeFull
fn cmp(value: any, value1: any) -> Ordering

Compare two values.

Examples

use std::cmp::Ordering;

assert_eq!(1.cmp(2), Ordering::Less);
assert_eq!(2.cmp(2), Ordering::Equal);
assert_eq!(2.cmp(1), Ordering::Greater);
fn min(value: any, value1: any) -> Ordering

Return the minimum of two values.

Examples

assert_eq!(1.min(2), 1);
assert_eq!(2.min(2), 2);
assert_eq!(2.min(1), 1);
fn max(value: any, value1: any) -> Ordering

Return the maximum of two values.

Examples

assert_eq!(1.max(2), 2);
assert_eq!(2.max(2), 2);
assert_eq!(2.max(1), 2);

Protocols

protocol PARTIAL_EQ
if value == b { }

Test the full range for partial equality.

Examples

let range = ..;
assert!(range == ..);
protocol EQ
if value == b { }

Test the full range for total equality.

Examples

use std::ops::eq;

let range = ..;
assert!(eq(range, ..));
protocol PARTIAL_CMP
if value < b { }

Test the full range for partial ordering.

Examples

assert!(!((..) < (..)));
assert!(!((..) > (..)));
protocol CMP
if value < b { }

Test the full range for total ordering.

Examples

use std::ops::cmp;
use std::cmp::Ordering;

assert_eq!(cmp(.., ..), Ordering::Equal);
protocol LT
if $a < $b { }

The protocol behind the < operator.

protocol LE
if $a <= $b { }

The protocol behind the <= operator.

protocol GT
if $a > $b { }

The protocol behind the > operator.

protocol GE
if $a >= $b { }

The protocol behind the >= operator.

protocol MIN
$a.min($b)

The implementation protocol for the PartialOrd::min method.

protocol MAX
$a.max($b)

The implementation protocol for the PartialOrd::max method.