pub struct Request {
pub name: String,
pub inputs: Vec<VariableType>,
pub output: Option<VariableType>,
}Expand description
Represents a function request that plugins must implement.
A Request defines the interface that plugins are expected to provide. It specifies the function signature that plugins should implement, including input and output types.
§Fields
name- The name of the requested functioninputs- List of input parameter typesoutput- Optional output type (None for void functions)
§Examples
use plux_rs::function::Request;
use plux_rs::variable::VariableType;
// Request a function that takes two integers and returns their sum
let add_request = Request::new(
"add",
vec![VariableType::I32, VariableType::I32],
Some(VariableType::I32)
);
// Request a logging function that takes a string and returns nothing
let log_request = Request::new(
"log",
vec![VariableType::String],
None
);Fields§
§name: StringThe name of the requested function
inputs: Vec<VariableType>List of input parameter types
output: Option<VariableType>Optional output type (None for void functions)
Implementations§
Source§impl Request
impl Request
Sourcepub fn new<S: Into<String>>(
name: S,
inputs: Vec<VariableType>,
output: Option<VariableType>,
) -> Self
pub fn new<S: Into<String>>( name: S, inputs: Vec<VariableType>, output: Option<VariableType>, ) -> Self
Creates a new function request.
§Parameters
name- The function name (will be converted to String)inputs- Vector of input parameter typesoutput- Optional output type (None for void functions)
§Returns
Returns a new Request instance.
§Type Parameters
S- Type that can be converted into String
§Example
use plux_rs::function::Request;
use plux_rs::variable::VariableType;
let request = Request::new(
"calculate_area",
vec![VariableType::F64, VariableType::F64], // width, height
Some(VariableType::F64) // area
);Trait Implementations§
Source§impl<'de> Deserialize<'de> for Request
impl<'de> Deserialize<'de> for Request
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
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnwindSafe for Request
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<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