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,
))
}
}
}