Permalink
Browse files

Remove usage of unstable feature conservative_impl_trait in layout

  • Loading branch information...
SimonSapin committed Oct 12, 2017
1 parent 203a89a commit ec2c118ccee508f74fd7540b2b54f7133ad7f921
Showing with 30 additions and 5 deletions.
  1. +2 −2 components/layout/flow.rs
  2. +28 −2 components/layout/flow_list.rs
  3. +0 −1 components/layout/lib.rs
@@ -32,7 +32,7 @@ use display_list_builder::{DisplayListBuildState, StackingContextCollectionState
use euclid::{Transform3D, Point2D, Vector2D, Rect, Size2D};
use flex::FlexFlow;
use floats::{Floats, SpeculatedFloatPlacement};
use flow_list::{FlowList, MutFlowListIterator};
use flow_list::{FlowList, FlowListIterator, MutFlowListIterator};
use flow_ref::{FlowRef, WeakFlowRef};
use fragment::{CoordinateSystem, Fragment, FragmentBorderBoxIterator, Overflow};
use gfx_traits::StackingContextId;
@@ -459,7 +459,7 @@ pub fn base<T: ?Sized + Flow>(this: &T) -> &BaseFlow {
}
/// Iterates over the children of this immutable flow.
pub fn child_iter<'a>(flow: &'a Flow) -> impl Iterator<Item = &'a Flow> {
pub fn child_iter<'a>(flow: &'a Flow) -> FlowListIterator {
base(flow).children.iter()
}
@@ -7,6 +7,7 @@ use flow_ref::FlowRef;
use serde::ser::{Serialize, SerializeSeq, Serializer};
use serde_json::{Map, Value, to_value};
use std::collections::{LinkedList, linked_list};
use std::ops::Deref;
use std::sync::Arc;
/// This needs to be reworked now that we have dynamically-sized types in Rust.
@@ -53,6 +54,10 @@ pub struct MutFlowListIterator<'a> {
it: linked_list::IterMut<'a, FlowRef>,
}
pub struct FlowListIterator<'a> {
it: linked_list::Iter<'a, FlowRef>,
}
impl FlowList {
/// Add an element last in the list
///
@@ -101,8 +106,10 @@ impl FlowList {
/// SECURITY-NOTE(pcwalton): This does not hand out `FlowRef`s by design. Do not add a method
/// to do so! See the comment above in `FlowList`.
#[inline]
pub fn iter<'a>(&'a self) -> impl DoubleEndedIterator<Item = &'a Flow> {
self.flows.iter().map(|flow| &**flow)
pub fn iter<'a>(&'a self) -> FlowListIterator {
FlowListIterator {
it: self.flows.iter(),
}
}
/// Provide a forward iterator with mutable references
@@ -150,12 +157,31 @@ impl FlowList {
}
}
impl<'a> DoubleEndedIterator for FlowListIterator<'a> {
fn next_back(&mut self) -> Option<&'a Flow> {
self.it.next_back().map(Deref::deref)
}
}
impl<'a> DoubleEndedIterator for MutFlowListIterator<'a> {
fn next_back(&mut self) -> Option<&'a mut Flow> {
self.it.next_back().map(FlowRef::deref_mut)
}
}
impl<'a> Iterator for FlowListIterator<'a> {
type Item = &'a Flow;
#[inline]
fn next(&mut self) -> Option<&'a Flow> {
self.it.next().map(Deref::deref)
}
#[inline]
fn size_hint(&self) -> (usize, Option<usize>) {
self.it.size_hint()
}
}
impl<'a> Iterator for MutFlowListIterator<'a> {
type Item = &'a mut Flow;
#[inline]
View
@@ -4,7 +4,6 @@
#![deny(unsafe_code)]
#![feature(box_patterns)]
#![feature(conservative_impl_trait)]
#![feature(raw)]
extern crate app_units;

0 comments on commit ec2c118

Please sign in to comment.