mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-03 18:24:05 +02:00
schema
This commit is contained in:
parent
00610a9a95
commit
e7dec55453
4 changed files with 2934 additions and 2984 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -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> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue