Enum aml::value::AmlValue[][src]

pub enum AmlValue {
    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,
    },
    Method {
        flags: MethodFlags,
        code: MethodCode,
    },
    Buffer(Vec<u8>),
    Processor {
        id: u8,
        pblk_address: u32,
        pblk_len: u8,
    },
    Mutex {
        sync_level: u8,
    },
    Package(Vec<AmlValue>),
}

Variants

Boolean(bool)
Integer(u64)
String(String)
OpRegion

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.

Show fields

Fields of OpRegion

region: RegionSpaceoffset: u64length: u64parent_device: Option<AmlName>
Field

Describes a field unit within an operation region.

Show fields

Fields of Field

region: AmlHandleflags: FieldFlagsoffset: u64length: u64
Method
Show fields

Fields of Method

flags: MethodFlagscode: MethodCode
Buffer(Vec<u8>)
Processor
Show fields

Fields of Processor

id: u8pblk_address: u32pblk_len: u8
Mutex
Show fields

Fields of Mutex

sync_level: u8
Package(Vec<AmlValue>)

Implementations

impl AmlValue[src]

pub fn zero() -> AmlValue[src]

pub fn one() -> AmlValue[src]

pub fn ones() -> AmlValue[src]

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
[src]

pub fn type_of(&self) -> AmlType[src]

pub fn as_bool(&self) -> Result<bool, AmlError>[src]

pub fn as_integer(&self, context: &AmlContext) -> Result<u64, AmlError>[src]

pub fn as_buffer(&self, context: &AmlContext) -> Result<Vec<u8>, AmlError>[src]

pub fn as_string(&self, context: &AmlContext) -> Result<String, AmlError>[src]

pub fn as_status(&self) -> Result<StatusObject, AmlError>[src]

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().

pub fn as_type(
    &self,
    desired_type: AmlType,
    context: &AmlContext
) -> Result<AmlValue, AmlError>
[src]

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

pub fn read_field(&self, context: &AmlContext) -> Result<AmlValue, AmlError>[src]

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>
[src]

pub fn cmp(
    &self,
    other: AmlValue,
    context: &mut AmlContext
) -> Result<Ordering, AmlError>
[src]

Logically compare two AmlValues, 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:

  • Integers are simply compared by numeric comparison
  • Strings and Buffers are compared lexicographically - other is compared byte-wise until a byte is discovered that is either less or greater than the corresponding byte of self. 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

impl Clone for AmlValue[src]

fn clone(&self) -> AmlValue[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for AmlValue[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for AmlValue

impl Sync for AmlValue

impl Unpin for AmlValue

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.