Skip to content
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
84 changes: 58 additions & 26 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions discriminator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ edition = "2021"
borsh = ["dep:borsh"]

[dependencies]
borsh = { version = "1", optional = true, features = ["derive"] }
borsh = { version = "1", optional = true, default-features = false, features = ["derive"] }
bytemuck = { version = "1.23.2", features = ["derive"] }
solana-program-error = "3.0.0"
solana-sha256-hasher = { version = "3.0.0", features = ["sha2"] }
solana-sha256-hasher = { version = "3.1.0", features = ["sha2"] }
spl-discriminator-derive = { version = "0.2.0", path = "../discriminator-derive" }

[dev-dependencies]
Expand Down
7 changes: 4 additions & 3 deletions discriminator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
//! meant to be unique for instructions or struct types

#![deny(missing_docs)]
#![no_std]
#![cfg_attr(not(test), forbid(unsafe_code))]

extern crate self as spl_discriminator;
Expand All @@ -22,8 +23,8 @@ mod tests {
#[allow(dead_code)]
#[derive(SplDiscriminate)]
#[discriminator_hash_input("my_first_instruction")]
pub struct MyInstruction1 {
arg1: String,
pub struct MyInstruction1<'a> {
arg1: &'a str,
arg2: u8,
}

Expand Down Expand Up @@ -112,7 +113,7 @@ mod tests {
build_discriminator("my_runtime_hash_input"),
);

assert_discriminator::<MyInstruction1>("my_first_instruction");
assert_discriminator::<MyInstruction1<'_>>("my_first_instruction");
assert_discriminator::<MyInstruction2>("global:my_second_instruction");
assert_discriminator::<MyInstruction3<'_>>("global:my_instruction_with_lifetime");
assert_discriminator::<MyInstruction4<u8>>("global:my_instruction_with_one_generic");
Expand Down
Loading