forked from gtk-rs/gtk3-rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gio: manually generate get_channel_binding_data
- Loading branch information
1 parent
fddbeed
commit ad71d74
Showing
5 changed files
with
52 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
Generated by gir (https://github.com/gtk-rs/gir @ ad40c01) | ||
from gir-files (https://github.com/gtk-rs/gir-files @ 4ad8962) | ||
from gir-files (https://github.com/gtk-rs/gir-files @ 8a626fd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#[cfg(any(feature = "v2_66", feature = "dox"))] | ||
use auto::TlsChannelBindingType; | ||
use auto::TlsConnection; | ||
#[cfg(any(feature = "v2_66", feature = "dox"))] | ||
use glib::translate::*; | ||
use glib::IsA; | ||
#[cfg(any(feature = "v2_66", feature = "dox"))] | ||
use std::ptr; | ||
|
||
pub trait TlsConnectionManualExt { | ||
#[cfg(any(feature = "v2_66", feature = "dox"))] | ||
fn get_channel_binding_data( | ||
&self, | ||
type_: TlsChannelBindingType, | ||
) -> Result<glib::ByteArray, glib::Error>; | ||
} | ||
|
||
impl<O: IsA<TlsConnection>> TlsConnectionManualExt for O { | ||
#[cfg(any(feature = "v2_66", feature = "dox"))] | ||
fn get_channel_binding_data( | ||
&self, | ||
type_: TlsChannelBindingType, | ||
) -> Result<glib::ByteArray, glib::Error> { | ||
unsafe { | ||
let data = ptr::null_mut(); | ||
let mut error = ptr::null_mut(); | ||
let _ = gio_sys::g_tls_connection_get_channel_binding_data( | ||
self.to_glib_none().0, | ||
type_.to_glib(), | ||
data, | ||
&mut error, | ||
); | ||
if error.is_null() { | ||
Ok(from_glib_none(data)) | ||
} else { | ||
Err(from_glib_full(error)) | ||
} | ||
} | ||
} | ||
} |