{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreicjx54xdfezw4zotbv7hx55e5z6vnoptxud4ii52sitgitfl2ixdu",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mm5ckfdupoz2"
},
"path": "/t/could-you-borrow-a-bit/24300#post_14",
"publishedAt": "2026-05-18T15:44:25.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "bascule:\n\n> A particularly fun question for bitstring reference type libraries like what I'm writing is: is how do you implement `split_at_mut`?\n\nI think it should be possible by not restricting ourselves to relying on references.\n\nAs I wrote in the other discussion, a quasi-reference type like this could work:\n\n\n struct BitSliceMut<'a> {\n origin_ptr: *mut u8,\n bit_offset: usize,\n bit_len: usize,\n _pd: PhantomData<&'a mut u8>,\n }\n\n\nBy keeping it non-`Send` it should be possible to construct a safe API for creating (e.g. with `split_at_mut`) and manipulating such type.\n\nYes, there is a number of unfortunate ergonomic issues with such custom reference types, but IMO it's the most practical option right now.",
"title": "Could you borrow a bit?"
}