1 unstable release
0.1.1 | Sep 18, 2020 |
---|---|
0.1.0 |
|
#1721 in Algorithms
47KB
1.5K
SLoC
A signal is a structure that can yield an infinite amount of data. The API is very similar to std::iter::Iterator
but with the assumption that it will never end.
Example
use langis;
let my_signal = langis::square( langis::constant(0.25) );
loop {
assert_eq!(my_signal.next(), 1.0);
assert_eq!(my_signal.next(), 1.0);
assert_eq!(my_signal.next(), -1.0);
assert_eq!(my_signal.next(), -1.0);
}
lib.rs
:
A signal is a structure that can yield an infinite amount of data. The API is very similar to std::iter::Iterator
but with the assumption that it will never end.
Example
use langis::Signal;
let mut my_signal = langis::cycle( "hello".chars() );
for _ in 0..100 {
assert_eq!(my_signal.next(), 'h');
assert_eq!(my_signal.next(), 'e');
assert_eq!(my_signal.next(), 'l');
assert_eq!(my_signal.next(), 'l');
assert_eq!(my_signal.next(), 'o');
}
Dependencies
~0–580KB
~10K SLoC