Extend theme_importer in preparation for importing Zed1 themes (#3791)

This PR extends the `theme_importer` with the overall structure required
to support importing themes from Zed1.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2023-12-22 13:47:30 -05:00 committed by GitHub
parent c34a81152f
commit dc64411cca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 352 additions and 16 deletions

View file

@ -13,10 +13,12 @@ use std::{
ops::{AddAssign, Range, RangeInclusive},
panic::Location,
pin::Pin,
sync::atomic::AtomicU32,
task::{Context, Poll},
};
#[cfg(not(feature = "allow-multiple-gpui-versions"))]
use std::sync::atomic::AtomicU32;
pub use backtrace::Backtrace;
use futures::Future;
use rand::{seq::SliceRandom, Rng};
@ -434,15 +436,18 @@ impl<T: Ord + Clone> RangeExt<T> for RangeInclusive<T> {
}
}
#[cfg(not(feature = "allow-multiple-gpui-versions"))]
static GPUI_LOADED: AtomicU32 = AtomicU32::new(0);
pub fn gpui2_loaded() {
#[cfg(not(feature = "allow-multiple-gpui-versions"))]
if GPUI_LOADED.fetch_add(2, std::sync::atomic::Ordering::SeqCst) != 0 {
panic!("=========\nYou are loading both GPUI1 and GPUI2 in the same build!\nFix Your Dependencies with cargo tree!\n=========")
}
}
pub fn gpui1_loaded() {
#[cfg(not(feature = "allow-multiple-gpui-versions"))]
if GPUI_LOADED.fetch_add(1, std::sync::atomic::Ordering::SeqCst) != 0 {
panic!("=========\nYou are loading both GPUI1 and GPUI2 in the same build!\nFix Your Dependencies with cargo tree!\n=========")
}