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
43
44
45
46
47
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files.git)
// DO NOT EDIT

use crate::DOMNode;
use crate::DOMObject;
use crate::DOMXPathResult;
use glib::object::IsA;
use glib::translate::*;
use std::fmt;
use std::ptr;

glib::wrapper! {
    #[doc(alias = "WebKitDOMXPathExpression")]
    pub struct DOMXPathExpression(Object<ffi::WebKitDOMXPathExpression, ffi::WebKitDOMXPathExpressionClass>) @extends DOMObject;

    match fn {
        type_ => || ffi::webkit_dom_xpath_expression_get_type(),
    }
}

impl DOMXPathExpression {
        pub const NONE: Option<&'static DOMXPathExpression> = None;
    
}

pub trait DOMXPathExpressionExt: 'static {
    #[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
    #[doc(alias = "webkit_dom_xpath_expression_evaluate")]
    fn evaluate(&self, contextNode: &impl IsA<DOMNode>, type_: libc::c_ushort, inResult: &impl IsA<DOMXPathResult>) -> Result<DOMXPathResult, glib::Error>;
}

impl<O: IsA<DOMXPathExpression>> DOMXPathExpressionExt for O {
    fn evaluate(&self, contextNode: &impl IsA<DOMNode>, type_: libc::c_ushort, inResult: &impl IsA<DOMXPathResult>) -> Result<DOMXPathResult, glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let ret = ffi::webkit_dom_xpath_expression_evaluate(self.as_ref().to_glib_none().0, contextNode.as_ref().to_glib_none().0, type_, inResult.as_ref().to_glib_none().0, &mut error);
            if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
        }
    }
}

impl fmt::Display for DOMXPathExpression {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str("DOMXPathExpression")
    }
}