Enum aml::value::AmlValue [−][src]
pub enum AmlValue {
Show 14 variants
Boolean(bool),
Integer(u64),
String(String),
OpRegion {
region: RegionSpace,
offset: u64,
length: u64,
parent_device: Option<AmlName>,
},
Field {
region: AmlHandle,
flags: FieldFlags,
offset: u64,
length: u64,
},
Device,
Method {
flags: MethodFlags,
code: MethodCode,
},
Buffer(Arc<Vec<u8>>),
BufferField {
buffer_data: Arc<Vec<u8>>,
offset: u64,
length: u64,
},
Processor {
id: u8,
pblk_address: u32,
pblk_len: u8,
},
Mutex {
sync_level: u8,
},
Package(Vec<AmlValue>),
PowerResource {
system_level: u8,
resource_order: u16,
},
ThermalZone,
}
Variants
Tuple Fields of String
0: String
Describes an operation region. Some regions require other objects to be declared under their parent device
(e.g. an _ADR
object for a PciConfig
region), in which case an absolute path to the object is stored in
parent_device
.
Fields of OpRegion
Describes a field unit within an operation region.
Fields of Field
Fields of Method
flags: MethodFlags
code: MethodCode
Implementations
pub fn native_method<F>(
arg_count: u8,
serialize: bool,
sync_level: u8,
f: F
) -> AmlValue where
F: Fn(&mut AmlContext) -> Result<AmlValue, AmlError> + 'static + Send + Sync,
Converts an AmlValue
to the representation that should be used when concatenating it with other values,
primarily by the DefConcat
opcode. This will always produce a AmlValue::Integer
, AmlValue::String
, or
AmlValue::Buffer
, with other types being converted to strings containing the name of their type.
Turns an AmlValue
returned from a _STA
method into a StatusObject
. Should only be called for values
returned from _STA
. If you need a StatusObject
, but the device does not have a _STA
method, use
StatusObject::default()
.
Convert this value to a value of the same data, but with the given AML type, if possible, by converting the implicit conversions described in §19.3.5 of the spec.
The implicit conversions applied are:
Buffer
from: Integer
, String
, Debug
BufferField
from: Integer
, Buffer
, String
, Debug
DdbHandle
from: Integer
, Debug
FieldUnit
from: Integer
,Buffer
, String
, Debug
Integer
from: Buffer
, BufferField
, DdbHandle
, FieldUnit
, String
, Debug
Package
from: Debug
String
from: Integer
, Buffer
, Debug
Reads from a field of an opregion, returning either a AmlValue::Integer
or an AmlValue::Buffer
,
depending on the size of the field.
pub fn write_field(
&mut self,
value: AmlValue,
context: &mut AmlContext
) -> Result<(), AmlError>
Logically compare two AmlValue
s, according to the rules that govern opcodes like DefLEqual
, DefLLess
,
etc. The type of self
dictates the type that other
will be converted to, and the method by which the
values will be compared:
Integer
s are simply compared by numeric comparisonString
s andBuffer
s are compared lexicographically -other
is compared byte-wise until a byte is discovered that is either less or greater than the corresponding byte ofself
. If the bytes are identical, the lengths are compared. Luckily, the Rust standard library implements lexicographic comparison of strings and[u8]
for us already.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for AmlValue
impl !UnwindSafe for AmlValue
Blanket Implementations
Mutably borrows from an owned value. Read more