Skip to content

refactor: extract byte operations into dedicated crate#285

Open
sonicfromnewyoke wants to merge 1 commit intoanza-xyz:mainfrom
sonicfromnewyoke:sonic/refactor-add-bytes-crate
Open

refactor: extract byte operations into dedicated crate#285
sonicfromnewyoke wants to merge 1 commit intoanza-xyz:mainfrom
sonicfromnewyoke:sonic/refactor-add-bytes-crate

Conversation

@sonicfromnewyoke
Copy link
Contributor

Problem

there is a part of functionality that is copy/pasted across Pinocchio crates

Summary of Changes

  • crate bytes module under pinnochio main crate
  • extract
const UNINIT_BYTE: core::mem::MaybeUninit<u8> // ...

fn write_bytes(destination: &mut [core::mem::MaybeUninit<u8>], source: &[u8]) {
  // ...
}

into this module

  • import this functionality in token and token-2022 crates instead of having duplicated logic

also will be used in one more crate - #284

cc @febo

@Aursen
Copy link
Contributor

Aursen commented Nov 24, 2025

It's nice to have it right there in the Pinocchio crate

@Aursen
Copy link
Contributor

Aursen commented Dec 19, 2025

Currently, it should not be in the main crate. Rather, it should be in another crate

@sonicfromnewyoke
Copy link
Contributor Author

Currently, it should not be in the main crate. Rather, it should be in another crate

im thinking maybe it worth to get rid of those helpers at all and use core::ptr::copy_nonoverlapping

@Aursen
Copy link
Contributor

Aursen commented Dec 19, 2025

Currently, it should not be in the main crate. Rather, it should be in another crate

im thinking maybe it worth to get rid of those helpers at all and use core::ptr::copy_nonoverlapping

Yeah make sense. I don't know the opinion of @febo on it

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