1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

use glib::translate::*;

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct PatternSpec(Shared<ffi::DzlPatternSpec>);

    match fn {
        ref => |ptr| ffi::dzl_pattern_spec_ref(ptr),
        unref => |ptr| ffi::dzl_pattern_spec_unref(ptr),
        type_ => || ffi::dzl_pattern_spec_get_type(),
    }
}

impl PatternSpec {
    #[doc(alias = "dzl_pattern_spec_new")]
    pub fn new(keywords: &str) -> PatternSpec {
        assert_initialized_main_thread!();
        unsafe { from_glib_full(ffi::dzl_pattern_spec_new(keywords.to_glib_none().0)) }
    }

    #[doc(alias = "dzl_pattern_spec_get_text")]
    #[doc(alias = "get_text")]
    pub fn text(&self) -> Option<glib::GString> {
        unsafe { from_glib_none(ffi::dzl_pattern_spec_get_text(self.to_glib_none().0)) }
    }

    #[doc(alias = "dzl_pattern_spec_match")]
    #[doc(alias = "match")]
    pub fn match_(&self, haystack: &str) -> bool {
        unsafe {
            from_glib(ffi::dzl_pattern_spec_match(
                self.to_glib_none().0,
                haystack.to_glib_none().0,
            ))
        }
    }
}