mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-10-06 16:58:12 +08:00
Spell the elided Graphic and Artboard lifetimes in return paths
This commit is contained in:
@@ -576,7 +576,7 @@ mod test_artboard {
|
|||||||
|
|
||||||
/// A leveled wire introspects as its whole legacy list, so each `extend`
|
/// A leveled wire introspects as its whole legacy list, so each `extend`
|
||||||
/// occurrence yields one list rather than one element.
|
/// occurrence yields one list rather than one element.
|
||||||
async fn get_artboards(editor: &mut EditorTestUtils) -> List<Artboard> {
|
async fn get_artboards(editor: &mut EditorTestUtils) -> List<Artboard<'_>> {
|
||||||
let instrumented = match editor.eval_graph().await {
|
let instrumented = match editor.eval_graph().await {
|
||||||
Ok(instrumented) => instrumented,
|
Ok(instrumented) => instrumented,
|
||||||
Err(e) => panic!("Failed to evaluate graph: {e}"),
|
Err(e) => panic!("Failed to evaluate graph: {e}"),
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ impl<'e> Artboard<'e> {
|
|||||||
Self(content)
|
Self(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn as_graphic_list(&self) -> &List<Graphic> {
|
pub fn as_graphic_list(&self) -> &List<Graphic<'_>> {
|
||||||
&self.0
|
&self.0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,10 +65,10 @@ pub(in crate::graphic) fn detable_items<'e, T: Clone + Send + Sync + 'static>(li
|
|||||||
/// never constructs a legacy interior.
|
/// never constructs a legacy interior.
|
||||||
pub trait IntoGraphicElement: Clone + Send + Sync + CacheHash + 'static {
|
pub trait IntoGraphicElement: Clone + Send + Sync + CacheHash + 'static {
|
||||||
/// `None` reports arena exhaustion.
|
/// `None` reports arena exhaustion.
|
||||||
fn into_graphic_element(self, arena: &core_types::arena::Arena) -> Option<Graphic>;
|
fn into_graphic_element(self, arena: &core_types::arena::Arena) -> Option<Graphic<'_>>;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn list_group<T: Clone + Send + Sync + CacheHash + PartialEq + dyn_any::StaticTypeSized>(list: List<T>, arena: &core_types::arena::Arena) -> Option<Graphic>
|
fn list_group<T: Clone + Send + Sync + CacheHash + PartialEq + dyn_any::StaticTypeSized>(list: List<T>, arena: &core_types::arena::Arena) -> Option<Graphic<'_>>
|
||||||
where
|
where
|
||||||
T::Static: Clone + Send + Sync,
|
T::Static: Clone + Send + Sync,
|
||||||
{
|
{
|
||||||
@@ -82,13 +82,13 @@ macro_rules! into_graphic_element {
|
|||||||
($($leaf:ident: $element:ty;)*) => {
|
($($leaf:ident: $element:ty;)*) => {
|
||||||
$(
|
$(
|
||||||
impl IntoGraphicElement for $element {
|
impl IntoGraphicElement for $element {
|
||||||
fn into_graphic_element(self, _arena: &core_types::arena::Arena) -> Option<Graphic> {
|
fn into_graphic_element(self, _arena: &core_types::arena::Arena) -> Option<Graphic<'_>> {
|
||||||
Some(Graphic::$leaf(self))
|
Some(Graphic::$leaf(self))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IntoGraphicElement for List<$element> {
|
impl IntoGraphicElement for List<$element> {
|
||||||
fn into_graphic_element(self, arena: &core_types::arena::Arena) -> Option<Graphic> {
|
fn into_graphic_element(self, arena: &core_types::arena::Arena) -> Option<Graphic<'_>> {
|
||||||
list_group(self, arena)
|
list_group(self, arena)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -106,13 +106,13 @@ into_graphic_element! {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl IntoGraphicElement for Graphic<'static> {
|
impl IntoGraphicElement for Graphic<'static> {
|
||||||
fn into_graphic_element(self, _arena: &core_types::arena::Arena) -> Option<Graphic> {
|
fn into_graphic_element(self, _arena: &core_types::arena::Arena) -> Option<Graphic<'_>> {
|
||||||
Some(self)
|
Some(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IntoGraphicElement for List<Graphic<'static>> {
|
impl IntoGraphicElement for List<Graphic<'static>> {
|
||||||
fn into_graphic_element(self, arena: &core_types::arena::Arena) -> Option<Graphic> {
|
fn into_graphic_element(self, arena: &core_types::arena::Arena) -> Option<Graphic<'_>> {
|
||||||
list_group(self, arena)
|
list_group(self, arena)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -340,7 +340,7 @@ impl From<DVec2> for Graphic<'_> {
|
|||||||
// Note: List conversions handled by blanket impl in gcore
|
// Note: List conversions handled by blanket impl in gcore
|
||||||
|
|
||||||
impl<'e> Graphic<'e> {
|
impl<'e> Graphic<'e> {
|
||||||
pub fn as_graphic(&self) -> Option<&List<Graphic>> {
|
pub fn as_graphic(&self) -> Option<&List<Graphic<'_>>> {
|
||||||
match self {
|
match self {
|
||||||
Graphic::Graphic(graphic) => Some(graphic),
|
Graphic::Graphic(graphic) => Some(graphic),
|
||||||
_ => None,
|
_ => None,
|
||||||
|
|||||||
Reference in New Issue
Block a user