-
-
Notifications
You must be signed in to change notification settings - Fork 143
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
Text API redesign #417
Text API redesign #417
Conversation
} | ||
|
||
impl NormalColor { | ||
pub const fn as_hex_digit(self) -> char { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub const fn as_hex_digit(self) -> char { | |
pub const fn to_hex_digit(self) -> char { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since NormalColor
is Copy
maybe the best solution here would be simple fn hex_digit(self)
and fn name(self)
without either as
or to
to avoid confusion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would associate fn hex_digit(self)
with an accessor while fn to_hex_digit(self)
with a function that does some work to convert to another type.
Thanks for the reviews, sorry for my delayed response. Should be good to go now. |
Objective
Solution
Color
to makereset
representable, separateNormalColor
andRgbColor
.Text
,InnerText
,TextContent
, etc public.TextFormat
trait to allow mutating a&mut Text
without cloning.IntoText
trait which is basically the same asInto<Cow<'a, Text>>
(can't implement the latter because of Rust's trait coherence rules)I couldn't figure out a good way to meaningfully reduce the size of
TextInner
so that it wouldn't need to be boxed inText
,