mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-15 14:18:04 +08:00
Replace Footprint/() call arguments with dynamically-bound Contexts (#2232)
* Implement experimental Context struct and traits * Add Ctx super trait * Checkpoint * Return Any instead of DynAny * Fix send implementation for inputs with lifetimes * Port more nodes * Uncomment nodes * Port more nodes * Port vector nodes * Partial progress (the stuff I'm more sure about) * Partial progress (the stuff that's not compiling and I'm not sure about) * Fix more errors * First pass of fixing errors introduced by rebase * Port wasm application io * Fix brush node types * Add type annotation * Fix warnings and wasm compilation * Change types for Document Node definitions * Improve debugging for footprint not found errors * Forward context in append artboard node * Fix thumbnails * Fix loading most demo artwork * Wrap output type of all nodes in future * Encode futures as part of the type * Fix document node definitions for future types * Remove Clippy warnings * Fix more things * Fix opening demo art with manual composition upgrading * Set correct type for manual composition * Fix brush * Fix tests * Update docs for deps * Fix up some node signature issues * Code review --------- Co-authored-by: Keavon Chambers <keavon@keavon.com> Co-authored-by: hypercube <0hypercube@gmail.com>
This commit is contained in:
committed by
Keavon Chambers
parent
0c1e96b9c6
commit
4ff2bdb04f
@@ -58,6 +58,13 @@ pub trait DynAny<'a>: 'a {
|
||||
fn type_id(&self) -> TypeId;
|
||||
#[cfg(feature = "log-bad-types")]
|
||||
fn type_name(&self) -> &'static str;
|
||||
fn reborrow_box<'short>(self: Box<Self>) -> Box<dyn DynAny<'short> + 'short>
|
||||
where
|
||||
'a: 'short;
|
||||
fn reborrow_ref<'short>(&'a self) -> &'short (dyn DynAny<'short> + Send + Sync + 'short)
|
||||
where
|
||||
'a: 'short,
|
||||
Self: Send + Sync;
|
||||
}
|
||||
|
||||
impl<'a, T: StaticType + 'a> DynAny<'a> for T {
|
||||
@@ -68,6 +75,20 @@ impl<'a, T: StaticType + 'a> DynAny<'a> for T {
|
||||
fn type_name(&self) -> &'static str {
|
||||
core::any::type_name::<T>()
|
||||
}
|
||||
fn reborrow_box<'short>(self: Box<Self>) -> Box<dyn DynAny<'short> + 'short>
|
||||
where
|
||||
'a: 'short,
|
||||
{
|
||||
self
|
||||
}
|
||||
|
||||
fn reborrow_ref<'short>(&'a self) -> &'short (dyn DynAny<'short> + Send + Sync + 'short)
|
||||
where
|
||||
'a: 'short,
|
||||
Self: Send + Sync,
|
||||
{
|
||||
self
|
||||
}
|
||||
}
|
||||
pub fn downcast_ref<'a, V: StaticType + 'a>(i: &'a dyn DynAny<'a>) -> Option<&'a V> {
|
||||
if i.type_id() == core::any::TypeId::of::<<V as StaticType>::Static>() {
|
||||
|
||||
Reference in New Issue
Block a user