pub struct WrapWidth(pub usize);Expand description
textwidth, resolved for a specific buffer — the column reflow
targets and, when autowrap allows, the column typing breaks at.
A newtype rather than a bare usize, and that is load-bearing.
It is carried by two env structs (GrammarEnv and the actor’s
DispatchEnv), both of which derive Default for their ~40
hand-built call sites. A bare usize defaults to 0, which is not a
column anything can wrap at — so every one of those sites would
silently get a reflow that does nothing, and the bug would look like
“gq is broken in tests but works in the editor”. Giving the type a
meaningful default puts the answer in one place and makes a third env
struct impossible to get wrong.
Same reasoning that made crate::IndentUnit a type rather than
three loose fields.
Tuple Fields§
§0: usizeImplementations§
Trait Implementations§
impl Copy for WrapWidth
impl Eq for WrapWidth
Source§impl Ord for WrapWidth
impl Ord for WrapWidth
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for WrapWidth
impl PartialOrd for WrapWidth
impl StructuralPartialEq for WrapWidth
Auto Trait Implementations§
impl Freeze for WrapWidth
impl RefUnwindSafe for WrapWidth
impl Send for WrapWidth
impl Sync for WrapWidth
impl Unpin for WrapWidth
impl UnsafeUnpin for WrapWidth
impl UnwindSafe for WrapWidth
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.