Split out Rust BPF no-std stuff (#4968)
This commit is contained in:
3
sdk/bpf/rust/rust-test/.gitignore
vendored
Normal file
3
sdk/bpf/rust/rust-test/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
/target/
|
||||
|
||||
Cargo.lock
|
13
sdk/bpf/rust/rust-test/Cargo.toml
Normal file
13
sdk/bpf/rust/rust-test/Cargo.toml
Normal file
@ -0,0 +1,13 @@
|
||||
|
||||
[package]
|
||||
name = "solana-sdk-bpf-test"
|
||||
version = "0.17.0"
|
||||
description = "Solana BPF SDK Rust Cargo test utilities"
|
||||
authors = ["Solana Maintainers <maintainers@solana.com>"]
|
||||
repository = "https://github.com/solana-labs/solana"
|
||||
license = "Apache-2.0"
|
||||
homepage = "https://solana.com/"
|
||||
edition = "2018"
|
||||
|
||||
[workspace]
|
||||
members = []
|
13
sdk/bpf/rust/rust-test/src/lib.rs
Normal file
13
sdk/bpf/rust/rust-test/src/lib.rs
Normal file
@ -0,0 +1,13 @@
|
||||
//! @brief Solana Rust-based BPF program utility functions and types
|
||||
|
||||
#[no_mangle]
|
||||
pub unsafe fn sol_log_(message: *const u8, length: u64) {
|
||||
let slice = std::slice::from_raw_parts(message, length as usize);
|
||||
let string = std::str::from_utf8(&slice).unwrap();
|
||||
std::println!("{}", string);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn sol_log_64_(arg1: u64, arg2: u64, arg3: u64, arg4: u64, arg5: u64) {
|
||||
std::println!("{} {} {} {} {}", arg1, arg2, arg3, arg4, arg5);
|
||||
}
|
Reference in New Issue
Block a user