cell

Function cell 

Source
pub fn cell(value: impl Display) -> Cell<impl RawCell>
Expand description

Create Cell from Display.

The returned value owns the value passed in. Therefore, the returned value can not be move out of the lifetime of the passed value.

use text_grid::*;

fn f_error() -> Cell<impl RawCell> {
    let s = String::from("ABC");
    cell(&s) // Error : returns a value referencing data owned by the current function
}
use text_grid::*;

fn f_ok() -> Cell<impl RawCell> {
    let s = String::from("ABC");
    cell(s) // OK
}