add "each"

This commit is contained in:
2020-10-10 21:39:00 +06:00
parent 5a13437c17
commit 66e75b4315
2 changed files with 8 additions and 0 deletions

View File

@@ -48,6 +48,13 @@ sealed class TimeBuilder (
result = (result ?: emptySet()) + value.clamp(restrictionsRange)
}
/**
* Shortcut for [at]. In fact will
*/
@Suppress("unused", "NOTHING_TO_INLINE")
inline infix fun each(value: Int) = at(value)
/**
* Just wrapper for more obvious writing something like "[from] 2 [every] 5". For example, for [SecondsBuilder] it
* will mean "[from] second second [every] 5 seconds", or "2, 7, 13, ..."