Remove alloc for extensions
This commit is contained in:
parent
0904b73c12
commit
94a8343be7
2 changed files with 4 additions and 4 deletions
|
@ -7,7 +7,7 @@ pub enum Version {
|
||||||
V1 = 0
|
V1 = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type CtExtensions = Vec<u8>;
|
pub type CtExtensions<'a> = &'a [u8];
|
||||||
|
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
|
@ -16,7 +16,7 @@ pub enum MerkleLeafType<'a> {
|
||||||
TimeStampedEntry {
|
TimeStampedEntry {
|
||||||
timestamp: u64,
|
timestamp: u64,
|
||||||
entry_type: LogEntryType<'a>,
|
entry_type: LogEntryType<'a>,
|
||||||
extensions: CtExtensions
|
extensions: CtExtensions<'a>
|
||||||
} = 0
|
} = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,14 +95,14 @@ pub fn parse_merkle_tree_leaf(
|
||||||
|
|
||||||
let (
|
let (
|
||||||
_, // no more to parse
|
_, // no more to parse
|
||||||
ct_extensions // opaque CtExtensions<0..2^16-1>
|
extensions // opaque CtExtensions<0..2^16-1>
|
||||||
) = nom::multi::length_data(nom::number::complete::be_u16)(input)
|
) = nom::multi::length_data(nom::number::complete::be_u16)(input)
|
||||||
.map_err(|e| e.map(|e| LeafParsingError::Nom(e)))?;
|
.map_err(|e| e.map(|e| LeafParsingError::Nom(e)))?;
|
||||||
|
|
||||||
MerkleLeafType::TimeStampedEntry {
|
MerkleLeafType::TimeStampedEntry {
|
||||||
timestamp,
|
timestamp,
|
||||||
entry_type,
|
entry_type,
|
||||||
extensions: ct_extensions.to_vec()
|
extensions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ =>
|
_ =>
|
||||||
|
|
Loading…
Reference in a new issue