Created
March 29, 2022 06:52
-
-
Save EvanCarroll/aa239a6ee69c25b77755668919d9ff2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Must only say "ClientError::IndexParseError" ONCE. | |
// 2. Must return Result<usize, ClientError::IndexParseError> | |
// 3. No nesting blocks | |
let last_id = document.select("div.cart:nth-child(1)") | |
.ok() | |
.and_then(|mut x| x.next() ) | |
.and_then(|x| { | |
x.attributes | |
.borrow() | |
.get("id") | |
.and_then(|x: &str| Self::get_last_id(x).ok() ) | |
} ) | |
.ok_or( ClientError::IndexParseError )?; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pub fn get_last_id(t: &str) -> Result<usize,ClientError> {