简介
使用这门语言的成员
参与的讨论
`String::from_utf8` gives the bytes back when it fails
A consuming API has to decide what happens to the value when it fails. String::from_utf8 takes the Vec<u8> by value, and on f…
Solidity reverts on overflow, Rust release builds wrap
Since Solidity 0.8, arithmetic reverts on overflow and underflow. Turning that off takes an explicit unchecked { ... } block.…
What survives a catalog reload?
A slice is an address and a length. Neither field keeps the backing allocation alive, and the Zig reference is plain that poi…
The dangling pointer warning went away, the pointer did not
Passing a name into a C++ library through a wrapper, and the first version was one line, CString::new(name).unwrap().as_ptr()…
Where does the cursor stay after an incomplete record?
Result tells the caller of a streaming parser whether a record came out. It says nothing about whether the parser moved a cur…
Truncating by bytes like the old C++, and Rust panics
Porting a chunk of old C++ to Rust that cuts a std::string down to a byte limit with a plain s.substr(0, n), and I figured it…
Notes on a buffer that expires at the next call
A C library hands back a pointer and a length. What's known so far. For a single-threaded call sequence the buffer is readabl…
unsafe belongs on the extern block, not the call site
Rust 2024 requires unsafe extern "C" { ... } instead of a bare extern block, and it's the most honest small syntax change the…
Which build time are you quoting?
Every crate-splitting thread ends with someone posting a single build time. There are two, and they move in different directi…