Skip to content

BytesCursor abstraction in FuseDevWriter#221

Open
stepancheg wants to merge 2 commits intocloud-hypervisor:masterfrom
stepancheg:bytes-cursor
Open

BytesCursor abstraction in FuseDevWriter#221
stepancheg wants to merge 2 commits intocloud-hypervisor:masterfrom
stepancheg:bytes-cursor

Conversation

@stepancheg
Copy link

FuseDevWriter.buf field is ManuallyDrop<Vec<u8>>, but actually it is a pair of &mut [u8] space and position.

Express this logic more explicitly with

pub(crate) struct BytesCursor<'a> {
    slice: &'a mut [u8],
    position: usize,
}

Because:

  • less unsafe code
  • more operations are checked
  • with this change it is clear that there's no UB (for example, related to aliasing &mut pointers). It may be not an issue, but with this change is much more clear

@bergwolf
Copy link
Contributor

somehow CI is not running. Let me close and reopen to trigger it.

@bergwolf bergwolf closed this Feb 25, 2026
@bergwolf bergwolf reopened this Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants