MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / range

Function range

flow-rs/src/config/parser.rs:31–57  ·  view source on GitHub ↗
(n: Data)

Source from the content-addressed store, hash-verified

29}
30
31fn range(n: Data) -> Data {
32 let list = match &*n {
33 Unstructured::Number(end) => range_impl(0, end.into(), 1),
34 Unstructured::Seq(list) => match &list[..] {
35 [start, end] => {
36 let start = get_num(start);
37 let end = get_num(end);
38 range_impl(start, end, 1)
39 }
40 [start, end, step] => {
41 let start = get_num(start);
42 let end = get_num(end);
43 let step = get_num(step);
44 assert!(step > 0);
45 range_impl(start, end, step)
46 }
47 _ => unreachable!(),
48 },
49 _ => unreachable!(),
50 };
51
52 Data::new(Unstructured::Seq(
53 list.into_iter()
54 .map(|x| Unstructured::Number(Number::I64(x)))
55 .collect(),
56 ))
57}
58
59lazy_static::lazy_static! {
60 pub static ref TEMPLAR: Templar = {

Callers 15

execMethod · 0.85
repeatFunction · 0.85
execMethod · 0.85
raw_nmsFunction · 0.85
nmsFunction · 0.85
execMethod · 0.85
interpolateMethod · 0.85
popMethod · 0.85
raw_nmsFunction · 0.85
runFunction · 0.85
visFunction · 0.85
cpu_nmsFunction · 0.85

Calls 2

range_implFunction · 0.85
get_numFunction · 0.85

Tested by

no test coverage detected