mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Move util::linked_list to layout
This commit is contained in:
parent
7b2080c5b7
commit
3041084176
5 changed files with 4 additions and 5 deletions
|
@ -39,7 +39,6 @@ pub mod cache;
|
|||
#[allow(unsafe_code)] pub mod debug_utils;
|
||||
pub mod geometry;
|
||||
#[cfg(feature = "servo")] #[allow(unsafe_code)] pub mod ipc;
|
||||
#[cfg(feature = "servo")] pub mod linked_list;
|
||||
#[allow(unsafe_code)] pub mod opts;
|
||||
#[cfg(feature = "servo")] pub mod panicking;
|
||||
pub mod prefs;
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
//! Utility functions for doubly-linked lists.
|
||||
|
||||
use std::collections::LinkedList;
|
||||
use std::mem;
|
||||
|
||||
/// Splits the head off a list in O(1) time, and returns the head.
|
||||
pub fn split_off_head<T>(list: &mut LinkedList<T>) -> LinkedList<T> {
|
||||
let tail = list.split_off(1);
|
||||
mem::replace(list, tail)
|
||||
}
|
||||
|
||||
/// Prepends the items in the other list to this one, leaving the other list empty.
|
||||
#[inline]
|
||||
pub fn prepend_from<T>(this: &mut LinkedList<T>, other: &mut LinkedList<T>) {
|
||||
other.append(this);
|
||||
mem::swap(this, other);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue