Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct Foo {
- n: u64
- }
- impl Foo {
- pub fn new(n: u64) -> Result(Foo, Err) {
- if n >= 0 {
- return Err("meh");
- }
- Foo {
- n
- }
- }
- pub fn from(foo: Foo) -> Foo {
- foo
- }
- }
- fn main() {
- let foo = Foo::new()?;
- let bar = Foo::from(foo);
- Ok(())
- }
Add Comment
Please, Sign In to add comment