How can old school multi-threading (no wrapping mutex) can be achieve in Rust? And why is it undefined behavior? I have to build a highly concurrent ...
How can old school multi-threading (no wrapping mutex) can be achieve in Rust? And why is it undefined behavior? I have to build a highly concurrent ...
I have a program that uses a QuadTree. This tree stores mutable borrows to data that is owned by another container (a Vec). I rebuild the QuadTree eve ...
I have a native C++ DLL that takes lots of pointers to arrays as its parameters, along with integers to indicate the sizes of those arrays. I'm callin ...
I want to pass a uintptr to unsafe.Pointer but govet is telling me possible misuse of unsafe.Pointer. I can't figure out how to satisfy govet. If i ...
let receiver: Receiver = ...; let mut buf = [0; 1024]; // allocate a buf that is definitely too big let bytes_received = reciever.recv(&mut buf); ...
The following code creates boxes, each pointing to a block of 4096 bytes. If I run this on release, everything is optimised away :(, but on debug, thi ...
I'm using the object from a crate, which was not written by me and i have a struct which i would like to use as a global variable, but i get this erro ...
I'm writing some C FFI bindings, and I came up with a situation which I'm unsure whether it works or not. In its simplest form, it would be: unsafe f ...
I have a c# program that converts/re-interpret unmanaged type to ulong on x64 machine: Usage: However, I'm not sure if this is 100% safe. Namely ...
I am making a chess game and I'm looking to return a mutable null character from an array of pieces when the index of the array (a Vec2 is out of boun ...
I'm currently sitting on a copy function that fills a destination byte array from a source byte array and replicates the source array as many times as ...
I'd like to transmute a MaybeUninit<T> to a T. use std::mem::transmute; use std::mem::MaybeUninit; fn make_init<T: Sized>(mt: MaybeUnini ...
I am looking for fast way to process arrays of PointF type. Casting them with the following code gives a span, so i can use fma, avx and sse intrinsic ...
I want to use std::mem::transmute and std::mem::size_of using a generic parameter. But Rust gives me the following error: here is a simplified ver ...
I'm currently building an Android app that basically looks like the old Windows95 Maze Screensaver. I'm using C# with Xamarin and MonoGame. Introducti ...
I'm looking for information and good practices for using MaybeUninit to directly initialize collections (typically arrays or vectors) and drop them ...
I was looking at the rust String standard library, and there was so much unsafe code like this one: #[inline] #[stable(feature = "rust1", sin ...
Is it safe to transmute a shared reference & to a strong Arc<T> into a shared reference & to a Weak<T>? To ask another way: is th ...
Given a piece of unsafe code (bindings to a system library) of type: I am wrapping it with a function: Calling wrapper() with a static array buf ...
The sun Unsafe class has methods that manipulate memory, my question can these methods allow performing process hollowing which attaches/copies code t ...