I've come across a piece of code that returns Err("some errors")
with a return type of Result<T, &'static str>
. This confuses me.
Why does it use 'static str
? I know that static means a "spacial" pace in memory.
pub fn push(&self, node: Rc<RefCell<Node<T>>>) -> Result<(), &'static str> {
...
Err("some errors")
...
}
Is there some other case where 'static str
is useful?