perf: hand-written PartialEq implementation for Function

Signed-off-by: ljedrz <ljedrz@gmail.com>
This commit is contained in:
ljedrz 2020-10-08 13:27:33 +02:00
parent a3fc39db92
commit 0d01520ea5

View File

@ -20,7 +20,7 @@ use leo_ast::functions::Function as AstFunction;
use serde::{Deserialize, Serialize};
use std::fmt;
#[derive(Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Clone, Serialize, Deserialize)]
pub struct Function {
pub identifier: Identifier,
pub input: Vec<InputVariable>,
@ -29,6 +29,14 @@ pub struct Function {
pub span: Span,
}
impl PartialEq for Function {
fn eq(&self, other: &Self) -> bool {
self.identifier == other.identifier
}
}
impl Eq for Function {}
impl<'ast> From<AstFunction<'ast>> for Function {
fn from(function: AstFunction<'ast>) -> Self {
let function_name = Identifier::from(function.identifier);