From ef4aac2fc017c4996d951bb789923cd40a703a5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Delabrouille?= Date: Tue, 4 Jun 2024 17:02:13 +0200 Subject: [PATCH 1/2] feat: add PartialOrdSnap impl --- corelib/src/traits.cairo | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/corelib/src/traits.cairo b/corelib/src/traits.cairo index 191e9d428b9..d49f6bc678c 100644 --- a/corelib/src/traits.cairo +++ b/corelib/src/traits.cairo @@ -105,6 +105,22 @@ pub trait PartialOrd { fn gt(lhs: T, rhs: T) -> bool; } +impl PartialOrdSnap, +Copy> of PartialOrd<@T> { + fn le(lhs: @T, rhs: @T) -> bool { + PartialOrd::::le(*lhs, *rhs) + } + fn ge(lhs: @T, rhs: @T) -> bool { + PartialOrd::::ge(*lhs, *rhs) + } + fn lt(lhs: @T, rhs: @T) -> bool { + PartialOrd::::lt(*lhs, *rhs) + } + fn gt(lhs: @T, rhs: @T) -> bool { + PartialOrd::::gt(*lhs, *rhs) + } + +} + /// Trait for conversion between types. pub trait Into { #[must_use] From 9a896c052f6f82f4d586e86e404987c47a5284db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Delabrouille?= Date: Tue, 4 Jun 2024 18:54:35 +0200 Subject: [PATCH 2/2] style: remove empty line --- corelib/src/traits.cairo | 1 - 1 file changed, 1 deletion(-) diff --git a/corelib/src/traits.cairo b/corelib/src/traits.cairo index d49f6bc678c..198d6bf75ac 100644 --- a/corelib/src/traits.cairo +++ b/corelib/src/traits.cairo @@ -118,7 +118,6 @@ impl PartialOrdSnap, +Copy> of PartialOrd<@T> { fn gt(lhs: @T, rhs: @T) -> bool { PartialOrd::::gt(*lhs, *rhs) } - } /// Trait for conversion between types.