From 4b799c0ecfac0d501ce335147c2ed021e5d4bea9 Mon Sep 17 00:00:00 2001 From: Andrew Golovashevich Date: Fri, 5 Sep 2025 00:49:19 +0300 Subject: [PATCH] More access to HandleWrapper members because it anyway must be wrapped --- build.gradle.kts | 2 +- .../utility/closeable_state_1/HandleWrapper.kt | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 581f846..cc60afa 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,7 +15,7 @@ buildscript { } group = "ru.landgrafhomyak.utility" -version = "1.1" +version = "1.2" repositories { mavenCentral() diff --git a/src/commonMain/kotlin/ru/landgrafhomyak/utility/closeable_state_1/HandleWrapper.kt b/src/commonMain/kotlin/ru/landgrafhomyak/utility/closeable_state_1/HandleWrapper.kt index 0af47b3..7d274fe 100644 --- a/src/commonMain/kotlin/ru/landgrafhomyak/utility/closeable_state_1/HandleWrapper.kt +++ b/src/commonMain/kotlin/ru/landgrafhomyak/utility/closeable_state_1/HandleWrapper.kt @@ -4,24 +4,22 @@ import kotlin.contracts.InvocationKind import kotlin.contracts.contract public class HandleWrapper( - handle: H, - state: CloseableState, + public val handle: H, + public val state: CloseableState, ) { - private val _unprotected = handle - private val _state: CloseableState = state public fun useHandle(method: (H) -> R): R { contract { callsInPlace(method, InvocationKind.EXACTLY_ONCE) } - return this._state.withUse { method(this._unprotected) } + return this.state.withUse { method(this.handle) } } @ManualStateManipulation - private fun close() { - this._state.close() + public fun close() { + this.state.close() } - override fun toString(): String = "" + override fun toString(): String = "" } \ No newline at end of file