This commit is contained in:
alex-s168
2024-04-02 20:38:28 +02:00
parent 9a571a072d
commit 56546094c5
5 changed files with 6 additions and 8 deletions

View File

@@ -12,7 +12,7 @@ repositories {
}
dependencies {
implementation("me.alex_s168:blitz:0.11")
implementation("me.alex_s168:blitz:0.12")
}
```

View File

@@ -5,7 +5,7 @@ plugins {
}
group = "me.alex_s168"
version = "0.11"
version = "0.12"
repositories {
mavenCentral()

View File

@@ -1,7 +1,5 @@
package blitz.async
import kotlin.random.Random
// TODO: use coroutines?
fun <R> async(fn: () -> R): Future<R> {
lateinit var future: ThreadWaitingFuture<R>

View File

@@ -4,7 +4,7 @@ import kotlin.math.max
object Search {
/**
* Find a element by comparing.
* Find an element by comparing.
* Only works on sorted lists
*/
fun <T, C: Comparable<C>> findElementComparing(

View File

@@ -3,7 +3,7 @@ package blitz.logic
/**
* Execute a block if the boolean is true.
*/
fun Boolean.then(block: () -> Unit): Boolean {
inline fun Boolean.then(block: () -> Unit): Boolean {
if (this) {
block()
}
@@ -14,7 +14,7 @@ fun Boolean.then(block: () -> Unit): Boolean {
/**
* Execute a block if the boolean is false.
*/
fun Boolean.otherwise(block: () -> Unit): Boolean {
inline fun Boolean.otherwise(block: () -> Unit): Boolean {
if (!this) {
block()
}
@@ -25,7 +25,7 @@ fun Boolean.otherwise(block: () -> Unit): Boolean {
/**
* Execute a block if the boolean is true, otherwise execute another block.
*/
fun Boolean.then(block: () -> Unit, otherwise: () -> Unit): Boolean {
inline fun Boolean.then(block: () -> Unit, otherwise: () -> Unit): Boolean {
if (this) {
block()
} else {