DelayFormat now works with alignment and width#320
DelayFormat now works with alignment and width#320quodlibetor merged 3 commits intochronotope:masterfrom IlyaSamokhin97:DelayFormatAlign
Conversation
|
Thanks! Could you add a couple of tests that demonstrate the behavior and correctness? |
|
Sure. Also I have question about try! macro in format function. Is it used there intentionally or just hasn't been updated to question mark operator? If it's the latter, can I replace it? |
|
Thanks! As you noticed, chrono still supports ancient rust that doesn't have the question mark operator. These new tests are confusing, in them you're creating a string without alignment, and then aligning that string, which isn't related to the chrono formatting. This does match my expectation of what would happen, since I don't think of the chrono formatter as knowing about padding. |
Do you mean it'll be better to inline it like this? assert_eq!(" 2007 January 02", format!("{:>17}", ymd));
assert_eq!("2007 January 02 ", format!("{:<17}", ymd));
assert_eq!(" 2007 January 02 ", format!("{:^17}", ymd)); |
|
Oh darn, I misunderstood what the code was doing. I saw: let percent = datetime.format("%%");as let percent: String = datetime.format("%%");but it's actually let percent: ::format::DelayedFormat<_> = datetime.format("%%");That makes me pretty happy with this, thanks! |
Fix #233