let write_to_native_string c ~buf ~index = try buf.[index] <- c; return 1 with _ -> fail `out_of_bounds