Struct linux_drm::modeset::ObjectPropEnumMember

source ·
pub struct ObjectPropEnumMember { /* private fields */ }

Implementations§

source§

impl ObjectPropEnumMember

source

pub fn value(&self) -> u64

Examples found in repository?
examples/properties.rs (line 158)
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
fn property_meta<'a, 'card>(
    prop_id: u32,
    prop_meta: &'a mut HashMap<u32, PropertyMeta>,
    card: &Card,
) -> Result<&'a PropertyMeta, Error> {
    Ok(prop_meta.entry(prop_id).or_insert_with(|| {
        card.property_meta(prop_id)
            .map(|meta| {
                let mut enum_names = BTreeMap::new();
                for member in meta.enum_members().unwrap() {
                    enum_names.insert(member.value(), member.name().to_string());
                }
                PropertyMeta {
                    name: meta.name().to_string(),
                    typ: meta.property_type(),
                    immutable: meta.is_immutable(),
                    values: meta.values().unwrap(),
                    enum_names,
                }
            })
            .unwrap_or(PropertyMeta {
                name: String::from("<unknown>"),
                typ: PropertyType::Unknown,
                immutable: true,
                values: Vec::new(),
                enum_names: BTreeMap::new(),
            })
    }))
}
source

pub fn name(&self) -> &str

Examples found in repository?
examples/properties.rs (line 158)
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
fn property_meta<'a, 'card>(
    prop_id: u32,
    prop_meta: &'a mut HashMap<u32, PropertyMeta>,
    card: &Card,
) -> Result<&'a PropertyMeta, Error> {
    Ok(prop_meta.entry(prop_id).or_insert_with(|| {
        card.property_meta(prop_id)
            .map(|meta| {
                let mut enum_names = BTreeMap::new();
                for member in meta.enum_members().unwrap() {
                    enum_names.insert(member.value(), member.name().to_string());
                }
                PropertyMeta {
                    name: meta.name().to_string(),
                    typ: meta.property_type(),
                    immutable: meta.is_immutable(),
                    values: meta.values().unwrap(),
                    enum_names,
                }
            })
            .unwrap_or(PropertyMeta {
                name: String::from("<unknown>"),
                typ: PropertyType::Unknown,
                immutable: true,
                values: Vec::new(),
                enum_names: BTreeMap::new(),
            })
    }))
}

Trait Implementations§

source§

impl Debug for ObjectPropEnumMember

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.