You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's happened on a few occasions that I've needed to reference the value of a cell.
Would implementing std::fmt::Display for CellValue be a good idea?
A quick example of a time I've had to do this is when writing a program to format report outputs, one of which required the name of each sheet to be named after the value of a column value (eg. format!("PO Line {}", line_no); )
This solution to the issue was provided to me, in the form of a function, by a user on Reddit:
I have a small objection the implementation proposal: returning an opaque type makes it unstorable unless boxed. Moreover, in this way the return type does not implement traits that could be useful in niche cases (like Copy). On the other hand, being an opaque type make it resilient to breaking changes, but in this case I don't think that it's worth.
TL;DR: I think that returning a concrete CellValueDisplay<'a> instead of an impl fmt::Display would be better.
It's happened on a few occasions that I've needed to reference the value of a cell.
Would implementing
std::fmt::Display
forCellValue
be a good idea?A quick example of a time I've had to do this is when writing a program to format report outputs, one of which required the name of each sheet to be named after the value of a column value (eg.
format!("PO Line {}", line_no);
)This solution to the issue was provided to me, in the form of a function, by a user on Reddit:
Calling this function and passing a reference to a
CellValue
will return the value in a printable form.The text was updated successfully, but these errors were encountered: