Skip to content

Commit 8e23f5a

Browse files
committed
primitives - ChannelId impl Deref
1 parent b16b797 commit 8e23f5a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

primitives/src/channel.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,20 @@ use crate::big_num::BigNum;
1010
use crate::util::serde::ts_milliseconds_option;
1111
use crate::{AdUnit, EventSubmission, TargetingTag, ValidatorDesc, ValidatorId};
1212
use hex::{FromHex, FromHexError};
13+
use std::ops::Deref;
1314

1415
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Copy, Clone)]
1516
#[serde(transparent)]
1617
pub struct ChannelId(#[serde(with = "SerHex::<StrictPfx>")] [u8; 32]);
1718

19+
impl Deref for ChannelId {
20+
type Target = [u8];
21+
22+
fn deref(&self) -> &[u8] {
23+
&self.0
24+
}
25+
}
26+
1827
impl From<[u8; 32]> for ChannelId {
1928
fn from(array: [u8; 32]) -> Self {
2029
Self(array)

0 commit comments

Comments
 (0)