Commit f9ea1ae6 authored by Benjamin Woodruff's avatar Benjamin Woodruff

Turbopack: Implement Ord for ResolvedVc and OperationVc

parent ff89de45
......@@ -281,7 +281,9 @@ pub struct UpdateInfo {
placeholder_for_future_fields: (),
}
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Serialize, Deserialize, Encode, Decode)]
#[derive(
Clone, Copy, Debug, Eq, PartialEq, PartialOrd, Ord, Hash, Serialize, Deserialize, Encode, Decode,
)]
pub enum TaskPersistence {
/// Tasks that may be persisted across sessions using serialization.
Persistent,
......
......@@ -25,7 +25,9 @@ use crate::{
turbo_tasks,
};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Encode, Decode)]
#[derive(
Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Encode, Decode,
)]
pub struct CellId {
pub type_id: ValueTypeId,
pub index: u32,
......@@ -47,7 +49,9 @@ impl Display for CellId {
///
/// [`Vc`]: crate::Vc
/// [monomorphization]: https://doc.rust-lang.org/book/ch10-01-syntax.html#performance-of-code-using-generics
#[derive(Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Encode, Decode)]
#[derive(
Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize, Encode, Decode,
)]
pub enum RawVc {
/// The synchronous return value of a task (after argument resolution). This is the
/// representation used by [`OperationVc`][crate::OperationVc].
......
use std::{
cmp::Ordering,
fmt::Debug,
future::Future,
hash::Hash,
......@@ -221,6 +222,24 @@ where
impl<T> Eq for OperationVc<T> where T: ?Sized {}
impl<T> PartialOrd<OperationVc<T>> for OperationVc<T>
where
T: ?Sized,
{
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl<T> Ord for OperationVc<T>
where
T: ?Sized,
{
fn cmp(&self, other: &Self) -> Ordering {
self.node.node.cmp(&other.node.node)
}
}
impl<T> Debug for OperationVc<T>
where
T: ?Sized,
......
use std::{
any::Any,
cmp::Ordering,
fmt::Debug,
future::IntoFuture,
hash::{Hash, Hasher},
......@@ -132,6 +133,24 @@ where
impl<T> Eq for ResolvedVc<T> where T: ?Sized {}
impl<T> PartialOrd<ResolvedVc<T>> for ResolvedVc<T>
where
T: ?Sized,
{
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}
impl<T> Ord for ResolvedVc<T>
where
T: ?Sized,
{
fn cmp(&self, other: &Self) -> Ordering {
self.node.node.cmp(&other.node.node)
}
}
impl<T> Hash for ResolvedVc<T>
where
T: ?Sized,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment