Skip to content

Commit

Permalink
Add a test case for trait methods
Browse files Browse the repository at this point in the history
  • Loading branch information
JoJoJet committed Oct 11, 2022
1 parent a14fb3f commit 2dd9564
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,14 @@ mod tests {
ControlFlow::Break(y.clone())?;
}
}

struct MyStruct(u32);

impl core::convert::TryFrom<&str> for MyStruct {
type Error = core::num::ParseIntError;
#[tryvial]
fn try_from(value: &str) -> Result<Self, Self::Error> {
Self(value.parse()?)
}
}
}

0 comments on commit 2dd9564

Please sign in to comment.