revm_bytecode/legacy/
raw.rs1use super::LegacyAnalyzedBytecode;
2use core::ops::Deref;
3use primitives::Bytes;
4use std::sync::Arc;
5
6#[derive(Clone, Debug, PartialEq, Eq, Hash, Ord, PartialOrd)]
10#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
11pub struct LegacyRawBytecode(pub Bytes);
12
13impl LegacyRawBytecode {
14 pub fn into_analyzed(self) -> LegacyAnalyzedBytecode {
16 LegacyAnalyzedBytecode::analyze(self.0)
17 }
18
19 pub fn into_analyzed_arc(self) -> Arc<LegacyAnalyzedBytecode> {
21 Arc::new(self.into_analyzed())
22 }
23}
24
25impl From<Bytes> for LegacyRawBytecode {
26 fn from(bytes: Bytes) -> Self {
27 Self(bytes)
28 }
29}
30
31impl<const N: usize> From<[u8; N]> for LegacyRawBytecode {
32 fn from(bytes: [u8; N]) -> Self {
33 Self(bytes.into())
34 }
35}
36
37impl Deref for LegacyRawBytecode {
38 type Target = Bytes;
39
40 fn deref(&self) -> &Self::Target {
41 &self.0
42 }
43}