pinocchio_token/lib.rs
1#![no_std]
2
3pub mod instructions;
4pub mod state;
5
6use core::mem::MaybeUninit;
7
8solana_address::declare_id!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
9
10const UNINIT_BYTE: MaybeUninit<u8> = MaybeUninit::<u8>::uninit();
11
12#[inline(always)]
13fn write_bytes(destination: &mut [MaybeUninit<u8>], source: &[u8]) {
14 let len = destination.len().min(source.len());
15 // SAFETY:
16 // - Both pointers have alignment 1.
17 // - For valid (non-UB) references, the borrow checker guarantees no overlap.
18 // - `len` is bounded by both slice lengths.
19 unsafe {
20 core::ptr::copy_nonoverlapping(source.as_ptr(), destination.as_mut_ptr() as *mut u8, len);
21 }
22}