Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LCDColorIs should be const_trait #401

Open
github-actions bot opened this issue Jul 13, 2024 · 0 comments
Open

LCDColorIs should be const_trait #401

github-actions bot opened this issue Jul 13, 2024 · 0 comments
Assignees
Labels

Comments

@github-actions
Copy link
Contributor

LCDColorIs should be const_trait

// TODO: LCDColorIs should be const_trait

Source of this issue
	fn XOR() -> Self { LCDSolidColor::kColorXOR }
}

pub trait LCDColorConst {
	const WHITE: Self;
	const BLACK: Self;
	const CLEAR: Self;
	const XOR: Self;
}

impl LCDColorConst for LCDColor {
	const WHITE: Self = LCDSolidColor::kColorWhite as Self;
	const BLACK: Self = LCDSolidColor::kColorBlack as Self;
	const CLEAR: Self = LCDSolidColor::kColorClear as Self;
	const XOR: Self = LCDSolidColor::kColorXOR as Self;
}

impl LCDColorConst for LCDSolidColor {
	const WHITE: Self = LCDSolidColor::kColorWhite as Self;
	const BLACK: Self = LCDSolidColor::kColorBlack as Self;
	const CLEAR: Self = LCDSolidColor::kColorClear as Self;
	const XOR: Self = LCDSolidColor::kColorXOR as Self;
}


// TODO: LCDColorIs should be const_trait
pub trait LCDColorIs {
	fn is_solid(&self) -> bool;
	fn is_pattern(&self) -> bool;
}

impl LCDColorIs for LCDColor {
	fn is_solid(&self) -> bool {
		let color = *self as usize;
		color >= LCDSolidColor::kColorBlack as _ && color <= LCDSolidColor::kColorXOR as _
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

1 participant