Does Kotlin Native have a feature for copying valu...
# kotlin-native
n
Does Kotlin Native have a feature for copying values from one struct to another that is of the same type? Currently doing the following which is tedious/error prone:
Copy code
// ...
private val globalArena = Arena()
private val originalSettings = globalArena.alloc<termios>()
private val newSettings = globalArena.alloc<termios>()
// ...
private fun setupTerminal() {
    tcgetattr(STDIN_FILENO, originalSettings.ptr)
    newSettings.run {
        c_ispeed = originalSettings.c_ispeed
        c_ospeed = originalSettings.c_ospeed
        c_line = originalSettings.c_line
        c_oflag = originalSettings.c_oflag
        c_cflag = originalSettings.c_cflag
        c_iflag = originalSettings.c_iflag
        // ...
    }
    // ...
}
m
Could you
memcpy
maybe?
✔️ 1