pub enum Dish {
Success(DishData),
Failure(DishError),
}
Expand description
A Dish is the core component of codebake, and is basically
just a wrapper around DishData and DishError. Haskellers may
think of it as an Either DishError DishData
.
Dish::apply
is the core function for operating on dishes.
Variants§
Implementations§
Source§impl Dish
impl Dish
Sourcepub fn from_string(data: String) -> Dish
pub fn from_string(data: String) -> Dish
Consumes a String
and produces a Dish
Sourcepub fn from_bytes(data: Vec<u8>) -> Dish
pub fn from_bytes(data: Vec<u8>) -> Dish
Consumes a Vec
of bytes (Vec<u8>
) and produces a Dish
Sourcepub fn apply(
&mut self,
op: fn(&OperationArguments, &mut DishData) -> DishResult,
args: &OperationArguments,
) -> &mut Dish
pub fn apply( &mut self, op: fn(&OperationArguments, &mut DishData) -> DishResult, args: &OperationArguments, ) -> &mut Dish
Takes a function of type DishData -> DishResult
(AKA an operation)
and consumes self
, producing a new Dish
with the
operation applied.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Dish
impl RefUnwindSafe for Dish
impl Send for Dish
impl Sync for Dish
impl Unpin for Dish
impl UnwindSafe for Dish
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