pub enum Horizontal {
}Expand description
Element of a horizontal list.
Variants§
Char(Char)
HBox(HBox)
VBox(VBox)
Rule(Rule)
Mark(Mark)
Insertion(Insertion)
Adjust(Adjust)
Ligature(Ligature)
Discretionary(Discretionary)
Whatsit(Rc<dyn Whatsit>)
Math(Math)
Glue(Glue)
Kern(Kern)
Penalty(Penalty)
Implementations§
Source§impl Horizontal
impl Horizontal
Sourcepub fn precedes_break(&self) -> bool
pub fn precedes_break(&self) -> bool
Whether a glue node that comes after this node may be broken.
For char nodes, this function is essentially undefined in Knuth’s
TeX. More specifically, the value depends on the exact character code.
In TeX this function is never called for char nodes which is why this
is not a problem. Here, we return true for char nodes based on
my analysis of all places in Knuth’s TeX where it is invoked:
-
TeX.2021.868:
precedes_breakis called on variablecur_pwhich is a pointer to a horizontal list. Before this call, the calling code first checks if the node is a character and if so follows the same code path. Thus returningtruehere is the right thing to do. -
TeX.2021.973: the function is called on a variable
prev_pwhich is a pointer to a vertical list and so the char case never arises. -
TeX.2021.1000: same as the last case.
This function is defined in TeX.2021.148.
Sourcepub fn non_discardable(&self) -> bool
pub fn non_discardable(&self) -> bool
Whether this node is discarded after a break.
As with Self::precedes_break, this function is essentially undefined for char nodes in Knuth’s TeX. However there is only one call site (TeX.2021.879) and in that call site char nodes behave as if this function returns true.
This function is defined in TeX.2021.148.
Trait Implementations§
Source§impl Clone for Horizontal
impl Clone for Horizontal
Source§fn clone(&self) -> Horizontal
fn clone(&self) -> Horizontal
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Horizontal
impl Debug for Horizontal
Source§impl From<Adjust> for Horizontal
impl From<Adjust> for Horizontal
Source§impl From<Char> for Horizontal
impl From<Char> for Horizontal
Source§impl From<Discretionary> for Horizontal
impl From<Discretionary> for Horizontal
Source§fn from(value: Discretionary) -> Self
fn from(value: Discretionary) -> Self
Source§impl From<DiscretionaryElem> for Horizontal
impl From<DiscretionaryElem> for Horizontal
Source§fn from(value: DiscretionaryElem) -> Self
fn from(value: DiscretionaryElem) -> Self
Source§impl From<Glue> for Horizontal
impl From<Glue> for Horizontal
Source§impl From<HBox> for Horizontal
impl From<HBox> for Horizontal
Source§impl From<Insertion> for Horizontal
impl From<Insertion> for Horizontal
Source§impl From<Kern> for Horizontal
impl From<Kern> for Horizontal
Source§impl From<Ligature> for Horizontal
impl From<Ligature> for Horizontal
Source§impl From<Mark> for Horizontal
impl From<Mark> for Horizontal
Source§impl From<Math> for Horizontal
impl From<Math> for Horizontal
Source§impl From<Penalty> for Horizontal
impl From<Penalty> for Horizontal
Source§impl From<Rule> for Horizontal
impl From<Rule> for Horizontal
Source§impl From<VBox> for Horizontal
impl From<VBox> for Horizontal
Source§impl PartialEq for Horizontal
impl PartialEq for Horizontal
Source§impl ToBoxLang for Horizontal
impl ToBoxLang for Horizontal
type Output = Horizontal<'static>
fn to_box_lang(&self) -> Self::Output
Source§impl TryFrom<Horizontal> for DiscretionaryElem
impl TryFrom<Horizontal> for DiscretionaryElem
Auto Trait Implementations§
impl Freeze for Horizontal
impl !RefUnwindSafe for Horizontal
impl !Send for Horizontal
impl !Sync for Horizontal
impl Unpin for Horizontal
impl !UnwindSafe for Horizontal
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<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);