pub struct RangeTo {
pub end: Value,
}
Expand description
Type for an inclusive range expression ..end
.
§Examples
let range = ..10;
assert!(range.contains(-10));
assert!(range.contains(5));
assert!(!range.contains(10));
assert!(!range.contains(20));
assert!(range is std::ops::RangeTo);
Ranges can contain any type:
let range = ..'f';
assert_eq!(range.end, 'f');
range.end = 'g';
assert_eq!(range.end, 'g');
§Examples
use rune::runtime::RangeTo;
let end = rune::to_value(1)?;
let _ = RangeTo::new(end);
Fields§
§end: Value
The end value of the range.
Implementations§
source§impl RangeTo
impl RangeTo
sourcepub fn partial_eq(&self, other: &Self) -> VmResult<bool>
pub fn partial_eq(&self, other: &Self) -> VmResult<bool>
Test the range for partial equality.
§Examples
let range = ..'e';
assert!(range == (..'e'));
assert!(range != (..'f'));
let range = ..2.0;
assert!(range == (..2.0));
assert!(range != (..f64::NAN));
assert!((..f64::NAN) != (..f64::NAN));
sourcepub fn eq(&self, other: &Self) -> VmResult<bool>
pub fn eq(&self, other: &Self) -> VmResult<bool>
Test the range for total equality.
§Examples
use std::ops::eq;
let range = ..'e';
assert!(eq(range, ..'e'));
assert!(!eq(range, ..'f'));
Trait Implementations§
source§impl FromValue for RangeTo
impl FromValue for RangeTo
source§fn from_value(value: Value) -> VmResult<Self>
fn from_value(value: Value) -> VmResult<Self>
Try to convert to the given type, from the given value.
source§impl InstallWith for RangeTo
impl InstallWith for RangeTo
source§fn install_with(module: &mut Module) -> Result<(), ContextError>
fn install_with(module: &mut Module) -> Result<(), ContextError>
Hook to install more things into the module.
source§impl MaybeTypeOf for RangeTo
impl MaybeTypeOf for RangeTo
source§fn maybe_type_of() -> Option<FullTypeOf>
fn maybe_type_of() -> Option<FullTypeOf>
Type information for the given type.
source§impl UnsafeToMut for RangeTo
impl UnsafeToMut for RangeTo
Auto Trait Implementations§
impl !RefUnwindSafe for RangeTo
impl !Send for RangeTo
impl !Sync for RangeTo
impl Unpin for RangeTo
impl !UnwindSafe for RangeTo
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more