Skip to content

Commit

Permalink
chore: small cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ten3roberts committed Jan 26, 2025
1 parent 0e02770 commit 3c59493
Show file tree
Hide file tree
Showing 10 changed files with 36 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: nextest
args: run --all-features
args: run --workspace --all-features

test_miri:
runs-on: ubuntu-latest
Expand All @@ -59,7 +59,7 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: miri
args: nextest run
args: nextest run --workspace


clippy:
Expand Down
14 changes: 12 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Widget for MainApp {
.signal()
.map(|v| Text::new(format!("Count: {v:>4}"))),
)),
Button::new(Text::new("Increment")).on_press(move |_, _| *counter.lock_mut() += 1),
Button::new(Text::new("Increment")).on_click(move |_| *counter.lock_mut() += 1),
pill(Text::new(
"Please click the button to increment the counter",
)),
Expand Down
2 changes: 1 addition & 1 deletion examples/wrapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use tracing_tree::HierarchicalLayer;
use violet_core::{
style::{base_colors::EMERALD_400, spacing_medium, surface_primary, SizeExt},
unit::Unit,
widget::{col, row, Rectangle, Stack, Text},
widget::{col, row, Rectangle},
Widget,
};
use violet_wgpu::renderer::MainRendererConfig;
Expand Down
6 changes: 6 additions & 0 deletions violet-core/src/assets/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ impl<T: ?Sized> std::ops::Deref for Asset<T> {
}
}

impl AsRef<[u8]> for Asset<Vec<u8>> {
fn as_ref(&self) -> &[u8] {
self
}
}

impl<T: ?Sized> Clone for Asset<T> {
fn clone(&self) -> Self {
Self {
Expand Down
12 changes: 6 additions & 6 deletions violet-core/src/style/color.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,12 @@ impl ColorPalette {
element_disabled_success: PLATINUM_950,
element_disabled_warning: PLATINUM_950,
//
surface_success: EMERALD_400,
surface_warning: CITRUS_400,
surface_danger: RUBY_400,
element_success: EMERALD_950,
element_warning: CITRUS_950,
element_danger: RUBY_950,
surface_success: EMERALD_500,
surface_warning: CITRUS_500,
surface_danger: RUBY_500,
element_success: element_primary,
element_warning: element_primary,
element_danger: element_primary,
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions violet-core/src/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{

use atomic_refcell::AtomicRefCell;
use flax::{
archetype::Storage,
archetype::ArchetypeStorage,
component::ComponentValue,
components::child_of,
entity_ids,
Expand Down Expand Up @@ -135,7 +135,7 @@ impl QueryInvalidator {
}

impl EventSubscriber for QueryInvalidator {
fn on_added(&self, _: &Storage, event: &EventData) {
fn on_added(&self, _: &ArchetypeStorage, event: &EventData) {
// tracing::info!(component = ?self.name_map[&event.key], ?event.ids, "added");
self.mark_dirty(event.ids);
}
Expand All @@ -145,7 +145,7 @@ impl EventSubscriber for QueryInvalidator {
self.mark_dirty(event.ids);
}

fn on_removed(&self, _: &Storage, event: &EventData) {
fn on_removed(&self, _: &ArchetypeStorage, event: &EventData) {
// tracing::info!(component = ?self.name_map[&event.key], ?event.ids, "removed");
self.mark_dirty(event.ids);
}
Expand Down
4 changes: 2 additions & 2 deletions violet-demo/src/colorpicker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ fn palette_controls(

let add_swatch = Button::label("+").on_press({
to_owned!(palettes, selection);
move |_, _| {
move |_| {
palettes.write_mut(|palette| {
let last = palette.colors.last().map(|v| v.get()).unwrap_or_default();
palette.colors.push(Mutable::new(last));
Expand Down Expand Up @@ -216,7 +216,7 @@ fn palette_controls(
Button::label("-")
.with_padding(spacing_small())
.with_margin(spacing_small())
.on_press(move |_, _| {
.on_press(move |_| {
palettes.write_mut(|v| v.colors.remove(i));
}),
))
Expand Down
13 changes: 1 addition & 12 deletions violet-demo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
use futures::StreamExt;
use glam::Vec2;
use violet::{
core::{
state::{State, StateStream},
style::{surface_accent, SizeExt},
widget::{col, row, Radio, StreamWidget, WidgetExt},
Widget,
},
futures_signals::signal::Mutable,
wgpu::{renderer::MainRendererConfig, AppBuilder},
};
use violet::wgpu::{renderer::MainRendererConfig, AppBuilder};
use wasm_bindgen_futures::wasm_bindgen;

pub mod bridge_of_death;
Expand Down
3 changes: 2 additions & 1 deletion violet-wgpu/src/renderer/rect_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use palette::Srgba;
use violet_core::{
assets::{map::HandleMap, Asset, AssetCache, AssetKey},
components::{
anchor, color, widget_corner_radius, draw_shape, image, rect, screen_clip_mask, screen_transform,
anchor, color, draw_shape, image, rect, screen_clip_mask, screen_transform,
widget_corner_radius,
},
shape::{self, shape_rectangle},
stored::{self, WeakHandle},
Expand Down

0 comments on commit 3c59493

Please sign in to comment.