Replace NonZeroU32 and NonZeroUsize with a generic NonZero

The API is identical to core::nonzero::NonZero
This commit is contained in:
Simon Sapin 2017-10-14 12:27:26 +02:00
parent 4ee1b26b6c
commit 9e4865b6c8
7 changed files with 115 additions and 67 deletions

View file

@ -13,7 +13,7 @@ use image::{DynamicImage, ImageFormat, RgbImage};
use ipc_channel::ipc::{self, IpcSharedMemory};
use msg::constellation_msg::{PipelineId, PipelineIndex, PipelineNamespaceId};
use net_traits::image::base::{Image, PixelFormat};
use nonzero::NonZeroU32;
use nonzero::NonZero;
use profile_traits::time::{self, ProfilerCategory, profile};
use script_traits::{AnimationState, AnimationTickType, ConstellationControlMsg};
use script_traits::{ConstellationMsg, LayoutControlMsg, MouseButton};
@ -62,7 +62,7 @@ impl ConvertPipelineIdFromWebRender for webrender_api::PipelineId {
fn from_webrender(&self) -> PipelineId {
PipelineId {
namespace_id: PipelineNamespaceId(self.0),
index: PipelineIndex(NonZeroU32::new(self.1).expect("Webrender pipeline zero?")),
index: PipelineIndex(NonZero::new(self.1).expect("Webrender pipeline zero?")),
}
}
}