Skip to content

Commit

Permalink
Fix function name to match documentation.
Browse files Browse the repository at this point in the history
BREAKING CHANGE: renamed function from `lift_result` to `lift`
No one is using it yet, and it was always intended to be called `lift`
and even documented that way, so I'll treat this as a bug.
(1.0.0 will be yanked)
  • Loading branch information
NinoScript committed May 6, 2022
1 parent 9c032bc commit 7c930d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "lift_result"
description = "Lifts a fallible function that returns Result<_, E1> into one that returns Result<_, E2>, if E1 can be automatically converted into E2."
version = "1.0.0"
version = "1.0.1"
edition = "2021"
authors = [
"Cristián Arenas Ulloa <cristian.arenas@gmail.com> (https://github.com/NinoScript)",
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
/// .and_then(lift(failable))
/// ```
///
pub fn lift_result<F, I, O, E1, E2>(f: F) -> impl Fn(I) -> Result<O, E2>
pub fn lift<F, I, O, E1, E2>(f: F) -> impl Fn(I) -> Result<O, E2>
where
F: Fn(I) -> Result<O, E1>,
E2: From<E1>,
Expand All @@ -60,7 +60,7 @@ where

#[cfg(test)]
mod tests {
use super::lift_result;
use super::lift;
#[derive(Debug)]
struct Error1;
#[derive(Debug)]
Expand All @@ -79,7 +79,7 @@ mod tests {
#[test]
fn it_works() {
let string_result = Result::<&str, Error2>::Ok("42");
let i32_result = string_result.and_then(lift_result(fallible));
let i32_result = string_result.and_then(lift(fallible));
assert_eq!(i32_result.unwrap(), 42);
}
}

0 comments on commit 7c930d8

Please sign in to comment.