gtk/
selection_data.rs

1// Copyright 2013-2019, The Gtk-rs Project Developers.
2// See the COPYRIGHT file at the top-level directory of this distribution.
3// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
4
5use glib::translate::*;
6use gtk_sys;
7use std::mem;
8use SelectionData;
9
10impl SelectionData {
11    pub fn get_data(&self) -> Vec<u8> {
12        unsafe {
13            let mut length = mem::uninitialized();
14            let ret = FromGlibContainer::from_glib_none_num(
15                gtk_sys::gtk_selection_data_get_data_with_length(
16                    self.to_glib_none().0,
17                    &mut length,
18                ),
19                length as usize,
20            );
21            ret
22        }
23    }
24}