File tree Expand file tree Collapse file tree 1 file changed +5
-0
lines changed
Expand file tree Collapse file tree 1 file changed +5
-0
lines changed Original file line number Diff line number Diff line change @@ -31,11 +31,14 @@ pub trait WriteSource: std::fmt::Debug {
3131 Some ( r)
3232 }
3333
34+ /// Attempts to write the current item, expanding the maximum width where necessary.
3435 fn write_or_expand ( & self , mut opt : WriteOpt ) -> String {
3536 loop {
3637 if let Some ( s) = self . write ( opt. clone ( ) ) {
3738 return s;
3839 } else {
40+ // TODO: could we just set the max width rather than increasing
41+ // it in a loop?
3942 opt. max_width += opt. max_width / 2 ;
4043 opt. reset_line ( ) ;
4144 }
@@ -113,6 +116,8 @@ impl WriteOpt {
113116 Some ( ( ) )
114117 }
115118
119+ /// Sets [WriteOpt::rem_width] to (max_width - indent_width), returning
120+ /// `Some(())`, or `None` if there's not enough space.
116121 fn reset_line ( & mut self ) -> Option < ( ) > {
117122 let ident = self . tab . len ( ) as u16 * self . indent ;
118123 self . rem_width = self . max_width . checked_sub ( ident) ?;
You can’t perform that action at this time.
0 commit comments