1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-03 10:14:06 +02:00
This commit is contained in:
Robin Appelman 2022-04-18 23:41:57 +02:00
commit e7dec55453
4 changed files with 2934 additions and 2984 deletions

File diff suppressed because it is too large Load diff

View file

@ -162,6 +162,13 @@ impl<'a> ExtraData<'a> {
let byte_len = (data.bit_len() / 8) as u16;
ExtraData { byte_len, data }
}
pub fn to_owned(&self) -> ExtraData<'static> {
ExtraData {
byte_len: self.byte_len,
data: self.data.to_owned(),
}
}
}
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
@ -179,6 +186,13 @@ impl StringTableEntry<'_> {
.map(|text| text.borrow())
.unwrap_or_default()
}
pub fn to_owned(&self) -> StringTableEntry<'static> {
StringTableEntry {
text: self.text.as_deref().map(|text| Cow::Owned(text.into())),
extra_data: self.extra_data.as_ref().map(|data| data.to_owned()),
}
}
}
impl<'a> BitRead<'a, LittleEndian> for StringTableEntry<'a> {