Range

struct Range<T: Comparable<T>

A half-open interval: lower is included and upper is excluded.

a..<b desugars to this type. Half-open bounds compose without overlap and make an empty range representable as lower == upper; prefer ClosedRange when the upper endpoint must participate.

Properties

let lower: T

The inclusive lower bound.

let upper: T

The exclusive upper bound.

Methods

func contains(element: T) -> Bool

Tests lower <= element < upper.

View Source
pub func contains(element: T) -> Bool {
	element >= self.lower && element < self.upper
}