W3cubDocs

/Rust

Function std::ptr::replace

pub unsafe fn replace<T>(dest: *mut T, src: T) -> T

Replaces the value at dest with src, returning the old value, without dropping either.

Safety

This is only unsafe because it accepts a raw pointer. Otherwise, this operation is identical to mem::replace.

© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/ptr/fn.replace.html