method T.cast
Reinterprets the address as a pointer to U.
Example:
import c "string.h" { strdup }
import c "stdlib.h" { free }
fn main() io {
let s = "x".toCString()
unsafe {
let d = strdup(s.asPtr())
free(d.cast<u8>())
}
print("freed")
}Output
freed
pub(api) move fn cast<U>() -> *USince. 1.0.0-beta
Returns
*U
Effects
none declared (pure unless the body says otherwise)
Defined in: std/ffi/ffi.oxl:311