-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
get rid of a whole bunch of component_slow
- Loading branch information
Showing
14 changed files
with
97 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use super::Colormap; | ||
|
||
impl Colormap { | ||
/// Instantiate a new [`Colormap`] from a u8 value. | ||
/// | ||
/// Returns `None` if the value doesn't match any of the enum's arms. | ||
pub fn from_u8(value: u8) -> Option<Self> { | ||
// NOTE: This code will be optimized out, it's only here to make sure this method fails to | ||
// compile if the enum is modified. | ||
match Self::default() { | ||
Self::Grayscale | ||
| Self::Inferno | ||
| Self::Magma | ||
| Self::Plasma | ||
| Self::Turbo | ||
| Self::Viridis | ||
| Self::CyanToYellow => {} | ||
} | ||
|
||
match value { | ||
v if v == Self::Grayscale as u8 => Some(Self::Grayscale), | ||
v if v == Self::Inferno as u8 => Some(Self::Inferno), | ||
v if v == Self::Magma as u8 => Some(Self::Magma), | ||
v if v == Self::Plasma as u8 => Some(Self::Plasma), | ||
v if v == Self::Turbo as u8 => Some(Self::Turbo), | ||
v if v == Self::Viridis as u8 => Some(Self::Viridis), | ||
v if v == Self::CyanToYellow as u8 => Some(Self::CyanToYellow), | ||
_ => None, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use super::FillMode; | ||
|
||
impl FillMode { | ||
/// Instantiate a new [`FillMode`] from a u8 value. | ||
/// | ||
/// Returns `None` if the value doesn't match any of the enum's arms. | ||
pub fn from_u8(value: u8) -> Option<Self> { | ||
// NOTE: This code will be optimized out, it's only here to make sure this method fails to | ||
// compile if the enum is modified. | ||
match Self::default() { | ||
Self::MajorWireframe | Self::DenseWireframe | Self::Solid => {} | ||
} | ||
|
||
match value { | ||
v if v == Self::MajorWireframe as u8 => Some(Self::MajorWireframe), | ||
v if v == Self::DenseWireframe as u8 => Some(Self::DenseWireframe), | ||
v if v == Self::Solid as u8 => Some(Self::Solid), | ||
_ => None, | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters