mirror of
https://github.com/fluencelabs/marine.git
synced 2025-06-16 16:31:28 +00:00
Sort funcs (#91)
This commit is contained in:
@ -17,13 +17,32 @@
|
||||
use serde::Serialize;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Hash, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
pub struct FunctionSignature {
|
||||
pub name: String,
|
||||
pub arguments: Vec<(String, String)>,
|
||||
pub output_types: Vec<String>,
|
||||
}
|
||||
|
||||
use std::cmp::Ordering;
|
||||
impl PartialOrd for FunctionSignature {
|
||||
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
|
||||
Some(self.cmp(other))
|
||||
}
|
||||
}
|
||||
|
||||
impl Ord for FunctionSignature {
|
||||
fn cmp(&self, other: &Self) -> Ordering {
|
||||
if self.name < other.name {
|
||||
Ordering::Less
|
||||
} else if self == other {
|
||||
Ordering::Equal
|
||||
} else {
|
||||
Ordering::Greater
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Eq, Debug, Clone, Hash, Serialize, Deserialize)]
|
||||
pub struct RecordField {
|
||||
pub name: String,
|
||||
|
Reference in New Issue
Block a user