pub struct Col {
pub gap: f32,
pub children: Vec<UiRef>,
}Fields§
§gap: f32§children: Vec<UiRef>Implementations§
Source§impl Col
impl Col
Sourcepub fn new(children: impl Into<Vec<UiRef>>) -> UiRef
pub fn new(children: impl Into<Vec<UiRef>>) -> UiRef
Examples found in repository?
examples/ui.rs (lines 140-166)
133 fn text_section(&self) -> UiRef {
134 BoxFill::new(
135 Color::NEUTRAL_950,
136 Padding::all(
137 20.0,
138 Scroll::new(
139 id!(),
140 Col::new([
141 Text::title("Title"),
142 Text::body(
143 "Lorem ipsum dolor sit amet, consectetur\n\n adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
144 ),
145 Text::h1("Heading 1"),
146 Text::body("Lorem ipsum dolor sit amet."),
147 Text::h2("Heading 1"),
148 Text::body("Lorem ipsum dolor sit amet."),
149 Text::mono_sized(
150 format!(
151 "{} {} {} {}",
152 ICON_PLUS_CIRCLE, ICON_BOMB, ICON_CARET_DOWN, ICON_CIRCLE_NOTCH
153 ),
154 40,
155 ),
156 Text::h3("Heading 1"),
157 Text::body("Lorem ipsum dolor sit amet."),
158 Text::italic("Lorem ipsum dolor sit amet."),
159 Text::bold("Lorem ipsum dolor sit amet."),
160 Text::bold_italic("Lorem ipsum dolor sit amet."),
161 Col::new(
162 Palette::NEUTRAL
163 .shades()
164 .map(|c| bold_italic_colored("Lorem ipsum dolor sit amet.", c)),
165 ),
166 ]),
167 ),
168 ),
169 )
170 }More examples
examples/multiplayer.rs (lines 102-126)
69fn chat(state: &mut MultiplayerState<State>) {
70 if !storage_exists::<ChatState>() {
71 storage_store_state(ChatState { messages: vec![] });
72 }
73
74 let messages = &mut storage_get_state_mut::<ChatState>().messages;
75
76 let other_state = unsafe { &*{ state as *const MultiplayerState<State> } };
77 for notification in state.drain_notifications() {
78 let Some(user) = other_state.get_user(notification.user_id) else {
79 break;
80 };
81 let username = &user.username;
82 let text = String::from_utf8(notification.data).unwrap();
83
84 messages.push(rich_text(format!("<b>{username}</b>: {text}")).unwrap());
85 }
86
87 let input_id = id!();
88 let button_id = id!();
89
90 if button_clicked_last_frame(button_id) {
91 let input_state = text_input_state(input_id);
92 messages.push(rich_text(format!("<b>You</b>: {}", input_state.value)).unwrap());
93 state.send_notification(input_state.value.as_bytes().to_vec());
94 input_state.value = "".to_string();
95 }
96
97 let ui = Align::bottom_left(
98 BoxFill::new(
99 flat::BG0,
100 Padding::all(
101 20.0,
102 Col::new([
103 FlexRow::with_gap(
104 10.0,
105 [
106 FlexBox::Flex(flat::TextInput::new(flat::BG1, input_id)),
107 FlexBox::Fixed(flat::Button::text(
108 flat::BG1,
109 flat::BG2,
110 button_id,
111 "Send",
112 )),
113 ],
114 ),
115 Scroll::new(
116 id!(),
117 Col::with_gap(
118 10.0,
119 messages
120 .iter()
121 .map(|r| RichTextNode::new(r.clone()))
122 .collect::<Vec<_>>(),
123 ),
124 )
125 .padding_vertical(20.0),
126 ]),
127 ),
128 )
129 .sized_wh(600.0, 400.0),
130 )
131 .sized(window_size());
132
133 draw_ui(ui, Vec2::ZERO);
134}Sourcepub fn with_gap(gap: f32, children: impl Into<Vec<UiRef>>) -> UiRef
pub fn with_gap(gap: f32, children: impl Into<Vec<UiRef>>) -> UiRef
Examples found in repository?
examples/gamepad.rs (lines 33-40)
28fn choose_gamepad() -> Option<GamepadId> {
29 let input = gamepad::input();
30 let gamepads: Vec<_> = input.gamepads().collect();
31
32 use ui::prelude::*;
33 let ui = Col::with_gap(
34 10.0,
35 gamepads
36 .iter()
37 .enumerate()
38 .map(|(i, (_, pad))| flat::Button::primary_text(i, pad.name()))
39 .collect::<Vec<_>>(),
40 );
41
42 draw_ui(ui, Vec2::splat(10.0));
43
44 Some(
45 gamepads
46 .get(*all_elements_interacted_this_frame().first()?)?
47 .0,
48 )
49}More examples
examples/ui.rs (lines 60-75)
53 fn scroll_section(&self) -> UiRef {
54 BoxFill::new(
55 Color::GRAY_900,
56 Scroll::new(
57 id!(),
58 Padding::all(
59 10.0,
60 Col::with_gap(
61 10.0,
62 (0..100)
63 .map(|n| {
64 SizedBox::height(
65 40.0,
66 Fill::rounded_hover(
67 Color::GRAY_800,
68 Color::GRAY_700,
69 7.0,
70 Center::new(Text::new(n)),
71 ),
72 )
73 })
74 .collect::<Vec<_>>(),
75 ),
76 ),
77 ),
78 )
79 }
80
81 fn w95_section(&mut self) -> UiRef {
82 let color_button = id!();
83 let wait_button = id!();
84
85 if button_clicked_last_frame(color_button) {
86 self.clear_color = rand_color();
87 }
88
89 if button_clicked_last_frame(wait_button) {
90 toggle_wait_for_events();
91 }
92
93 w95::Card::thick(
94 20.0,
95 Scroll::new(
96 id!(),
97 Col::with_gap(
98 10.0,
99 [
100 black_text(format!("{:.0}", avg_fps())),
101 black_text("Hello world!"),
102 black_text("This is UI."),
103 w95::Button::text(color_button, "Background"),
104 w95::Button::text(
105 wait_button,
106 format!("Toggle wait for events: {}", get_wait_for_events()),
107 ),
108 Text::new_with_size_color("Styled text", 30, Color::RED_600),
109 ConstrainedBox::max_size(
110 vec2(300.0, 200.0),
111 w95::Card::new(0.0, ImageNode::from_texture(self.guy)),
112 ),
113 w95::ProgressBar::new(vec2(200.0, 20.0), self.progress, 1.0, id!()),
114 Fill::gradient(
115 Color::NEUTRAL_100,
116 w95::PRIMARY,
117 FRAC_PI_2,
118 Center::new(AspectRatio::new(
119 4.0,
120 BoxFill::new(
121 Color::NEUTRAL_200,
122 CircleFill::new(Color::NEUTRAL_300).sized_wh(150.0, 150.0),
123 ),
124 )),
125 )
126 .sized_wh(200.0, 200.0),
127 ],
128 ),
129 ),
130 )
131 }
132
133 fn text_section(&self) -> UiRef {
134 BoxFill::new(
135 Color::NEUTRAL_950,
136 Padding::all(
137 20.0,
138 Scroll::new(
139 id!(),
140 Col::new([
141 Text::title("Title"),
142 Text::body(
143 "Lorem ipsum dolor sit amet, consectetur\n\n adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.",
144 ),
145 Text::h1("Heading 1"),
146 Text::body("Lorem ipsum dolor sit amet."),
147 Text::h2("Heading 1"),
148 Text::body("Lorem ipsum dolor sit amet."),
149 Text::mono_sized(
150 format!(
151 "{} {} {} {}",
152 ICON_PLUS_CIRCLE, ICON_BOMB, ICON_CARET_DOWN, ICON_CIRCLE_NOTCH
153 ),
154 40,
155 ),
156 Text::h3("Heading 1"),
157 Text::body("Lorem ipsum dolor sit amet."),
158 Text::italic("Lorem ipsum dolor sit amet."),
159 Text::bold("Lorem ipsum dolor sit amet."),
160 Text::bold_italic("Lorem ipsum dolor sit amet."),
161 Col::new(
162 Palette::NEUTRAL
163 .shades()
164 .map(|c| bold_italic_colored("Lorem ipsum dolor sit amet.", c)),
165 ),
166 ]),
167 ),
168 ),
169 )
170 }
171
172 fn button_section(&mut self) -> UiRef {
173 let button = id!();
174
175 if button_clicked_last_frame(button) {
176 self.show_message = !self.show_message;
177 }
178
179 library::flat::Card::bg0_expand(Col::with_gap(
180 30.0,
181 [
182 Center::new(flat::Button::primary_text(button, "Click me!")),
183 if self.show_message {
184 Center::new(Text::body("Thanks for clicking."))
185 } else {
186 EMPTY
187 },
188 ],
189 ))
190 .scissored()
191 }
192
193 fn align_section(&self) -> UiRef {
194 BoxFill::new(
195 Color::BLACK,
196 Stack::new([
197 Align::top_left(square(Color::RED_500)),
198 Align::top_center(square(Color::ORANGE_500)),
199 Align::top_right(square(Color::YELLOW_500)),
200 Align::center_right(square(Color::GREEN_500)),
201 Align::bottom_right(square(Color::SKY_500)),
202 Align::bottom_center(square(Color::BLUE_500)),
203 Align::bottom_left(square(Color::PURPLE_500)),
204 Align::center_left(square(Color::PINK_500)),
205 Align::center(square(Color::WHITE)),
206 ]),
207 )
208 .scissored()
209 }
210
211 fn flat_section(&mut self) -> UiRef {
212 use flat::*;
213
214 let bars: Vec<_> = Palette::PALETTES
215 .iter()
216 .enumerate()
217 .skip(5)
218 .map(|(i, p)| {
219 flat::LoadingBar::new_with_speed(p.v400, i as f32 * 10.0 + 10.0)
220 .height_infinite_width(30.0)
221 })
222 .collect();
223
224 let input_id = id!();
225
226 if text_input_changed(input_id) {
227 println!("{}", text_input_value(input_id));
228 }
229
230 Card::bg0_expand(FlexCol::with_gap(
231 10.0,
232 [
233 FlexBox::Flex(Col::with_gap(
234 20.0,
235 [
236 Drawer::new(
237 "Click me!",
238 BG1,
239 id!(),
240 Col::with_gap(10.0, bars).scroll(id!()),
241 )
242 .max_height(400.0),
243 Text::new(self.slider_a_value),
244 Slider::new(&mut self.slider_a_value, 0, 30, id!()),
245 Slider::alternate(&mut self.slider_b_value, 0.0, 30.0, id!()),
246 Slider::rounded(&mut self.slider_c_value, 0.0, 30.0, id!()),
247 self.window_button(),
248 ],
249 )),
250 FlexBox::Fixed(TextInput::with_prompt(BG2, "Start typing...", input_id)),
251 // FlexBox::Fixed(Text::new("Hello world.")),
252 ],
253 ))
254 }
255
256 fn window_button(&self) -> UiRef {
257 let window_id = id!();
258 let window_button_id = id!();
259
260 let window = flat::FloatingWindow::new(
261 "Hello world",
262 window_id,
263 Col::with_gap(
264 10.0,
265 [
266 Text::body("This is a window"),
267 ImageNode::from_texture_with_scale(self.guy, 300.0),
268 Grid::with_gap(
269 4,
270 4,
271 5.0,
272 (0..16)
273 .map(|_| {
274 Border::all(
275 5.0,
276 Color::WHITE,
277 Fill::hover(Color::BLACK, Color::WHITE, EMPTY),
278 )
279 })
280 .collect::<Vec<_>>(),
281 )
282 .sized_wh(200., 200.),
283 ],
284 ),
285 );
286
287 if button_clicked_last_frame(window_button_id)
288 && let Some(state) = floating_window_state(window_id)
289 {
290 state.open = !state.open;
291 }
292
293 Stack::new([
294 flat::Button::text(flat::BG1, flat::BG2, window_button_id, "Toggle window"),
295 window,
296 ])
297 }examples/multiplayer.rs (lines 117-123)
69fn chat(state: &mut MultiplayerState<State>) {
70 if !storage_exists::<ChatState>() {
71 storage_store_state(ChatState { messages: vec![] });
72 }
73
74 let messages = &mut storage_get_state_mut::<ChatState>().messages;
75
76 let other_state = unsafe { &*{ state as *const MultiplayerState<State> } };
77 for notification in state.drain_notifications() {
78 let Some(user) = other_state.get_user(notification.user_id) else {
79 break;
80 };
81 let username = &user.username;
82 let text = String::from_utf8(notification.data).unwrap();
83
84 messages.push(rich_text(format!("<b>{username}</b>: {text}")).unwrap());
85 }
86
87 let input_id = id!();
88 let button_id = id!();
89
90 if button_clicked_last_frame(button_id) {
91 let input_state = text_input_state(input_id);
92 messages.push(rich_text(format!("<b>You</b>: {}", input_state.value)).unwrap());
93 state.send_notification(input_state.value.as_bytes().to_vec());
94 input_state.value = "".to_string();
95 }
96
97 let ui = Align::bottom_left(
98 BoxFill::new(
99 flat::BG0,
100 Padding::all(
101 20.0,
102 Col::new([
103 FlexRow::with_gap(
104 10.0,
105 [
106 FlexBox::Flex(flat::TextInput::new(flat::BG1, input_id)),
107 FlexBox::Fixed(flat::Button::text(
108 flat::BG1,
109 flat::BG2,
110 button_id,
111 "Send",
112 )),
113 ],
114 ),
115 Scroll::new(
116 id!(),
117 Col::with_gap(
118 10.0,
119 messages
120 .iter()
121 .map(|r| RichTextNode::new(r.clone()))
122 .collect::<Vec<_>>(),
123 ),
124 )
125 .padding_vertical(20.0),
126 ]),
127 ),
128 )
129 .sized_wh(600.0, 400.0),
130 )
131 .sized(window_size());
132
133 draw_ui(ui, Vec2::ZERO);
134}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Col
impl RefUnwindSafe for Col
impl Send for Col
impl Sync for Col
impl Unpin for Col
impl UnsafeUnpin for Col
impl UnwindSafe for Col
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>,
Convert the source color to the destination color using the specified
method.
Source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford
method by default.
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Cast a collection of colors into a collection of arrays.
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
Cast this collection of arrays into a collection of colors.
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
Mutably borrows from an owned value. Read more
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
The number type that’s used in
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
Converts
self into C, using the provided parameters.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
Cast a collection of colors into a collection of color components.
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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
Performs a conversion from
angle.Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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
Converts
other into Self, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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
Performs a conversion into
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
The number type that’s used in
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
Converts
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
Convert into T with values clamped to the color defined bounds Read more
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
Convert into T. The resulting color might be invalid in its color space Read more
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>
Converts
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>
Converts
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<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
Source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
Converts
self into T, while performing the appropriate scaling,
rounding and clamping.Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.Source§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Set the foreground color generically Read more
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Set the background color generically. Read more
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Change the foreground color to black
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Change the background color to black
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Change the foreground color to red
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Change the background color to red
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Change the foreground color to green
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Change the background color to green
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Change the foreground color to yellow
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Change the background color to yellow
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Change the foreground color to blue
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Change the background color to blue
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Change the foreground color to magenta
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Change the background color to magenta
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Change the foreground color to purple
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Change the background color to purple
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Change the foreground color to cyan
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Change the background color to cyan
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Change the foreground color to white
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Change the background color to white
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Change the foreground color to the terminal default
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Change the background color to the terminal default
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Change the foreground color to bright black
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Change the background color to bright black
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Change the foreground color to bright red
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Change the background color to bright red
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Change the foreground color to bright green
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Change the background color to bright green
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Change the foreground color to bright yellow
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Change the background color to bright yellow
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Change the foreground color to bright blue
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Change the background color to bright blue
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Change the foreground color to bright magenta
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Change the background color to bright magenta
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Change the foreground color to bright purple
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Change the background color to bright purple
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Change the foreground color to bright cyan
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Change the background color to bright cyan
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Change the foreground color to bright white
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Change the background color to bright white
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Make the text bold
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Make the text dim
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Make the text italicized
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Make the text underlined
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Make the text blink
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Make the text blink (but fast!)
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Swap the foreground and background colors
Hide the text
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Cross out the text
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
Set the foreground color at runtime. Only use if you do not know which color will be used at
compile-time. If the color is constant, use either
OwoColorize::fg or
a color-specific method, such as OwoColorize::green, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
Set the background color at runtime. Only use if you do not know what color to use at
compile-time. If the color is constant, use either
OwoColorize::bg or
a color-specific method, such as OwoColorize::on_yellow, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the foreground color to a specific RGB value.
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the background color to a specific RGB value.
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Sets the foreground color to an RGB value.
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Sets the background color to an RGB value.
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.Source§impl<T> ToGenericUiNode for Twhere
T: UiNode + 'static,
impl<T> ToGenericUiNode for Twhere
T: UiNode + 'static,
Source§impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
impl<T, U> ToSample<U> for Twhere
U: FromSample<T>,
fn to_sample_(self) -> U
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
The error for when
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>
Try to cast this collection of color components into a collection of
colors. Read more
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>>
Convert into T, returning ok if the color is inside of its defined
range, otherwise an
OutOfBounds error is returned which contains
the unclamped color. Read moreSource§impl<C, U> UintsFrom<C> for Uwhere
C: IntoUints<U>,
impl<C, U> UintsFrom<C> for Uwhere
C: IntoUints<U>,
Source§fn uints_from(colors: C) -> U
fn uints_from(colors: C) -> U
Cast a collection of colors into a collection of unsigned integers.
Source§impl<C, U> UintsInto<C> for Uwhere
C: FromUints<U>,
impl<C, U> UintsInto<C> for Uwhere
C: FromUints<U>,
Source§fn uints_into(self) -> C
fn uints_into(self) -> C
Cast this collection of unsigned integers into a collection of colors.