pub struct Arg {
pub name: String,
pub ty: VariableType,
}
Expand description
Represents a function argument with name and type.
An Arg describes a single parameter or return value of a function, including both its name and data type.
§Fields
name
- The argument name (used for documentation and debugging)ty
- The data type of the argument
§Examples
use plux_rs::function::Arg;
use plux_rs::variable::VariableType;
// Create input arguments
let x_arg = Arg::new("x", VariableType::F64);
let y_arg = Arg::new("y", VariableType::F64);
// Create output argument
let result_arg = Arg::new("result", VariableType::F64);
Fields§
§name: String
The name of the argument
ty: VariableType
The data type of the argument
Implementations§
Source§impl Arg
impl Arg
Sourcepub fn new<S: Into<String>>(name: S, ty: VariableType) -> Self
pub fn new<S: Into<String>>(name: S, ty: VariableType) -> Self
Creates a new argument with the given name and type.
§Parameters
name
- The argument name (will be converted to String)ty
- The data type of the argument
§Returns
Returns a new Arg instance.
§Type Parameters
S
- Type that can be converted into String
§Example
use plux_rs::function::Arg;
use plux_rs::variable::VariableType;
let arg = Arg::new("count", VariableType::I32);
assert_eq!(arg.name, "count");
assert_eq!(arg.ty, VariableType::I32);
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Arg
impl<'de> Deserialize<'de> for Arg
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialOrd for Arg
impl PartialOrd for Arg
impl Eq for Arg
impl StructuralPartialEq for Arg
Auto Trait Implementations§
impl Freeze for Arg
impl RefUnwindSafe for Arg
impl Send for Arg
impl Sync for Arg
impl Unpin for Arg
impl UnwindSafe for Arg
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more