From 0389c834e4b456ad6dcce4f687c69ab0e84beafa Mon Sep 17 00:00:00 2001 From: mitchmindtree Date: Sun, 22 Feb 2015 00:40:23 +1100 Subject: RingBuf -> VecDeque for other platforms, as_slice_with_nul -> as_bytes_with_nul --- src/x11/window/mod.rs | 8 ++++---- src/x11/window/monitor.rs | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/x11/window') diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs index faeea3e..0c6da4e 100644 --- a/src/x11/window/mod.rs +++ b/src/x11/window/mod.rs @@ -5,7 +5,7 @@ use libc; use std::{mem, ptr}; use std::cell::Cell; use std::sync::atomic::AtomicBool; -use std::collections::RingBuf; +use std::collections::VecDeque; use super::ffi; use std::sync::{Arc, Mutex, Once, ONCE_INIT, Weak}; use std::sync::{StaticMutex, MUTEX_INIT}; @@ -39,7 +39,7 @@ fn ensure_thread_init() { fn with_c_str(s: &str, f: F) -> T where F: FnOnce(*const libc::c_char) -> T { use std::ffi::CString; let c_str = CString::from_slice(s.as_bytes()); - f(c_str.as_slice_with_nul().as_ptr()) + f(c_str.as_bytes_with_nul().as_ptr()) } struct XWindow { @@ -281,7 +281,7 @@ pub struct Window { wm_delete_window: ffi::Atom, current_size: Cell<(libc::c_int, libc::c_int)>, /// Events that have been retreived with XLib but not dispatched with iterators yet - pending_events: Mutex>, + pending_events: Mutex>, } impl Window { @@ -600,7 +600,7 @@ impl Window { is_closed: AtomicBool::new(false), wm_delete_window: wm_delete_window, current_size: Cell::new((0, 0)), - pending_events: Mutex::new(RingBuf::new()), + pending_events: Mutex::new(VecDeque::new()), }; // returning diff --git a/src/x11/window/monitor.rs b/src/x11/window/monitor.rs index 3c188b6..77ac4ec 100644 --- a/src/x11/window/monitor.rs +++ b/src/x11/window/monitor.rs @@ -1,11 +1,11 @@ use std::ptr; -use std::collections::RingBuf; +use std::collections::VecDeque; use super::super::ffi; use super::ensure_thread_init; pub struct MonitorID(pub u32); -pub fn get_available_monitors() -> RingBuf { +pub fn get_available_monitors() -> VecDeque { ensure_thread_init(); let nb_monitors = unsafe { let display = ffi::XOpenDisplay(ptr::null()); @@ -17,7 +17,7 @@ pub fn get_available_monitors() -> RingBuf { nb_monitors }; - let mut monitors = RingBuf::new(); + let mut monitors = VecDeque::new(); monitors.extend(range(0, nb_monitors).map(|i| MonitorID(i as u32))); monitors } -- cgit v1.2.3