Skip to content

Commit 4617cc6

Browse files
committed
port log_writer fns to safe-io
1 parent 0d468c1 commit 4617cc6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

glib/src/log.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Take a look at the license at the top of the repository in the LICENSE file.
22

33
#[cfg(unix)]
4-
use std::os::unix::io::AsRawFd;
4+
use std::os::unix::io::{AsFd, AsRawFd};
55
use std::{
66
boxed::Box as Box_,
77
sync::{Arc, Mutex, OnceLock},
@@ -972,16 +972,20 @@ pub fn log_variant(log_domain: Option<&str>, log_level: LogLevel, fields: &crate
972972
#[cfg_attr(docsrs, doc(cfg(unix)))]
973973
#[doc(alias = "g_log_writer_supports_color")]
974974
#[inline]
975-
pub fn log_writer_supports_color<T: AsRawFd>(output_fd: T) -> bool {
976-
unsafe { from_glib(ffi::g_log_writer_supports_color(output_fd.as_raw_fd())) }
975+
pub fn log_writer_supports_color(output_fd: impl AsFd) -> bool {
976+
unsafe {
977+
from_glib(ffi::g_log_writer_supports_color(
978+
output_fd.as_fd().as_raw_fd(),
979+
))
980+
}
977981
}
978982

979983
#[cfg(unix)]
980984
#[cfg_attr(docsrs, doc(cfg(unix)))]
981985
#[doc(alias = "g_log_writer_is_journald")]
982986
#[inline]
983-
pub fn log_writer_is_journald<T: AsRawFd>(output_fd: T) -> bool {
984-
unsafe { from_glib(ffi::g_log_writer_is_journald(output_fd.as_raw_fd())) }
987+
pub fn log_writer_is_journald(output_fd: impl AsFd) -> bool {
988+
unsafe { from_glib(ffi::g_log_writer_is_journald(output_fd.as_fd().as_raw_fd())) }
985989
}
986990

987991
#[doc(alias = "g_log_writer_format_fields")]

0 commit comments

Comments
 (0)