postgres_range::range!
[−]
[src]
macro_rules! range { (empty) => { ... }; ('(',; ')') => { ... }; ('(', $h:expr; ')') => { ... }; ('(', $h:expr; ']') => { ... }; ('(' $l:expr,; ')') => { ... }; ('[' $l:expr,; ')') => { ... }; ('(' $l:expr, $h:expr; ')') => { ... }; ('(' $l:expr, $h:expr; ']') => { ... }; ('[' $l:expr, $h:expr; ')') => { ... }; ('[' $l:expr, $h:expr; ']') => { ... }; }
The range!
macro can make it easier to create ranges. It roughly mirrors
traditional mathematic range syntax.
Example
#[macro_use] extern crate postgres_range; use postgres_range::Range; fn main() { let mut r: Range<i32>; // a closed interval r = range!('[' 5i32, 10i32; ']'); // an open interval r = range!('(' 5i32, 10i32; ')'); // half-open intervals r = range!('(' 5i32, 10i32; ']'); r = range!('[' 5i32, 10i32; ')'); // a closed lower-bounded interval r = range!('[' 5i32,; ')'); // an open lower-bounded interval r = range!('(' 5i32,; ')'); // a closed upper-bounded interval r = range!('(', 10i32; ']'); // an open upper-bounded interval r = range!('(', 10i32; ')'); // an unbounded interval r = range!('(',; ')'); // an empty interval r = range!(empty); }