Skip to content

Commit

Permalink
extract program-pack crate
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey committed Sep 17, 2024
1 parent c4b42ab commit 9055432
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 4 deletions.
8 changes: 8 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 @@ -118,6 +118,7 @@ members = [
"sdk/program-error",
"sdk/program-memory",
"sdk/program-option",
"sdk/program-pack",
"sdk/pubkey",
"sdk/serde-varint",
"sdk/sha256-hasher",
Expand Down Expand Up @@ -427,6 +428,7 @@ solana-program = { path = "sdk/program", version = "=2.1.0", default-features =
solana-program-error = { path = "sdk/program-error", version = "=2.1.0" }
solana-program-memory = { path = "sdk/program-memory", version = "=2.1.0" }
solana-program-option = { path = "sdk/program-option", version = "=2.1.0" }
solana-program-pack = { path = "sdk/program-pack", 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-pubkey = { path = "sdk/pubkey", version = "=2.1.0", default-features = false }
Expand Down
8 changes: 8 additions & 0 deletions programs/sbf/Cargo.lock

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

16 changes: 16 additions & 0 deletions sdk/program-pack/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[package]
name = "solana-program-pack"
description = "Solana The Pack serialization trait."
documentation = "https://docs.rs/solana-program-pack"
version = { workspace = true }
authors = { workspace = true }
repository = { workspace = true }
homepage = { workspace = true }
license = { workspace = true }
edition = { workspace = true }

[dependencies]
solana-program-error = { workspace = true }

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
11 changes: 9 additions & 2 deletions sdk/program/src/program_pack.rs → sdk/program-pack/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
//! The [`Pack`] serialization trait.
//! The [`Pack`] serialization trait
//! This is a Solana-specific serialization API that is used by many
//! older programs in the [Solana Program Library][spl] to define their
//! account format. It is difficult to implement and does not define a
//! language-independent serialization format. It is not generally recommended
//! for new code.
//!
//! [spl]: https://github.com/solana-labs/solana-program-library
use crate::program_error::ProgramError;
use solana_program_error::ProgramError;

/// Check if a program account state is initialized
pub trait IsInitialized {
Expand Down
1 change: 1 addition & 0 deletions sdk/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ solana-msg = { workspace = true }
solana-program-error = { workspace = true, features = ["serde"] }
solana-program-memory = { workspace = true }
solana-program-option = { workspace = true }
solana-program-pack = { workspace = true }
solana-pubkey = { workspace = true, features = ["bytemuck", "curve25519", "serde", "std"] }
solana-sanitize = { workspace = true }
solana-sdk-macro = { workspace = true }
Expand Down
5 changes: 3 additions & 2 deletions sdk/program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
//! language-independent serialization format. It is not generally recommended
//! for new code.
//!
//! [`Pack`]: program_pack::Pack
//! [`Pack`]: https://docs.rs/solana-program-pack/latest/trait.Pack.html
//!
//! Developers should carefully consider the CPU cost of serialization, balanced
//! against the need for correctness and ease of use: off-the-shelf
Expand Down Expand Up @@ -508,7 +508,6 @@ pub mod native_token;
pub mod nonce;
pub mod program;
pub mod program_error;
pub mod program_pack;
pub mod program_stubs;
pub mod program_utils;
pub mod rent;
Expand All @@ -528,6 +527,8 @@ pub mod wasm;

#[deprecated(since = "2.1.0", note = "Use `solana-program-memory` crate instead")]
pub use solana_program_memory as program_memory;
#[deprecated(since = "2.1.0", note = "Use `solana-program-pack` crate instead")]
pub use solana_program_pack as program_pack;
#[deprecated(since = "2.1.0", note = "Use `solana-sanitize` crate instead")]
pub use solana_sanitize as sanitize;
#[deprecated(since = "2.1.0", note = "Use `solana-secp256k1-recover` crate instead")]
Expand Down

0 comments on commit 9055432

Please sign in to comment.