Enum barley_runtime::ActionInput
source · pub enum ActionInput<T> {
Static(T),
Dynamic(ActionObject),
}Expand description
An input for an action.
Action inputs are not required to use this enum, but it is recommended to do so. It allows users to pass both static values and dependency outputs to actions.
Variants§
Implementations§
source§impl<T> ActionInput<T>
impl<T> ActionInput<T>
sourcepub fn new_dynamic(value: ActionObject) -> Self
pub fn new_dynamic(value: ActionObject) -> Self
Creates a new input from an action.
sourcepub fn new_static(value: T) -> Self
pub fn new_static(value: T) -> Self
Creates a new input from a static value.
sourcepub fn static_value(&self) -> Option<&T>
pub fn static_value(&self) -> Option<&T>
Returns the static value, or None if the input
is an action.
sourcepub fn dynamic(&self) -> Option<ActionObject>
pub fn dynamic(&self) -> Option<ActionObject>
Returns the action, or None if the input is
static.
sourcepub fn is_dynamic(&self) -> bool
pub fn is_dynamic(&self) -> bool
Returns true if the input is an action.
sourcepub fn unwrap_static(&self) -> &T
pub fn unwrap_static(&self) -> &T
Returns the static value, or panics if the input is an action.
sourcepub fn unwrap_dynamic(&self) -> ActionObject
pub fn unwrap_dynamic(&self) -> ActionObject
Returns the action, or panics if the input is static.
Trait Implementations§
source§impl<T: Default> Default for ActionInput<T>
impl<T: Default> Default for ActionInput<T>
Auto Trait Implementations§
impl<T> !RefUnwindSafe for ActionInput<T>
impl<T> Send for ActionInput<T>where T: Send,
impl<T> Sync for ActionInput<T>where T: Sync,
impl<T> Unpin for ActionInput<T>where T: Unpin,
impl<T> !UnwindSafe for ActionInput<T>
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