mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-23 11:52:21 +00:00
acpi_tables: aml: Add Aml trait implementation for vector appending
As an optimisation to avoid allocating byte vectors add a trait method that will append to an existing vector. Further to support the transition add a default implementation of Aml::to_aml_bytes() that uses the newly added Aml::append_aml_bytes() Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
parent
d0c3342c97
commit
211ee1521d
@ -6,7 +6,15 @@
|
|||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
|
|
||||||
pub trait Aml {
|
pub trait Aml {
|
||||||
fn to_aml_bytes(&self) -> Vec<u8>;
|
fn append_aml_bytes(&self, _v: &mut Vec<u8>) {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn to_aml_bytes(&self) -> Vec<u8> {
|
||||||
|
let mut v = Vec::new();
|
||||||
|
self.append_aml_bytes(&mut v);
|
||||||
|
v
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub const ZERO: Zero = Zero {};
|
pub const ZERO: Zero = Zero {};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user