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
48
49
50
51
52
53
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from webkit-gir-files
// DO NOT EDIT

use crate::ffi;
use glib::translate::*;

glib::wrapper! {
    /// Handles serialization of a web view's browsing state.
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct WebViewSessionState(Shared<ffi::WebKitWebViewSessionState>);

    match fn {
        ref => |ptr| ffi::webkit_web_view_session_state_ref(ptr),
        unref => |ptr| ffi::webkit_web_view_session_state_unref(ptr),
        type_ => || ffi::webkit_web_view_session_state_get_type(),
    }
}

impl WebViewSessionState {
    /// Creates a new #WebKitWebViewSessionState from serialized data.
    /// ## `data`
    /// a #GBytes
    ///
    /// # Returns
    ///
    /// a new #WebKitWebViewSessionState, or [`None`] if @data doesn't contain a
    ///     valid serialized #WebKitWebViewSessionState.
    #[doc(alias = "webkit_web_view_session_state_new")]
    pub fn new(data: &glib::Bytes) -> WebViewSessionState {
        assert_initialized_main_thread!();
        unsafe {
            from_glib_full(ffi::webkit_web_view_session_state_new(
                data.to_glib_none().0,
            ))
        }
    }

    /// Serializes a #WebKitWebViewSessionState.
    ///
    /// # Returns
    ///
    /// a #GBytes containing the @self serialized.
    #[doc(alias = "webkit_web_view_session_state_serialize")]
    pub fn serialize(&self) -> Option<glib::Bytes> {
        unsafe {
            from_glib_full(ffi::webkit_web_view_session_state_serialize(
                self.to_glib_none().0,
            ))
        }
    }
}