libobs_wrapper\data\properties\types/
path.rs

1use getters0::Getters;
2
3use crate::data::properties::{get_enum, get_opt_str, macros::assert_type, ObsPathType};
4
5use super::PropertyCreationInfo;
6
7#[derive(Debug, Getters, Clone)]
8#[skip_new]
9pub struct ObsPathProperty {
10    name: String,
11    description: Option<String>,
12    path_type: ObsPathType,
13    filter: String,
14    default_path: String,
15}
16
17impl From<PropertyCreationInfo> for ObsPathProperty {
18    fn from(
19        PropertyCreationInfo {
20            name,
21            description,
22            pointer,
23        }: PropertyCreationInfo,
24    ) -> Self {
25        assert_type!(Path, pointer);
26
27        let path_type = get_enum!(pointer, path_type, ObsPathType);
28        let filter = get_opt_str!(pointer, path_filter).unwrap_or_default();
29        let default_path = get_opt_str!(pointer, path_default_path).unwrap_or_default();
30        Self {
31            name,
32            description,
33            path_type,
34            filter,
35            default_path,
36        }
37    }
38}