Replace terminology "primary" with "call argument" and "parameter" with "secondary input"

This commit is contained in:
Keavon Chambers 2024-09-25 20:05:00 -07:00
parent f8c7ada572
commit c738b4a1f9
15 changed files with 142 additions and 128 deletions

View file

@ -96,24 +96,24 @@ where
core::any::type_name::<Self::Output>()
}
#[cfg(feature = "alloc")]
fn to_node_io(&self, parameters: Vec<Type>) -> NodeIOTypes {
fn to_node_io(&self, inputs: Vec<Type>) -> NodeIOTypes {
NodeIOTypes {
input: concrete!(<Input as StaticTypeSized>::Static),
output: concrete!(<Self::Output as StaticTypeSized>::Static),
parameters,
call_argument: concrete!(<Input as StaticTypeSized>::Static),
return_value: concrete!(<Self::Output as StaticTypeSized>::Static),
inputs,
}
}
#[cfg(feature = "alloc")]
fn to_async_node_io(&self, parameters: Vec<Type>) -> NodeIOTypes
fn to_async_node_io(&self, inputs: Vec<Type>) -> NodeIOTypes
where
<Self::Output as Future>::Output: StaticTypeSized,
Self::Output: Future,
{
NodeIOTypes {
input: concrete!(<Input as StaticTypeSized>::Static),
call_argument: concrete!(<Input as StaticTypeSized>::Static),
// TODO return actual future type
output: concrete!(<<Self::Output as Future>::Output as StaticTypeSized>::Static),
parameters,
return_value: concrete!(<<Self::Output as Future>::Output as StaticTypeSized>::Static),
inputs,
}
}
}

View file

@ -70,14 +70,14 @@ macro_rules! fn_type {
#[derive(Clone, PartialEq, Eq, Hash, Default)]
pub struct NodeIOTypes {
pub input: Type,
pub output: Type,
pub parameters: Vec<Type>,
pub call_argument: Type,
pub return_value: Type,
pub inputs: Vec<Type>,
}
impl NodeIOTypes {
pub const fn new(input: Type, output: Type, parameters: Vec<Type>) -> Self {
Self { input, output, parameters }
pub const fn new(call_argument: Type, return_value: Type, inputs: Vec<Type>) -> Self {
Self { call_argument, return_value, inputs }
}
pub const fn empty() -> Self {
@ -96,14 +96,14 @@ impl NodeIOTypes {
align: 0,
};
Self {
input: Type::Concrete(tds1),
output: Type::Concrete(tds2),
parameters: Vec::new(),
call_argument: Type::Concrete(tds1),
return_value: Type::Concrete(tds2),
inputs: Vec::new(),
}
}
pub fn ty(&self) -> Type {
Type::Fn(Box::new(self.input.clone()), Box::new(self.output.clone()))
Type::Fn(Box::new(self.call_argument.clone()), Box::new(self.return_value.clone()))
}
}
@ -111,8 +111,8 @@ impl core::fmt::Debug for NodeIOTypes {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
f.write_fmt(format_args!(
"node({}) -> {}",
[&self.input].into_iter().chain(&self.parameters).map(|input| input.to_string()).collect::<Vec<_>>().join(", "),
self.output
[&self.call_argument].into_iter().chain(&self.inputs).map(|input| input.to_string()).collect::<Vec<_>>().join(", "),
self.return_value
))
}
}