gio/
file_attribute_info_list.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::{ffi, FileAttributeInfo, FileAttributeInfoList};
6
7impl FileAttributeInfoList {
8    #[doc(alias = "g_file_attribute_info_list_lookup")]
9    pub fn lookup(&self, name: &str) -> Option<FileAttributeInfo> {
10        unsafe {
11            let res = ffi::g_file_attribute_info_list_lookup(
12                self.to_glib_none().0,
13                name.to_glib_none().0,
14            );
15            if res.is_null() {
16                None
17            } else {
18                Some(from_glib_none(res))
19            }
20        }
21    }
22
23    pub fn attributes(&self) -> Vec<FileAttributeInfo> {
24        unsafe {
25            let ptr: *const _ = self.to_glib_none().0;
26            FromGlibContainer::from_glib_none_num((*ptr).infos, (*ptr).n_infos as usize)
27        }
28    }
29}