aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorHarsh Shandilya <me@msfjarvis.dev>2021-05-30 02:18:00 +0530
committerHarsh Shandilya <me@msfjarvis.dev>2021-05-30 02:20:58 +0530
commit6388bc7ac93d3b302abe6598cfc6eef70a9fea3d (patch)
treeb4f54ea1838fb4d786a4ceafffd3411aae8de5fc /app
parent4bc023ce3bb108913816c91b383872f999c8c0c8 (diff)
extensions: add unsafeLazy
Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
Diffstat (limited to 'app')
-rw-r--r--app/src/main/java/dev/msfjarvis/aps/util/extensions/Extensions.kt3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/src/main/java/dev/msfjarvis/aps/util/extensions/Extensions.kt b/app/src/main/java/dev/msfjarvis/aps/util/extensions/Extensions.kt
index a6d0066c..f04dba33 100644
--- a/app/src/main/java/dev/msfjarvis/aps/util/extensions/Extensions.kt
+++ b/app/src/main/java/dev/msfjarvis/aps/util/extensions/Extensions.kt
@@ -75,3 +75,6 @@ val RevCommit.time: Date
fun String.splitLines(): Array<String> {
return split("\n".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray()
}
+
+/** Alias to [lazy] with thread safety mode always set to [LazyThreadSafetyMode.NONE]. */
+fun <T> unsafeLazy(initializer: () -> T) = lazy(LazyThreadSafetyMode.NONE) { initializer.invoke() }