fix: Remove static-rc due to debug assertions

This commit is contained in:
Michael Aaron Murphy 2022-12-06 22:41:48 +01:00
parent 9796fa9f15
commit d13415713c
No known key found for this signature in database
GPG key ID: B2732D4240C9212C
4 changed files with 3 additions and 13 deletions

View file

@ -22,7 +22,6 @@ lazy_static = "1.4.0"
palette = "0.6.1"
cosmic-panel-config = {git = "https://github.com/pop-os/cosmic-panel", default-features = false, optional = true }
sctk = { package = "smithay-client-toolkit", git = "https://github.com/Smithay/client-toolkit", optional = true }
static-rc = "0.6.1"
[dependencies.cosmic-theme]
git = "https://github.com/pop-os/cosmic-theme.git"

View file

@ -17,8 +17,6 @@ pub mod widget;
mod ext;
pub use ext::ElementExt;
mod utils;
pub use theme::Theme;
pub type Renderer = iced::Renderer<Theme>;
pub type Element<'a, Message> = iced::Element<'a, Message, Renderer>;

View file

@ -1,9 +0,0 @@
// Copyright 2022 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0
use static_rc::StaticRc;
/// Uses [`StaticRc`] to create two halves of value with shared ownership, with no runtime reference counting required.
pub(crate) fn static_rc_halves<T>(value: T) -> (StaticRc<T, 1, 3>, StaticRc<T, 2, 3>) {
StaticRc::split::<1, 2>(StaticRc::<T, 3, 3>::new(value))
}

View file

@ -9,6 +9,7 @@ use iced::{
};
use std::borrow::Cow;
use std::hash::Hash;
use std::rc::Rc;
use derive_setters::Setters;
use crate::{Element, Renderer};
@ -57,7 +58,8 @@ pub fn icon<'a>(name: impl Into<Cow<'a, str>>, size: u16) -> Icon<'a> {
impl<'a> Icon<'a> {
#[must_use]
fn into_svg<Message: 'static>(self) -> Element<'a, Message> {
let (svg, svg_clone) = crate::utils::static_rc_halves(self);
let svg = Rc::new(self);
let svg_clone = Rc::clone(&svg);
iced_lazy::lazy(svg_clone, move || -> Element<Message> {
let icon = freedesktop_icons::lookup(&svg.name)