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]

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]

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> Debug for MethodBuilder<T>[src]

impl<T> Eq for MethodBuilder<T>[src]

impl<T> PartialEq<MethodBuilder<T>> for MethodBuilder<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for MethodBuilder<T>

impl<T> !Send for MethodBuilder<T>

impl<T> !Sync for MethodBuilder<T>

impl<T> Unpin for MethodBuilder<T>

impl<T> !UnwindSafe for MethodBuilder<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.