Crates.io | scope-functions |
lib.rs | scope-functions |
version | 1.1.0 |
source | src |
created_at | 2024-06-16 03:38:47.29795 |
updated_at | 2024-06-17 03:02:45.465879 |
description | This crate provides Kotlin-inspired scope functions for use in almost any situation. |
homepage | |
repository | https://github.com/apsoyka/scope-functions |
max_upload_size | |
id | 1273249 |
size | 13,532 |
scope-functions
is a Rust crate that provides several Kotlin-inspired scope functions for use in almost any situation.
A scope function is a function whose sole purpose is to execute a block of code within the context of an object. Such functions accept a higher-order function, or closure, as their sole argument, and allow the programmer to perform operations on that object within a separate scope.
For example, a scope function may be used to perform an extra operation on an object before assigning it to a variable. This crate provides three types of scope functions: apply
, run
, and with
.
Function | Return Value |
---|
run
| Closure Result
with
| Closure Result
apply
| Context Object