use crate::algorithms::CoreFunction;
use leo_ast::Type;
pub struct Poseidon2Hash;
impl CoreFunction for Poseidon2Hash {
const NUM_ARGS: usize = 1;
fn first_arg_is_allowed_type(type_: &Type) -> bool {
!matches!(type_, Type::Mapping(_) | Type::Tuple(_) | Type::Err | Type::Unit)
}
fn return_type() -> Type {
Type::Field
}
}
pub struct Poseidon4Hash;
impl CoreFunction for Poseidon4Hash {
const NUM_ARGS: usize = 1;
fn first_arg_is_allowed_type(type_: &Type) -> bool {
!matches!(type_, Type::Mapping(_) | Type::Tuple(_) | Type::Err | Type::Unit)
}
fn return_type() -> Type {
Type::Field
}
}
pub struct Poseidon8Hash;
impl CoreFunction for Poseidon8Hash {
const NUM_ARGS: usize = 1;
fn first_arg_is_allowed_type(type_: &Type) -> bool {
!matches!(type_, Type::Mapping(_) | Type::Tuple(_) | Type::Err | Type::Unit)
}
fn return_type() -> Type {
Type::Field
}
}