Skip to content

Commit

Permalink
prepare next release
Browse files Browse the repository at this point in the history
  • Loading branch information
JesusMcCloud committed Jun 18, 2024
1 parent 9d6936c commit 12bd661
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
## 1.6.2
- `wrapping` function, which wraps any exception as the specified type

## Next
## 1.7.0
- add `out` qualifier to KmmResult's type parameter
- add `recoverCatching` to match Kotlin's `result`
- add `callsInPlace` contracts
- return result fon `onFailure` and `onSuccess`
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ kotlin.mpp.enableCInteropCommonization=true
kotlin.mpp.stability.nowarn=true
kotlin.native.ignoreDisabledTargets=true

artifactVersion = 1.6.2
artifactVersion = 1.7.0
6 changes: 4 additions & 2 deletions src/commonMain/kotlin/at/asitplus/KmmResult.kt
Original file line number Diff line number Diff line change
Expand Up @@ -186,21 +186,23 @@ private constructor(
/**
* singular version of `fold`'s `onSuccess`
*/
inline fun <R> onSuccess(block: (value: T) -> R) {
inline fun <R> onSuccess(block: (value: T) -> R): KmmResult<T> {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
}
if (isSuccess) block(getOrThrow())
return this
}

/**
* singular version of `fold`'s `onFailure`
*/
inline fun <R> onFailure(block: (error: Throwable) -> R) {
inline fun <R> onFailure(block: (error: Throwable) -> R): KmmResult<T> {
contract {
callsInPlace(block, InvocationKind.AT_MOST_ONCE)
}
exceptionOrNull()?.let { block(it) }
return this
}

/**
Expand Down

0 comments on commit 12bd661

Please sign in to comment.