Struct tweak::Case [−][src]
pub struct Case<C, E> { /* fields omitted */ }
Case holds group of when/then clauses
Methods
impl<C: 'static, E: 'static> Case<C, E>
[src]
impl<C: 'static, E: 'static> Case<C, E>
pub fn new<T: Into<String>>(name: T) -> Self
[src]
pub fn new<T: Into<String>>(name: T) -> Self
Create a new case group
Examples
use tweak::Case; let case = Case::<String, ()>::new("string manipulation");
pub fn when<T>(self, name: T, f: fn(_: &mut C) -> Result<bool, E>) -> Self where
T: Into<String>,
[src]
pub fn when<T>(self, name: T, f: fn(_: &mut C) -> Result<bool, E>) -> Self where
T: Into<String>,
pub fn then<T>(self, name: T, f: fn(_: &mut C) -> Result<(), E>) -> Self where
T: Into<String>,
[src]
pub fn then<T>(self, name: T, f: fn(_: &mut C) -> Result<(), E>) -> Self where
T: Into<String>,
Describe an action to run if its then
block returns false
.
pub fn then_case<T, F>(self, name: T, f: F) -> Self where
T: Into<String>,
F: FnOnce(Case<C, E>) -> Case<C, E>,
[src]
pub fn then_case<T, F>(self, name: T, f: F) -> Self where
T: Into<String>,
F: FnOnce(Case<C, E>) -> Case<C, E>,
Describe a group of then/when clauses to run if its then
block returns false
.
pub fn run(&self, ctx: &mut C) -> Result<bool, E>
[src]
pub fn run(&self, ctx: &mut C) -> Result<bool, E>
Run all described statements.