Can pub fn new() return Result<FooBar, ...>?

impl FooBar {
  pub fn new(...) -> ...
}

In idiomatic code, can the above return Result<FooBar, ...> or is it expected to return a FooBar ?

If it’s not allowed to return a Result, what’s suggested name ?

There are some places in std lib that does return Result<Type, …>. Like,
https://doc.rust-lang.org/std/ffi/struct.CString.html#method.new

2 Likes