Struct hotdrink_rs::builders::method_builder::MethodBuilder [−][src]
pub struct MethodBuilder<T> { /* fields omitted */ }
A builder for making programmatic construction of methods easier.
Implementations
impl<T> MethodBuilder<T>
[src]
impl<T> MethodBuilder<T>
[src]pub fn new<S: Into<String>>(name: S) -> Self
[src]
Constructs a new MethodBuilder
.
pub fn input<S: Into<String>>(self, input: S) -> Self
[src]
Add an immutable input to the method.
pub fn input_mut<S: Into<String>>(self, input: S) -> Self
[src]
Add a mutable input to the method.
pub fn inputs(self, inputs: Vec<MethodInput>) -> Self
[src]
Set the inputs of the method.
pub fn outputs(self, outputs: Vec<MethodOutput>) -> Self
[src]
Set the outputs of the method.
pub fn apply(
self,
apply: impl for<'a> Fn(Vec<MethodArg<'a, T>>) -> MethodResult<T> + 'static
) -> Self
[src]
self,
apply: impl for<'a> Fn(Vec<MethodArg<'a, T>>) -> MethodResult<T> + 'static
) -> Self
Set the function to run when this method is applied. This function takes a slice with a length corresponding to its inputs as input, and should return a vector of length corresponding to its outputs.
pub fn pure(self, pure: bool) -> Self
[src]
Set whether this method is pure (referentially transparent) or not.
This can affect optimization of the method. If it is pure and none of its inputs have changed, it will not be re-run during the next update-call. If it is not pure, it will be re-run every update. Set this to false if the method reads from or writes to something other than its inputs and outputs.
Trait Implementations
impl<T: Clone> Clone for MethodBuilder<T>
[src]
impl<T: Clone> Clone for MethodBuilder<T>
[src]fn clone(&self) -> MethodBuilder<T>
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Eq for MethodBuilder<T>
[src]
impl<T> Eq for MethodBuilder<T>
[src]Auto Trait Implementations
impl<T> !RefUnwindSafe for MethodBuilder<T>
impl<T> !RefUnwindSafe for MethodBuilder<T>
impl<T> !Send for MethodBuilder<T>
impl<T> !Send for MethodBuilder<T>
impl<T> !Sync for MethodBuilder<T>
impl<T> !Sync for MethodBuilder<T>
impl<T> Unpin for MethodBuilder<T>
impl<T> Unpin for MethodBuilder<T>
impl<T> !UnwindSafe for MethodBuilder<T>
impl<T> !UnwindSafe for MethodBuilder<T>