pub struct Cell {
pub fg: Color,
pub bg: Color,
pub underline_color: Color,
pub modifier: Modifier,
pub skip: bool,
/* private fields */
}
Expand description
A buffer cell
Fields§
§fg: Color
The foreground color of the cell.
bg: Color
The background color of the cell.
underline_color: Color
underline-color
only.The underline color of the cell.
modifier: Modifier
The modifier of the cell.
skip: bool
Whether the cell should be skipped when copying (diffing) the buffer to the screen.
Implementations§
Source§impl Cell
impl Cell
Sourcepub const fn new(symbol: &'static str) -> Self
pub const fn new(symbol: &'static str) -> Self
Creates a new Cell
with the given symbol.
This works at compile time and puts the symbol onto the stack. Fails to build when the
symbol doesnt fit onto the stack and requires to be placed on the heap. Use
Self::default().set_symbol()
in that case. See CompactString::const_new
for more
details on this.
Sourcepub fn symbol(&self) -> &str
pub fn symbol(&self) -> &str
Gets the symbol of the cell.
Examples found in repository?
80fn text(frame_count: usize, area: Rect, buf: &mut Buffer) {
81 let sub_frame = frame_count.saturating_sub(TEXT_DELAY);
82 if sub_frame == 0 {
83 return;
84 }
85
86 let logo = indoc::indoc! {"
87 ██████ ████ ██████ ████ ██████ ██ ██ ██
88 ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
89 ██████ ████████ ██ ████████ ██ ██ ██ ██
90 ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
91 ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
92 "};
93 let logo_text = Text::styled(logo, Color::Rgb(255, 255, 255));
94 let area = centered_rect(area, logo_text.width() as u16, logo_text.height() as u16);
95
96 let mask_buf = &mut Buffer::empty(area);
97 logo_text.render(area, mask_buf);
98
99 let percentage = (sub_frame as f64 / 480.0).clamp(0.0, 1.0);
100
101 for row in area.rows() {
102 for col in row.columns() {
103 let cell = &mut buf[(col.x, col.y)];
104 let mask_cell = &mut mask_buf[(col.x, col.y)];
105 cell.set_symbol(mask_cell.symbol());
106
107 // blend the mask cell color with the cell color
108 let cell_color = cell.style().bg.unwrap_or(Color::Rgb(0, 0, 0));
109 let mask_color = mask_cell.style().fg.unwrap_or(Color::Rgb(255, 0, 0));
110
111 let color = blend(mask_color, cell_color, percentage);
112 cell.set_style(Style::new().fg(color));
113 }
114 }
115}
Sourcepub fn set_symbol(&mut self, symbol: &str) -> &mut Self
pub fn set_symbol(&mut self, symbol: &str) -> &mut Self
Sets the symbol of the cell.
Examples found in repository?
More examples
81 fn render(self, area: Rect, buffer: &mut Buffer) {
82 (&self.text).render(area, buffer);
83
84 // this is a hacky workaround for https://github.com/ratatui/ratatui/issues/902, a bug
85 // in the terminal code that incorrectly calculates the width of ANSI escape sequences. It
86 // works by rendering the hyperlink as a series of 2-character chunks, which is the
87 // calculated width of the hyperlink text.
88 for (i, two_chars) in self
89 .text
90 .to_string()
91 .chars()
92 .chunks(2)
93 .into_iter()
94 .enumerate()
95 {
96 let text = two_chars.collect::<String>();
97 let hyperlink = format!("\x1B]8;;{}\x07{}\x1B]8;;\x07", self.url, text);
98 buffer[(area.x + i as u16 * 2, area.y)].set_symbol(hyperlink.as_str());
99 }
100 }
80fn text(frame_count: usize, area: Rect, buf: &mut Buffer) {
81 let sub_frame = frame_count.saturating_sub(TEXT_DELAY);
82 if sub_frame == 0 {
83 return;
84 }
85
86 let logo = indoc::indoc! {"
87 ██████ ████ ██████ ████ ██████ ██ ██ ██
88 ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
89 ██████ ████████ ██ ████████ ██ ██ ██ ██
90 ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
91 ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
92 "};
93 let logo_text = Text::styled(logo, Color::Rgb(255, 255, 255));
94 let area = centered_rect(area, logo_text.width() as u16, logo_text.height() as u16);
95
96 let mask_buf = &mut Buffer::empty(area);
97 logo_text.render(area, mask_buf);
98
99 let percentage = (sub_frame as f64 / 480.0).clamp(0.0, 1.0);
100
101 for row in area.rows() {
102 for col in row.columns() {
103 let cell = &mut buf[(col.x, col.y)];
104 let mask_cell = &mut mask_buf[(col.x, col.y)];
105 cell.set_symbol(mask_cell.symbol());
106
107 // blend the mask cell color with the cell color
108 let cell_color = cell.style().bg.unwrap_or(Color::Rgb(0, 0, 0));
109 let mask_color = mask_cell.style().fg.unwrap_or(Color::Rgb(255, 0, 0));
110
111 let color = blend(mask_color, cell_color, percentage);
112 cell.set_style(Style::new().fg(color));
113 }
114 }
115}
Sourcepub fn set_char(&mut self, ch: char) -> &mut Self
pub fn set_char(&mut self, ch: char) -> &mut Self
Sets the symbol of the cell to a single character.
Examples found in repository?
13 fn render(self, area: Rect, buf: &mut Buffer) {
14 for (yi, y) in (area.top()..area.bottom()).enumerate() {
15 let value = f32::from(area.height) - yi as f32;
16 let value_fg = value / f32::from(area.height);
17 let value_bg = (value - 0.5) / f32::from(area.height);
18 for (xi, x) in (area.left()..area.right()).enumerate() {
19 let hue = xi as f32 * 360.0 / f32::from(area.width);
20 let fg = color_from_oklab(hue, Okhsv::max_saturation(), value_fg);
21 let bg = color_from_oklab(hue, Okhsv::max_saturation(), value_bg);
22 buf[(x, y)].set_char('▀').set_fg(fg).set_bg(bg);
23 }
24 }
25 }
More examples
206 fn render(self, area: Rect, buf: &mut Buffer) {
207 self.setup_colors(area);
208 let colors = &self.colors;
209 for (xi, x) in (area.left()..area.right()).enumerate() {
210 // animate the colors by shifting the x index by the frame number
211 let xi = (xi + self.frame_count) % (area.width as usize);
212 for (yi, y) in (area.top()..area.bottom()).enumerate() {
213 // render a half block character for each row of pixels with the foreground color
214 // set to the color of the pixel and the background color set to the color of the
215 // pixel below it
216 let fg = colors[yi * 2][xi];
217 let bg = colors[yi * 2 + 1][xi];
218 buf[Position::new(x, y)].set_char('▀').set_fg(fg).set_bg(bg);
219 }
220 }
221 self.frame_count += 1;
222 }
105pub fn render_logo(selected_row: usize, area: Rect, buf: &mut Buffer) {
106 let eye_color = if selected_row % 2 == 0 {
107 THEME.logo.rat_eye
108 } else {
109 THEME.logo.rat_eye_alt
110 };
111 let area = area.inner(Margin {
112 vertical: 0,
113 horizontal: 2,
114 });
115 for (y, (line1, line2)) in RATATUI_LOGO.iter().tuples().enumerate() {
116 for (x, (ch1, ch2)) in line1.chars().zip(line2.chars()).enumerate() {
117 let x = area.left() + x as u16;
118 let y = area.top() + y as u16;
119 let cell = &mut buf[(x, y)];
120 let rat_color = THEME.logo.rat;
121 let term_color = THEME.logo.term;
122 match (ch1, ch2) {
123 ('█', '█') => {
124 cell.set_char('█');
125 cell.fg = rat_color;
126 cell.bg = rat_color;
127 }
128 ('█', ' ') => {
129 cell.set_char('▀');
130 cell.fg = rat_color;
131 }
132 (' ', '█') => {
133 cell.set_char('▄');
134 cell.fg = rat_color;
135 }
136 ('█', 'x') => {
137 cell.set_char('▀');
138 cell.fg = rat_color;
139 cell.bg = term_color;
140 }
141 ('x', '█') => {
142 cell.set_char('▄');
143 cell.fg = rat_color;
144 cell.bg = term_color;
145 }
146 ('x', 'x') => {
147 cell.set_char(' ');
148 cell.fg = term_color;
149 cell.bg = term_color;
150 }
151 ('█', 'e') => {
152 cell.set_char('▀');
153 cell.fg = rat_color;
154 cell.bg = eye_color;
155 }
156 ('e', '█') => {
157 cell.set_char('▄');
158 cell.fg = rat_color;
159 cell.bg = eye_color;
160 }
161 (_, _) => {}
162 };
163 }
164 }
165}
Sourcepub fn set_fg(&mut self, color: Color) -> &mut Self
pub fn set_fg(&mut self, color: Color) -> &mut Self
Sets the foreground color of the cell.
Examples found in repository?
13 fn render(self, area: Rect, buf: &mut Buffer) {
14 for (yi, y) in (area.top()..area.bottom()).enumerate() {
15 let value = f32::from(area.height) - yi as f32;
16 let value_fg = value / f32::from(area.height);
17 let value_bg = (value - 0.5) / f32::from(area.height);
18 for (xi, x) in (area.left()..area.right()).enumerate() {
19 let hue = xi as f32 * 360.0 / f32::from(area.width);
20 let fg = color_from_oklab(hue, Okhsv::max_saturation(), value_fg);
21 let bg = color_from_oklab(hue, Okhsv::max_saturation(), value_bg);
22 buf[(x, y)].set_char('▀').set_fg(fg).set_bg(bg);
23 }
24 }
25 }
More examples
206 fn render(self, area: Rect, buf: &mut Buffer) {
207 self.setup_colors(area);
208 let colors = &self.colors;
209 for (xi, x) in (area.left()..area.right()).enumerate() {
210 // animate the colors by shifting the x index by the frame number
211 let xi = (xi + self.frame_count) % (area.width as usize);
212 for (yi, y) in (area.top()..area.bottom()).enumerate() {
213 // render a half block character for each row of pixels with the foreground color
214 // set to the color of the pixel and the background color set to the color of the
215 // pixel below it
216 let fg = colors[yi * 2][xi];
217 let bg = colors[yi * 2 + 1][xi];
218 buf[Position::new(x, y)].set_char('▀').set_fg(fg).set_bg(bg);
219 }
220 }
221 self.frame_count += 1;
222 }
Sourcepub fn set_bg(&mut self, color: Color) -> &mut Self
pub fn set_bg(&mut self, color: Color) -> &mut Self
Sets the background color of the cell.
Examples found in repository?
13 fn render(self, area: Rect, buf: &mut Buffer) {
14 for (yi, y) in (area.top()..area.bottom()).enumerate() {
15 let value = f32::from(area.height) - yi as f32;
16 let value_fg = value / f32::from(area.height);
17 let value_bg = (value - 0.5) / f32::from(area.height);
18 for (xi, x) in (area.left()..area.right()).enumerate() {
19 let hue = xi as f32 * 360.0 / f32::from(area.width);
20 let fg = color_from_oklab(hue, Okhsv::max_saturation(), value_fg);
21 let bg = color_from_oklab(hue, Okhsv::max_saturation(), value_bg);
22 buf[(x, y)].set_char('▀').set_fg(fg).set_bg(bg);
23 }
24 }
25 }
More examples
206 fn render(self, area: Rect, buf: &mut Buffer) {
207 self.setup_colors(area);
208 let colors = &self.colors;
209 for (xi, x) in (area.left()..area.right()).enumerate() {
210 // animate the colors by shifting the x index by the frame number
211 let xi = (xi + self.frame_count) % (area.width as usize);
212 for (yi, y) in (area.top()..area.bottom()).enumerate() {
213 // render a half block character for each row of pixels with the foreground color
214 // set to the color of the pixel and the background color set to the color of the
215 // pixel below it
216 let fg = colors[yi * 2][xi];
217 let bg = colors[yi * 2 + 1][xi];
218 buf[Position::new(x, y)].set_char('▀').set_fg(fg).set_bg(bg);
219 }
220 }
221 self.frame_count += 1;
222 }
Sourcepub fn set_style<S: Into<Style>>(&mut self, style: S) -> &mut Self
pub fn set_style<S: Into<Style>>(&mut self, style: S) -> &mut Self
Sets the style of the cell.
style
accepts any type that is convertible to Style
(e.g. Style
, Color
, or
your own type that implements Into<Style>
).
Examples found in repository?
More examples
80fn text(frame_count: usize, area: Rect, buf: &mut Buffer) {
81 let sub_frame = frame_count.saturating_sub(TEXT_DELAY);
82 if sub_frame == 0 {
83 return;
84 }
85
86 let logo = indoc::indoc! {"
87 ██████ ████ ██████ ████ ██████ ██ ██ ██
88 ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
89 ██████ ████████ ██ ████████ ██ ██ ██ ██
90 ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
91 ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
92 "};
93 let logo_text = Text::styled(logo, Color::Rgb(255, 255, 255));
94 let area = centered_rect(area, logo_text.width() as u16, logo_text.height() as u16);
95
96 let mask_buf = &mut Buffer::empty(area);
97 logo_text.render(area, mask_buf);
98
99 let percentage = (sub_frame as f64 / 480.0).clamp(0.0, 1.0);
100
101 for row in area.rows() {
102 for col in row.columns() {
103 let cell = &mut buf[(col.x, col.y)];
104 let mask_cell = &mut mask_buf[(col.x, col.y)];
105 cell.set_symbol(mask_cell.symbol());
106
107 // blend the mask cell color with the cell color
108 let cell_color = cell.style().bg.unwrap_or(Color::Rgb(0, 0, 0));
109 let mask_color = mask_cell.style().fg.unwrap_or(Color::Rgb(255, 0, 0));
110
111 let color = blend(mask_color, cell_color, percentage);
112 cell.set_style(Style::new().fg(color));
113 }
114 }
115}
Sourcepub const fn style(&self) -> Style
pub const fn style(&self) -> Style
Returns the style of the cell.
Examples found in repository?
80fn text(frame_count: usize, area: Rect, buf: &mut Buffer) {
81 let sub_frame = frame_count.saturating_sub(TEXT_DELAY);
82 if sub_frame == 0 {
83 return;
84 }
85
86 let logo = indoc::indoc! {"
87 ██████ ████ ██████ ████ ██████ ██ ██ ██
88 ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
89 ██████ ████████ ██ ████████ ██ ██ ██ ██
90 ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
91 ██ ██ ██ ██ ██ ██ ██ ██ ████ ██
92 "};
93 let logo_text = Text::styled(logo, Color::Rgb(255, 255, 255));
94 let area = centered_rect(area, logo_text.width() as u16, logo_text.height() as u16);
95
96 let mask_buf = &mut Buffer::empty(area);
97 logo_text.render(area, mask_buf);
98
99 let percentage = (sub_frame as f64 / 480.0).clamp(0.0, 1.0);
100
101 for row in area.rows() {
102 for col in row.columns() {
103 let cell = &mut buf[(col.x, col.y)];
104 let mask_cell = &mut mask_buf[(col.x, col.y)];
105 cell.set_symbol(mask_cell.symbol());
106
107 // blend the mask cell color with the cell color
108 let cell_color = cell.style().bg.unwrap_or(Color::Rgb(0, 0, 0));
109 let mask_color = mask_cell.style().fg.unwrap_or(Color::Rgb(255, 0, 0));
110
111 let color = blend(mask_color, cell_color, percentage);
112 cell.set_style(Style::new().fg(color));
113 }
114 }
115}
Sourcepub fn set_skip(&mut self, skip: bool) -> &mut Self
pub fn set_skip(&mut self, skip: bool) -> &mut Self
Sets the cell to be skipped when copying (diffing) the buffer to the screen.
This is helpful when it is necessary to prevent the buffer from overwriting a cell that is covered by an image from some terminal graphics protocol (Sixel / iTerm / Kitty …).
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Resets the cell to the empty state.
Examples found in repository?
42fn drip(frame_count: usize, area: Rect, buf: &mut Buffer) {
43 // a seeded rng as we have to move the same random pixels each frame
44 let mut rng = rand_chacha::ChaCha8Rng::seed_from_u64(10);
45 let ramp_frames = 450;
46 let fractional_speed = frame_count as f64 / f64::from(ramp_frames);
47 let variable_speed = DRIP_SPEED as f64 * fractional_speed * fractional_speed * fractional_speed;
48 let pixel_count = (frame_count as f64 * variable_speed).floor() as usize;
49 for _ in 0..pixel_count {
50 let src_x = rng.gen_range(0..area.width);
51 let src_y = rng.gen_range(1..area.height - 2);
52 let src = buf[(src_x, src_y)].clone();
53 // 1% of the time, move a blank or pixel (10:1) to the top line of the screen
54 if rng.gen_ratio(1, 100) {
55 let dest_x = rng
56 .gen_range(src_x.saturating_sub(5)..src_x.saturating_add(5))
57 .clamp(area.left(), area.right() - 1);
58 let dest_y = area.top() + 1;
59
60 let dest = &mut buf[(dest_x, dest_y)];
61 // copy the cell to the new location about 1/10 of the time blank out the cell the rest
62 // of the time. This has the effect of gradually removing the pixels from the screen.
63 if rng.gen_ratio(1, 10) {
64 *dest = src;
65 } else {
66 dest.reset();
67 }
68 } else {
69 // move the pixel down one row
70 let dest_x = src_x;
71 let dest_y = src_y.saturating_add(1).min(area.bottom() - 2);
72 // copy the cell to the new location
73 buf[(dest_x, dest_y)] = src;
74 }
75 }
76}
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Cell
impl<'de> Deserialize<'de> for Cell
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for Cell
impl StructuralPartialEq for Cell
Auto Trait Implementations§
impl Freeze for Cell
impl RefUnwindSafe for Cell
impl Send for Cell
impl Sync for Cell
impl Unpin for Cell
impl UnwindSafe for Cell
Blanket Implementations§
Source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
Source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
Source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
Source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
Source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
Source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
Source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
Source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle
.Source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
Source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other
into Self
, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
Source§fn into_angle(self) -> U
fn into_angle(self) -> U
T
.Source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
Source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters
when converting.Source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.Source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
Source§fn into_color(self) -> U
fn into_color(self) -> U
Source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
Source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self
into T
, while performing the appropriate scaling,
rounding and clamping.Source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
Source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors
fails to cast.Source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
Source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
Source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more