macro_rules! moo {
(|$n: ident| -> $t: ty $do: block ; $len: expr) => { ... };
(|$n: ident| $do: expr ; $len: expr) => { ... };
(on $backend:ty : $($v: tt)*) => { ... };
(_ $($v: tt)*) => { ... };
($t: ty: $a: literal .. $b: literal) => { ... };
($t: ty: $a: literal ..= $b: literal) => { ... };
($t: ty: $($v: expr),* $(,)?) => { ... };
($($v: tt)*) => { ... };
}
Expand description
Macro for creating StaticCowVec
s
Example
use slas::prelude::*;
assert_eq!(**moo![f32: 1, 2, 3.5], [1., 2., 3.5]);
assert_eq!(**moo![f32: 1..4], [1., 2., 3.]);
assert_eq!(**moo![f32: 1..=3], [1., 2., 3.]);
assert_eq!(**moo![0f32; 4], [0.; 4]);
let mut tmp = [0.; 100];
for n in 0..100{
tmp[n] = (n as f32).sin()
}
assert_eq!(**moo![|n|-> f32 { (n as f32).sin() }; 100], tmp);
assert_eq!(**moo![|n| (n as f32).sin(); 100], tmp);