Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- impl Rgba {
- # [ doc = r" All components as an array" ] pub fn as_array ( & self ) -> & [
- f32 ; 4usize ] { unsafe { std :: mem :: transmute ( self ) } } # [
- doc = r" All components as an array" ] pub fn as_array_mut ( & mut self ) -> &
- mut [ f32 ; 4usize ] { unsafe { std :: mem :: transmute ( self ) } } # [
- doc = r" All components as an array" ] pub fn into_array ( self ) -> [
- f32 ; 4usize ] { unsafe { std :: mem :: transmute ( self ) } } fn fill (
- value : f32 ) -> Self { Self { r : value , g : value , b : value , a : value }
- } } impl num_traits :: Zero for Rgba {
- fn zero ( ) -> Self { Self :: fill ( 0.0 ) } fn is_zero ( & self ) -> bool {
- * self == Self :: zero ( ) } } impl num_traits :: One for Rgba {
- fn one ( ) -> Self { Self :: fill ( 1.0 ) } fn is_one ( & self ) -> bool {
- * self == Self :: one ( ) } } impl Color for Rgba {
- fn black ( ) -> Self {
- let c = Self :: fill ( 0.0 ) ; if 4usize == 4 { c . as_ref ( ) [ 3 ] = 1.0 ;
- } c } fn white ( ) -> Self {
- let c = Self :: fill ( 0.0 ) ; if 4usize == 4 { c . as_ref ( ) [ 3 ] = 1.0 ;
- } c } fn iter ( & self ) -> std :: slice :: Iter < f32 > {
- self . into_iter ( ) } fn iter_mut ( & mut self ) -> std :: slice :: IterMut
- < f32 > { self . into_iter ( ) } fn map < F > ( self , mut f : F ) -> Self
- where F : FnMut ( f32 ) -> f32 {
- Self {
- r : f ( self . r ) , g : f ( self . g ) , b : f ( self . b ) , a : f (
- self . a ) } } } impl AsRef < [ f32 ] > for Rgba {
- fn as_ref ( & self ) -> & [ f32 ] { self . as_array ( ) } } impl AsMut < [
- f32 ] > for Rgba {
- fn as_mut ( & mut self ) -> & mut [ f32 ] { self . as_array_mut ( ) } } # [
- doc = r" Iterator which owns a name" ] # [
- derive ( Debug , PartialEq , Clone , Copy ) ] pub struct RgbaIter {
- data : [ f32 ; 4usize ] , next_index : usize , } impl RgbaIter {
- fn new ( src : Rgba ) -> Self {
- Self { data : src . into_array ( ) , next_index : 0 , } } } impl Iterator for
- RgbaIter {
- type Item = f32 ; fn next ( & mut self ) -> Option < f32 > {
- if self . next_index >= 4usize { None } else {
- self . next_index += 1 ; Some ( self . data [ self . next_index - 1 ] ) } } fn
- size_hint ( & self ) -> ( usize , Option < usize > ) {
- let remaining = 4usize - self . next_index ; ( remaining , Some ( remaining )
- ) } } impl ExactSizeIterator for RgbaIter { } # [
- doc = r" Iterate through each component in order" ] impl std :: iter ::
- IntoIterator for Rgba {
- type Item = f32 ; type IntoIter = RgbaIter ; fn into_iter ( self ) -> Self ::
- IntoIter { RgbaIter :: new ( self ) } } # [
- doc = r" Iterate through each component in order" ] impl < 'a > std :: iter ::
- IntoIterator for & 'a Rgba {
- type Item = & 'a f32 ; type IntoIter = std :: slice :: Iter < 'a , f32 > ; fn
- into_iter ( self ) -> Self :: IntoIter { self . as_array ( ) . iter ( ) } }
- # [ doc = r" Iterate through each component in order" ] impl < 'a > std ::
- iter :: IntoIterator for & 'a mut Rgba {
- type Item = & 'a mut f32 ; type IntoIter = std :: slice :: IterMut < 'a , f32
- > ; fn into_iter ( self ) -> Self :: IntoIter {
- self . as_array_mut ( ) . iter_mut ( ) } } # [
- doc = "Add each component independently" ] impl std :: ops :: Add for Rgba {
- type Output = Self ; fn add ( self , other : Self ) -> Self {
- use std :: ops :: AddAssign ; let mut out = self ; out . add_assign ( other )
- ; out } } # [ doc = "Add each component independently" ] impl std :: ops ::
- AddAssign for Rgba {
- fn add_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . add_assign ( other_c ) ; } } } # [
- doc = "Add a scalar value to each component" ] impl std :: ops :: Add < f32 >
- for Rgba {
- type Output = Self ; fn add ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . add ( scalar ) ) } } # [
- doc = "Add a scalar value to each component" ] impl std :: ops :: AddAssign <
- f32 > for Rgba {
- fn add_assign ( & mut self , scalar : f32 ) {
- for c in self { c . add_assign ( scalar ) ; } } } # [
- doc = "Subtract each component independently" ] impl std :: ops :: Sub for
- Rgba {
- type Output = Self ; fn sub ( self , other : Self ) -> Self {
- use std :: ops :: SubAssign ; let mut out = self ; out . sub_assign ( other )
- ; out } } # [ doc = "Subtract each component independently" ] impl std :: ops
- :: SubAssign for Rgba {
- fn sub_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . sub_assign ( other_c ) ; } } } # [
- doc = "Subtract a scalar value from each component" ] impl std :: ops :: Sub <
- f32 > for Rgba {
- type Output = Self ; fn sub ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . sub ( scalar ) ) } } # [
- doc = "Subtract a scalar value from each component" ] impl std :: ops ::
- SubAssign < f32 > for Rgba {
- fn sub_assign ( & mut self , scalar : f32 ) {
- for c in self { c . sub_assign ( scalar ) ; } } } # [
- doc = "Multiply each component independently" ] impl std :: ops :: Mul for
- Rgba {
- type Output = Self ; fn mul ( self , other : Self ) -> Self {
- use std :: ops :: MulAssign ; let mut out = self ; out . mul_assign ( other )
- ; out } } # [ doc = "Multiply each component independently" ] impl std :: ops
- :: MulAssign for Rgba {
- fn mul_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . mul_assign ( other_c ) ; } } } # [
- doc = "Multiply each component by a scalar value" ] impl std :: ops :: Mul <
- f32 > for Rgba {
- type Output = Self ; fn mul ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . mul ( scalar ) ) } } # [
- doc = "Multiply each component by a scalar value" ] impl std :: ops ::
- MulAssign < f32 > for Rgba {
- fn mul_assign ( & mut self , scalar : f32 ) {
- for c in self { c . mul_assign ( scalar ) ; } } } # [
- doc = "Divide each component independently" ] impl std :: ops :: Div for Rgba
- {
- type Output = Self ; fn div ( self , other : Self ) -> Self {
- use std :: ops :: DivAssign ; let mut out = self ; out . div_assign ( other )
- ; out } } # [ doc = "Divide each component independently" ] impl std :: ops ::
- DivAssign for Rgba {
- fn div_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . div_assign ( other_c ) ; } } } # [
- doc = "Divide each component by a scalar value" ] impl std :: ops :: Div < f32
- > for Rgba {
- type Output = Self ; fn div ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . div ( scalar ) ) } } # [
- doc = "Divide each component by a scalar value" ] impl std :: ops :: DivAssign
- < f32 > for Rgba {
- fn div_assign ( & mut self , scalar : f32 ) {
- for c in self { c . div_assign ( scalar ) ; } } } # [
- doc = "Remainder each component independently" ] impl std :: ops :: Rem for
- Rgba {
- type Output = Self ; fn rem ( self , other : Self ) -> Self {
- use std :: ops :: RemAssign ; let mut out = self ; out . rem_assign ( other )
- ; out } } # [ doc = "Remainder each component independently" ] impl std :: ops
- :: RemAssign for Rgba {
- fn rem_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . rem_assign ( other_c ) ; } } } # [
- doc = "Remainder each component by a scalar value" ] impl std :: ops :: Rem <
- f32 > for Rgba {
- type Output = Self ; fn rem ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . rem ( scalar ) ) } } # [
- doc = "Remainder each component by a scalar value" ] impl std :: ops ::
- RemAssign < f32 > for Rgba {
- fn rem_assign ( & mut self , scalar : f32 ) {
- for c in self { c . rem_assign ( scalar ) ; } } }
- impl Rgb {
- # [ doc = r" All components as an array" ] pub fn as_array ( & self ) -> & [
- f32 ; 3usize ] { unsafe { std :: mem :: transmute ( self ) } } # [
- doc = r" All components as an array" ] pub fn as_array_mut ( & mut self ) -> &
- mut [ f32 ; 3usize ] { unsafe { std :: mem :: transmute ( self ) } } # [
- doc = r" All components as an array" ] pub fn into_array ( self ) -> [
- f32 ; 3usize ] { unsafe { std :: mem :: transmute ( self ) } } fn fill (
- value : f32 ) -> Self { Self { r : value , g : value , b : value } } } impl
- num_traits :: Zero for Rgb {
- fn zero ( ) -> Self { Self :: fill ( 0.0 ) } fn is_zero ( & self ) -> bool {
- * self == Self :: zero ( ) } } impl num_traits :: One for Rgb {
- fn one ( ) -> Self { Self :: fill ( 1.0 ) } fn is_one ( & self ) -> bool {
- * self == Self :: one ( ) } } impl Color for Rgb {
- fn black ( ) -> Self {
- let c = Self :: fill ( 0.0 ) ; if 3usize == 4 { c . as_ref ( ) [ 3 ] = 1.0 ;
- } c } fn white ( ) -> Self {
- let c = Self :: fill ( 0.0 ) ; if 3usize == 4 { c . as_ref ( ) [ 3 ] = 1.0 ;
- } c } fn iter ( & self ) -> std :: slice :: Iter < f32 > {
- self . into_iter ( ) } fn iter_mut ( & mut self ) -> std :: slice :: IterMut
- < f32 > { self . into_iter ( ) } fn map < F > ( self , mut f : F ) -> Self
- where F : FnMut ( f32 ) -> f32 {
- Self { r : f ( self . r ) , g : f ( self . g ) , b : f ( self . b ) } } } impl
- AsRef < [ f32 ] > for Rgb {
- fn as_ref ( & self ) -> & [ f32 ] { self . as_array ( ) } } impl AsMut < [
- f32 ] > for Rgb {
- fn as_mut ( & mut self ) -> & mut [ f32 ] { self . as_array_mut ( ) } } # [
- doc = r" Iterator which owns a name" ] # [
- derive ( Debug , PartialEq , Clone , Copy ) ] pub struct RgbIter {
- data : [ f32 ; 3usize ] , next_index : usize , } impl RgbIter {
- fn new ( src : Rgb ) -> Self {
- Self { data : src . into_array ( ) , next_index : 0 , } } } impl Iterator for
- RgbIter {
- type Item = f32 ; fn next ( & mut self ) -> Option < f32 > {
- if self . next_index >= 3usize { None } else {
- self . next_index += 1 ; Some ( self . data [ self . next_index - 1 ] ) } } fn
- size_hint ( & self ) -> ( usize , Option < usize > ) {
- let remaining = 3usize - self . next_index ; ( remaining , Some ( remaining )
- ) } } impl ExactSizeIterator for RgbIter { } # [
- doc = r" Iterate through each component in order" ] impl std :: iter ::
- IntoIterator for Rgb {
- type Item = f32 ; type IntoIter = RgbIter ; fn into_iter ( self ) -> Self ::
- IntoIter { RgbIter :: new ( self ) } } # [
- doc = r" Iterate through each component in order" ] impl < 'a > std :: iter ::
- IntoIterator for & 'a Rgb {
- type Item = & 'a f32 ; type IntoIter = std :: slice :: Iter < 'a , f32 > ; fn
- into_iter ( self ) -> Self :: IntoIter { self . as_array ( ) . iter ( ) } }
- # [ doc = r" Iterate through each component in order" ] impl < 'a > std ::
- iter :: IntoIterator for & 'a mut Rgb {
- type Item = & 'a mut f32 ; type IntoIter = std :: slice :: IterMut < 'a , f32
- > ; fn into_iter ( self ) -> Self :: IntoIter {
- self . as_array_mut ( ) . iter_mut ( ) } } # [
- doc = "Add each component independently" ] impl std :: ops :: Add for Rgb {
- type Output = Self ; fn add ( self , other : Self ) -> Self {
- use std :: ops :: AddAssign ; let mut out = self ; out . add_assign ( other )
- ; out } } # [ doc = "Add each component independently" ] impl std :: ops ::
- AddAssign for Rgb {
- fn add_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . add_assign ( other_c ) ; } } } # [
- doc = "Add a scalar value to each component" ] impl std :: ops :: Add < f32 >
- for Rgb {
- type Output = Self ; fn add ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . add ( scalar ) ) } } # [
- doc = "Add a scalar value to each component" ] impl std :: ops :: AddAssign <
- f32 > for Rgb {
- fn add_assign ( & mut self , scalar : f32 ) {
- for c in self { c . add_assign ( scalar ) ; } } } # [
- doc = "Subtract each component independently" ] impl std :: ops :: Sub for Rgb
- {
- type Output = Self ; fn sub ( self , other : Self ) -> Self {
- use std :: ops :: SubAssign ; let mut out = self ; out . sub_assign ( other )
- ; out } } # [ doc = "Subtract each component independently" ] impl std :: ops
- :: SubAssign for Rgb {
- fn sub_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . sub_assign ( other_c ) ; } } } # [
- doc = "Subtract a scalar value from each component" ] impl std :: ops :: Sub <
- f32 > for Rgb {
- type Output = Self ; fn sub ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . sub ( scalar ) ) } } # [
- doc = "Subtract a scalar value from each component" ] impl std :: ops ::
- SubAssign < f32 > for Rgb {
- fn sub_assign ( & mut self , scalar : f32 ) {
- for c in self { c . sub_assign ( scalar ) ; } } } # [
- doc = "Multiply each component independently" ] impl std :: ops :: Mul for Rgb
- {
- type Output = Self ; fn mul ( self , other : Self ) -> Self {
- use std :: ops :: MulAssign ; let mut out = self ; out . mul_assign ( other )
- ; out } } # [ doc = "Multiply each component independently" ] impl std :: ops
- :: MulAssign for Rgb {
- fn mul_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . mul_assign ( other_c ) ; } } } # [
- doc = "Multiply each component by a scalar value" ] impl std :: ops :: Mul <
- f32 > for Rgb {
- type Output = Self ; fn mul ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . mul ( scalar ) ) } } # [
- doc = "Multiply each component by a scalar value" ] impl std :: ops ::
- MulAssign < f32 > for Rgb {
- fn mul_assign ( & mut self , scalar : f32 ) {
- for c in self { c . mul_assign ( scalar ) ; } } } # [
- doc = "Divide each component independently" ] impl std :: ops :: Div for Rgb {
- type Output = Self ; fn div ( self , other : Self ) -> Self {
- use std :: ops :: DivAssign ; let mut out = self ; out . div_assign ( other )
- ; out } } # [ doc = "Divide each component independently" ] impl std :: ops ::
- DivAssign for Rgb {
- fn div_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . div_assign ( other_c ) ; } } } # [
- doc = "Divide each component by a scalar value" ] impl std :: ops :: Div < f32
- > for Rgb {
- type Output = Self ; fn div ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . div ( scalar ) ) } } # [
- doc = "Divide each component by a scalar value" ] impl std :: ops :: DivAssign
- < f32 > for Rgb {
- fn div_assign ( & mut self , scalar : f32 ) {
- for c in self { c . div_assign ( scalar ) ; } } } # [
- doc = "Remainder each component independently" ] impl std :: ops :: Rem for
- Rgb {
- type Output = Self ; fn rem ( self , other : Self ) -> Self {
- use std :: ops :: RemAssign ; let mut out = self ; out . rem_assign ( other )
- ; out } } # [ doc = "Remainder each component independently" ] impl std :: ops
- :: RemAssign for Rgb {
- fn rem_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . rem_assign ( other_c ) ; } } } # [
- doc = "Remainder each component by a scalar value" ] impl std :: ops :: Rem <
- f32 > for Rgb {
- type Output = Self ; fn rem ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . rem ( scalar ) ) } } # [
- doc = "Remainder each component by a scalar value" ] impl std :: ops ::
- RemAssign < f32 > for Rgb {
- fn rem_assign ( & mut self , scalar : f32 ) {
- for c in self { c . rem_assign ( scalar ) ; } } }
- impl Rg {
- # [ doc = r" All components as an array" ] pub fn as_array ( & self ) -> & [
- f32 ; 2usize ] { unsafe { std :: mem :: transmute ( self ) } } # [
- doc = r" All components as an array" ] pub fn as_array_mut ( & mut self ) -> &
- mut [ f32 ; 2usize ] { unsafe { std :: mem :: transmute ( self ) } } # [
- doc = r" All components as an array" ] pub fn into_array ( self ) -> [
- f32 ; 2usize ] { unsafe { std :: mem :: transmute ( self ) } } fn fill (
- value : f32 ) -> Self { Self { r : value , g : value } } } impl num_traits ::
- Zero for Rg {
- fn zero ( ) -> Self { Self :: fill ( 0.0 ) } fn is_zero ( & self ) -> bool {
- * self == Self :: zero ( ) } } impl num_traits :: One for Rg {
- fn one ( ) -> Self { Self :: fill ( 1.0 ) } fn is_one ( & self ) -> bool {
- * self == Self :: one ( ) } } impl Color for Rg {
- fn black ( ) -> Self {
- let c = Self :: fill ( 0.0 ) ; if 2usize == 4 { c . as_ref ( ) [ 3 ] = 1.0 ;
- } c } fn white ( ) -> Self {
- let c = Self :: fill ( 0.0 ) ; if 2usize == 4 { c . as_ref ( ) [ 3 ] = 1.0 ;
- } c } fn iter ( & self ) -> std :: slice :: Iter < f32 > {
- self . into_iter ( ) } fn iter_mut ( & mut self ) -> std :: slice :: IterMut
- < f32 > { self . into_iter ( ) } fn map < F > ( self , mut f : F ) -> Self
- where F : FnMut ( f32 ) -> f32 {
- Self { r : f ( self . r ) , g : f ( self . g ) } } } impl AsRef < [ f32 ] >
- for Rg { fn as_ref ( & self ) -> & [ f32 ] { self . as_array ( ) } } impl
- AsMut < [ f32 ] > for Rg {
- fn as_mut ( & mut self ) -> & mut [ f32 ] { self . as_array_mut ( ) } } # [
- doc = r" Iterator which owns a name" ] # [
- derive ( Debug , PartialEq , Clone , Copy ) ] pub struct RgIter {
- data : [ f32 ; 2usize ] , next_index : usize , } impl RgIter {
- fn new ( src : Rg ) -> Self {
- Self { data : src . into_array ( ) , next_index : 0 , } } } impl Iterator for
- RgIter {
- type Item = f32 ; fn next ( & mut self ) -> Option < f32 > {
- if self . next_index >= 2usize { None } else {
- self . next_index += 1 ; Some ( self . data [ self . next_index - 1 ] ) } } fn
- size_hint ( & self ) -> ( usize , Option < usize > ) {
- let remaining = 2usize - self . next_index ; ( remaining , Some ( remaining )
- ) } } impl ExactSizeIterator for RgIter { } # [
- doc = r" Iterate through each component in order" ] impl std :: iter ::
- IntoIterator for Rg {
- type Item = f32 ; type IntoIter = RgIter ; fn into_iter ( self ) -> Self ::
- IntoIter { RgIter :: new ( self ) } } # [
- doc = r" Iterate through each component in order" ] impl < 'a > std :: iter ::
- IntoIterator for & 'a Rg {
- type Item = & 'a f32 ; type IntoIter = std :: slice :: Iter < 'a , f32 > ; fn
- into_iter ( self ) -> Self :: IntoIter { self . as_array ( ) . iter ( ) } }
- # [ doc = r" Iterate through each component in order" ] impl < 'a > std ::
- iter :: IntoIterator for & 'a mut Rg {
- type Item = & 'a mut f32 ; type IntoIter = std :: slice :: IterMut < 'a , f32
- > ; fn into_iter ( self ) -> Self :: IntoIter {
- self . as_array_mut ( ) . iter_mut ( ) } } # [
- doc = "Add each component independently" ] impl std :: ops :: Add for Rg {
- type Output = Self ; fn add ( self , other : Self ) -> Self {
- use std :: ops :: AddAssign ; let mut out = self ; out . add_assign ( other )
- ; out } } # [ doc = "Add each component independently" ] impl std :: ops ::
- AddAssign for Rg {
- fn add_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . add_assign ( other_c ) ; } } } # [
- doc = "Add a scalar value to each component" ] impl std :: ops :: Add < f32 >
- for Rg {
- type Output = Self ; fn add ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . add ( scalar ) ) } } # [
- doc = "Add a scalar value to each component" ] impl std :: ops :: AddAssign <
- f32 > for Rg {
- fn add_assign ( & mut self , scalar : f32 ) {
- for c in self { c . add_assign ( scalar ) ; } } } # [
- doc = "Subtract each component independently" ] impl std :: ops :: Sub for Rg
- {
- type Output = Self ; fn sub ( self , other : Self ) -> Self {
- use std :: ops :: SubAssign ; let mut out = self ; out . sub_assign ( other )
- ; out } } # [ doc = "Subtract each component independently" ] impl std :: ops
- :: SubAssign for Rg {
- fn sub_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . sub_assign ( other_c ) ; } } } # [
- doc = "Subtract a scalar value from each component" ] impl std :: ops :: Sub <
- f32 > for Rg {
- type Output = Self ; fn sub ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . sub ( scalar ) ) } } # [
- doc = "Subtract a scalar value from each component" ] impl std :: ops ::
- SubAssign < f32 > for Rg {
- fn sub_assign ( & mut self , scalar : f32 ) {
- for c in self { c . sub_assign ( scalar ) ; } } } # [
- doc = "Multiply each component independently" ] impl std :: ops :: Mul for Rg
- {
- type Output = Self ; fn mul ( self , other : Self ) -> Self {
- use std :: ops :: MulAssign ; let mut out = self ; out . mul_assign ( other )
- ; out } } # [ doc = "Multiply each component independently" ] impl std :: ops
- :: MulAssign for Rg {
- fn mul_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . mul_assign ( other_c ) ; } } } # [
- doc = "Multiply each component by a scalar value" ] impl std :: ops :: Mul <
- f32 > for Rg {
- type Output = Self ; fn mul ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . mul ( scalar ) ) } } # [
- doc = "Multiply each component by a scalar value" ] impl std :: ops ::
- MulAssign < f32 > for Rg {
- fn mul_assign ( & mut self , scalar : f32 ) {
- for c in self { c . mul_assign ( scalar ) ; } } } # [
- doc = "Divide each component independently" ] impl std :: ops :: Div for Rg {
- type Output = Self ; fn div ( self , other : Self ) -> Self {
- use std :: ops :: DivAssign ; let mut out = self ; out . div_assign ( other )
- ; out } } # [ doc = "Divide each component independently" ] impl std :: ops ::
- DivAssign for Rg {
- fn div_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . div_assign ( other_c ) ; } } } # [
- doc = "Divide each component by a scalar value" ] impl std :: ops :: Div < f32
- > for Rg {
- type Output = Self ; fn div ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . div ( scalar ) ) } } # [
- doc = "Divide each component by a scalar value" ] impl std :: ops :: DivAssign
- < f32 > for Rg {
- fn div_assign ( & mut self , scalar : f32 ) {
- for c in self { c . div_assign ( scalar ) ; } } } # [
- doc = "Remainder each component independently" ] impl std :: ops :: Rem for Rg
- {
- type Output = Self ; fn rem ( self , other : Self ) -> Self {
- use std :: ops :: RemAssign ; let mut out = self ; out . rem_assign ( other )
- ; out } } # [ doc = "Remainder each component independently" ] impl std :: ops
- :: RemAssign for Rg {
- fn rem_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . rem_assign ( other_c ) ; } } } # [
- doc = "Remainder each component by a scalar value" ] impl std :: ops :: Rem <
- f32 > for Rg {
- type Output = Self ; fn rem ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . rem ( scalar ) ) } } # [
- doc = "Remainder each component by a scalar value" ] impl std :: ops ::
- RemAssign < f32 > for Rg {
- fn rem_assign ( & mut self , scalar : f32 ) {
- for c in self { c . rem_assign ( scalar ) ; } } }
- impl Grayscale {
- # [ doc = r" All components as an array" ] pub fn as_array ( & self ) -> & [
- f32 ; 1usize ] { unsafe { std :: mem :: transmute ( self ) } } # [
- doc = r" All components as an array" ] pub fn as_array_mut ( & mut self ) -> &
- mut [ f32 ; 1usize ] { unsafe { std :: mem :: transmute ( self ) } } # [
- doc = r" All components as an array" ] pub fn into_array ( self ) -> [
- f32 ; 1usize ] { unsafe { std :: mem :: transmute ( self ) } } fn fill (
- value : f32 ) -> Self { Self ( value ) } } impl num_traits :: Zero for
- Grayscale {
- fn zero ( ) -> Self { Self :: fill ( 0.0 ) } fn is_zero ( & self ) -> bool {
- * self == Self :: zero ( ) } } impl num_traits :: One for Grayscale {
- fn one ( ) -> Self { Self :: fill ( 1.0 ) } fn is_one ( & self ) -> bool {
- * self == Self :: one ( ) } } impl Color for Grayscale {
- fn black ( ) -> Self {
- let c = Self :: fill ( 0.0 ) ; if 1usize == 4 { c . as_ref ( ) [ 3 ] = 1.0 ;
- } c } fn white ( ) -> Self {
- let c = Self :: fill ( 0.0 ) ; if 1usize == 4 { c . as_ref ( ) [ 3 ] = 1.0 ;
- } c } fn iter ( & self ) -> std :: slice :: Iter < f32 > {
- self . into_iter ( ) } fn iter_mut ( & mut self ) -> std :: slice :: IterMut
- < f32 > { self . into_iter ( ) } fn map < F > ( self , mut f : F ) -> Self
- where F : FnMut ( f32 ) -> f32 { Self ( f ( self . 0 ) ) } } impl AsRef < [
- f32 ] > for Grayscale {
- fn as_ref ( & self ) -> & [ f32 ] { self . as_array ( ) } } impl AsMut < [
- f32 ] > for Grayscale {
- fn as_mut ( & mut self ) -> & mut [ f32 ] { self . as_array_mut ( ) } } # [
- doc = r" Iterator which owns a name" ] # [
- derive ( Debug , PartialEq , Clone , Copy ) ] pub struct GrayscaleIter {
- data : [ f32 ; 1usize ] , next_index : usize , } impl GrayscaleIter {
- fn new ( src : Grayscale ) -> Self {
- Self { data : src . into_array ( ) , next_index : 0 , } } } impl Iterator for
- GrayscaleIter {
- type Item = f32 ; fn next ( & mut self ) -> Option < f32 > {
- if self . next_index >= 1usize { None } else {
- self . next_index += 1 ; Some ( self . data [ self . next_index - 1 ] ) } } fn
- size_hint ( & self ) -> ( usize , Option < usize > ) {
- let remaining = 1usize - self . next_index ; ( remaining , Some ( remaining )
- ) } } impl ExactSizeIterator for GrayscaleIter { } # [
- doc = r" Iterate through each component in order" ] impl std :: iter ::
- IntoIterator for Grayscale {
- type Item = f32 ; type IntoIter = GrayscaleIter ; fn into_iter ( self ) ->
- Self :: IntoIter { GrayscaleIter :: new ( self ) } } # [
- doc = r" Iterate through each component in order" ] impl < 'a > std :: iter ::
- IntoIterator for & 'a Grayscale {
- type Item = & 'a f32 ; type IntoIter = std :: slice :: Iter < 'a , f32 > ; fn
- into_iter ( self ) -> Self :: IntoIter { self . as_array ( ) . iter ( ) } }
- # [ doc = r" Iterate through each component in order" ] impl < 'a > std ::
- iter :: IntoIterator for & 'a mut Grayscale {
- type Item = & 'a mut f32 ; type IntoIter = std :: slice :: IterMut < 'a , f32
- > ; fn into_iter ( self ) -> Self :: IntoIter {
- self . as_array_mut ( ) . iter_mut ( ) } } # [
- doc = "Add each component independently" ] impl std :: ops :: Add for
- Grayscale {
- type Output = Self ; fn add ( self , other : Self ) -> Self {
- use std :: ops :: AddAssign ; let mut out = self ; out . add_assign ( other )
- ; out } } # [ doc = "Add each component independently" ] impl std :: ops ::
- AddAssign for Grayscale {
- fn add_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . add_assign ( other_c ) ; } } } # [
- doc = "Add a scalar value to each component" ] impl std :: ops :: Add < f32 >
- for Grayscale {
- type Output = Self ; fn add ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . add ( scalar ) ) } } # [
- doc = "Add a scalar value to each component" ] impl std :: ops :: AddAssign <
- f32 > for Grayscale {
- fn add_assign ( & mut self , scalar : f32 ) {
- for c in self { c . add_assign ( scalar ) ; } } } # [
- doc = "Subtract each component independently" ] impl std :: ops :: Sub for
- Grayscale {
- type Output = Self ; fn sub ( self , other : Self ) -> Self {
- use std :: ops :: SubAssign ; let mut out = self ; out . sub_assign ( other )
- ; out } } # [ doc = "Subtract each component independently" ] impl std :: ops
- :: SubAssign for Grayscale {
- fn sub_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . sub_assign ( other_c ) ; } } } # [
- doc = "Subtract a scalar value from each component" ] impl std :: ops :: Sub <
- f32 > for Grayscale {
- type Output = Self ; fn sub ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . sub ( scalar ) ) } } # [
- doc = "Subtract a scalar value from each component" ] impl std :: ops ::
- SubAssign < f32 > for Grayscale {
- fn sub_assign ( & mut self , scalar : f32 ) {
- for c in self { c . sub_assign ( scalar ) ; } } } # [
- doc = "Multiply each component independently" ] impl std :: ops :: Mul for
- Grayscale {
- type Output = Self ; fn mul ( self , other : Self ) -> Self {
- use std :: ops :: MulAssign ; let mut out = self ; out . mul_assign ( other )
- ; out } } # [ doc = "Multiply each component independently" ] impl std :: ops
- :: MulAssign for Grayscale {
- fn mul_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . mul_assign ( other_c ) ; } } } # [
- doc = "Multiply each component by a scalar value" ] impl std :: ops :: Mul <
- f32 > for Grayscale {
- type Output = Self ; fn mul ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . mul ( scalar ) ) } } # [
- doc = "Multiply each component by a scalar value" ] impl std :: ops ::
- MulAssign < f32 > for Grayscale {
- fn mul_assign ( & mut self , scalar : f32 ) {
- for c in self { c . mul_assign ( scalar ) ; } } } # [
- doc = "Divide each component independently" ] impl std :: ops :: Div for
- Grayscale {
- type Output = Self ; fn div ( self , other : Self ) -> Self {
- use std :: ops :: DivAssign ; let mut out = self ; out . div_assign ( other )
- ; out } } # [ doc = "Divide each component independently" ] impl std :: ops ::
- DivAssign for Grayscale {
- fn div_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . div_assign ( other_c ) ; } } } # [
- doc = "Divide each component by a scalar value" ] impl std :: ops :: Div < f32
- > for Grayscale {
- type Output = Self ; fn div ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . div ( scalar ) ) } } # [
- doc = "Divide each component by a scalar value" ] impl std :: ops :: DivAssign
- < f32 > for Grayscale {
- fn div_assign ( & mut self , scalar : f32 ) {
- for c in self { c . div_assign ( scalar ) ; } } } # [
- doc = "Remainder each component independently" ] impl std :: ops :: Rem for
- Grayscale {
- type Output = Self ; fn rem ( self , other : Self ) -> Self {
- use std :: ops :: RemAssign ; let mut out = self ; out . rem_assign ( other )
- ; out } } # [ doc = "Remainder each component independently" ] impl std :: ops
- :: RemAssign for Grayscale {
- fn rem_assign ( & mut self , other : Self ) {
- for ( c , other_c ) in self . iter_mut ( ) . zip ( other ) {
- c . rem_assign ( other_c ) ; } } } # [
- doc = "Remainder each component by a scalar value" ] impl std :: ops :: Rem <
- f32 > for Grayscale {
- type Output = Self ; fn rem ( self , scalar : f32 ) -> Self {
- self . map ( | c | c . rem ( scalar ) ) } } # [
- doc = "Remainder each component by a scalar value" ] impl std :: ops ::
- RemAssign < f32 > for Grayscale {
- fn rem_assign ( & mut self , scalar : f32 ) {
- for c in self { c . rem_assign ( scalar ) ; } } }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement