Use NonZeroU32 in canvas_traits

This commit is contained in:
Simon Sapin 2017-10-12 00:49:39 +02:00
parent ecf3b05153
commit 5e72173e8c
6 changed files with 16 additions and 5 deletions

View file

@ -2,8 +2,8 @@
* 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/. */
use core::nonzero::NonZero;
use euclid::Size2D;
use nonzero::NonZeroU32;
use offscreen_gl_context::{GLContextAttributes, GLLimits};
use std::fmt;
use webrender_api;
@ -242,13 +242,13 @@ pub enum WebGLCommand {
macro_rules! define_resource_id_struct {
($name:ident) => {
#[derive(Clone, Copy, Eq, Hash, PartialEq)]
pub struct $name(NonZero<u32>);
pub struct $name(NonZeroU32);
impl $name {
#[allow(unsafe_code)]
#[inline]
pub unsafe fn new(id: u32) -> Self {
$name(NonZero::new_unchecked(id))
$name(NonZeroU32::new_unchecked(id))
}
#[inline]