Rust: Modifying the referent of a reference with a function; does this contain UB?

前端 未结 0 811
清歌不尽
清歌不尽 2020-12-14 12:31

Recently, I wrote the following:

use std::ptr;

fn modify_mut_ret (ptr: &mut T, f: F) -> R
  where F: FnOnce(T) -> (T,R)
{
   unsafe {
         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题