Skip to content

Commit c77dbbd

Browse files
committed
Add copy feature
1 parent dc4277e commit c77dbbd

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

address/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ edition = { workspace = true }
1313
[features]
1414
atomic = ["dep:solana-atomic-u64"]
1515
borsh = ["dep:borsh", "std"]
16-
bytemuck = ["dep:bytemuck", "dep:bytemuck_derive"]
16+
bytemuck = ["copy", "dep:bytemuck", "dep:bytemuck_derive"]
17+
copy = []
1718
curve25519 = ["dep:curve25519-dalek", "error", "sha2"]
1819
decode = ["dep:five8", "dep:five8_const", "error"]
1920
dev-context-only-utils = ["dep:arbitrary", "rand"]

address/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ pub const PDA_MARKER: &[u8; 21] = b"ProgramDerivedAddress";
8484
#[cfg_attr(feature = "bytemuck", derive(Pod, Zeroable))]
8585
#[cfg_attr(feature = "dev-context-only-utils", derive(Arbitrary))]
8686
#[cfg_attr(not(feature = "decode"), derive(Debug))]
87-
#[derive(Clone, Copy, Default, Eq, Ord, PartialOrd)]
87+
#[cfg_attr(feature = "copy", derive(Copy))]
88+
#[derive(Clone, Default, Eq, Ord, PartialOrd)]
8889
pub struct Address(pub(crate) [u8; 32]);
8990

9091
#[cfg(feature = "sanitize")]
@@ -124,7 +125,7 @@ impl Hash for Address {
124125
impl From<&Address> for Address {
125126
#[inline]
126127
fn from(value: &Address) -> Self {
127-
*value
128+
Self(value.0)
128129
}
129130
}
130131

pubkey/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ std = ["solana-address/std"]
2929

3030
[dependencies]
3131
rand = { workspace = true, optional = true }
32-
solana-address = { workspace = true, features = ["atomic", "decode", "error", "sanitize", "sha2", "syscalls"] }
32+
solana-address = { workspace = true, features = ["atomic", "copy", "decode", "error", "sanitize", "sha2", "syscalls"] }
3333

3434
[lints]
3535
workspace = true

0 commit comments

Comments
 (0)