gleither
Types
Functions
pub fn flat_map(
either: Either(a, b),
func: fn(b) -> Either(a, b),
) -> Either(a, b)
alias for flat_map_right
pub fn flat_map_left(
either: Either(a, b),
func: fn(a) -> Either(a, b),
) -> Either(a, b)
map and flatten a Left
pub fn flat_map_right(
either: Either(a, b),
func: fn(b) -> Either(a, b),
) -> Either(a, b)
map and flatten a Right
pub fn flatten_left(
either: Either(Either(a, b), b),
) -> Either(a, b)
flatten a nested Left
pub fn flatten_right(
either: Either(a, Either(a, b)),
) -> Either(a, b)
flatten a nested Right
pub fn from_result(result: Result(a, b)) -> Either(a, b)
Convert a Result to an Either, mapping Ok to Left and Error to Right
pub fn full_flat_map(
either: Either(a, b),
left_func: fn(a) -> Either(a, b),
right_func: fn(b) -> Either(a, b),
) -> Either(a, b)
flat_map either potential value
pub fn full_map(
either: Either(a, b),
left_func: fn(a) -> c,
right_func: fn(b) -> d,
) -> Either(c, d)
map either potential value
pub fn get_left_with_default(
either: Either(a, b),
default: a,
) -> a
get the value of a Left or default
pub fn get_right_with_default(
either: Either(a, b),
default: b,
) -> b
get the value of a Right or default
pub fn get_with_default(either: Either(a, b), default: b) -> b
alias for get_right_with_default
pub fn is_left(either: Either(a, b)) -> Bool
Returns True if the supplied value is a Left
pub fn is_right(either: Either(a, b)) -> Bool
Returns True if the supplied value is a Right
pub fn map_left(
either: Either(a, b),
func: fn(a) -> c,
) -> Either(c, b)
apply a function to the Left or preserve the Right
pub fn map_right(
either: Either(a, b),
func: fn(b) -> c,
) -> Either(a, c)
apply a function to the Right or preserve the Left