Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract program-option crate #2369

Merged
merged 6 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ members = [
"sdk/package-metadata-macro",
"sdk/program",
"sdk/program-memory",
"sdk/program-option",
"sdk/serde-varint",
"sdk/sha256-hasher",
"send-transaction-service",
Expand Down Expand Up @@ -415,6 +416,7 @@ solana-poh = { path = "poh", version = "=2.1.0" }
solana-poseidon = { path = "poseidon", version = "=2.1.0" }
solana-program = { path = "sdk/program", version = "=2.1.0", default-features = false }
solana-program-memory = { path = "sdk/program-memory", version = "=2.1.0" }
solana-program-option = { path = "sdk/program-option", version = "=2.1.0" }
solana-program-runtime = { path = "program-runtime", version = "=2.1.0" }
solana-program-test = { path = "program-test", version = "=2.1.0" }
solana-pubsub-client = { path = "pubsub-client", version = "=2.1.0" }
Expand Down
2 changes: 1 addition & 1 deletion ci/nits.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ declare print_free_tree=(
':sdk/**.rs'
':^sdk/cargo-build-sbf/**.rs'
':^sdk/msg/src/lib.rs'
':^sdk/program/src/program_option.rs'
':^sdk/program-option/src/lib.rs'
':^sdk/program/src/program_stubs.rs'
':programs/**.rs'
':^**bin**.rs'
Expand Down
5 changes: 5 additions & 0 deletions programs/sbf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions sdk/program-option/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "solana-program-option"
description = "A C representation of Rust's Option, used in Solana programs."
documentation = "https://docs.rs/solana-program-option"
version = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ impl<T> COption<T> {
/// ```
///
/// ```should_panic
/// # use solana_program::program_option::COption;
/// # use solana_program_option::COption;
/// let x: COption<&str> = COption::None;
/// x.expect("the world is ending"); // panics with `the world is ending`
/// ```
Expand Down Expand Up @@ -205,7 +205,7 @@ impl<T> COption<T> {
/// ```
///
/// ```should_panic
/// # use solana_program::program_option::COption;
/// # use solana_program_option::COption;
/// let x: COption<&str> = COption::None;
/// assert_eq!(x.unwrap(), "air"); // fails
/// ```
Expand Down
1 change: 1 addition & 0 deletions sdk/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ solana-hash = { workspace = true, features = [
] }
solana-msg = { workspace = true }
solana-program-memory = { workspace = true }
solana-program-option = { workspace = true }
solana-sanitize = { workspace = true }
solana-sdk-macro = { workspace = true }
solana-secp256k1-recover = { workspace = true }
Expand Down
3 changes: 1 addition & 2 deletions sdk/program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,6 @@ pub mod native_token;
pub mod nonce;
pub mod program;
pub mod program_error;
pub mod program_option;
pub mod program_pack;
pub mod program_stubs;
pub mod program_utils;
Expand Down Expand Up @@ -540,7 +539,7 @@ pub use solana_serde_varint as serde_varint;
pub use solana_short_vec as short_vec;
#[cfg(target_arch = "wasm32")]
pub use wasm_bindgen::prelude::wasm_bindgen;
pub use {solana_clock as clock, solana_msg::msg};
pub use {solana_clock as clock, solana_msg::msg, solana_program_option as program_option};

/// The [config native program][np].
///
Expand Down