This commit is contained in:
Nathan Sobo 2023-09-12 07:34:42 -06:00
parent 3ba8857491
commit 5dad97779a
5 changed files with 15 additions and 0 deletions

1
Cargo.lock generated
View file

@ -7378,6 +7378,7 @@ dependencies = [
"anyhow", "anyhow",
"gpui2", "gpui2",
"log", "log",
"refineable",
"rust-embed", "rust-embed",
"serde", "serde",
"settings", "settings",

View file

@ -22,6 +22,8 @@ use gpui2_macros::styleable_helpers;
use refineable::{Refineable, RefinementCascade}; use refineable::{Refineable, RefinementCascade};
use std::sync::Arc; use std::sync::Arc;
pub type StyleCascade = RefinementCascade<Style>;
#[derive(Clone, Refineable, Debug)] #[derive(Clone, Refineable, Debug)]
#[refineable(debug)] #[refineable(debug)]
pub struct Style { pub struct Style {

View file

@ -17,6 +17,12 @@ pub trait Refineable: Clone {
{ {
Self::default().refined(refinement) Self::default().refined(refinement)
} }
fn from_cascade(cascade: &RefinementCascade<Self>) -> Self
where
Self: Default + Sized,
{
Self::default().refined(&cascade.merged())
}
} }
pub struct RefinementCascade<S: Refineable>(Vec<Option<S::Refinement>>); pub struct RefinementCascade<S: Refineable>(Vec<Option<S::Refinement>>);

View file

@ -12,6 +12,7 @@ path = "src/storybook.rs"
gpui2 = { path = "../gpui2" } gpui2 = { path = "../gpui2" }
anyhow.workspace = true anyhow.workspace = true
log.workspace = true log.workspace = true
refineable = { path = "../refineable" }
rust-embed.workspace = true rust-embed.workspace = true
serde.workspace = true serde.workspace = true
settings = { path = "../settings" } settings = { path = "../settings" }

View file

@ -0,0 +1,5 @@
fn main() {
// Find WebRTC.framework as a sibling of the executable when running outside of an application bundle.
// TODO: We shouldn't depend on WebRTC in editor
println!("cargo:rustc-link-arg=-Wl,-rpath,@executable_path");
}