Enum Sentinel
#[repr(u32)]pub enum Sentinel {
Inline = 57_345,
BlockLeaf = 57_346,
BlockOpen = 57_347,
BlockClose = 57_348,
}Expand description
Sentinel kind tag.
Each variant matches a Private-Use-Area codepoint reserved by the
lexer. The discriminant doubles as the codepoint, so the
as_char / from_char projections compile to a noop / range
check respectively.
#[repr(u32)] pins the in-memory layout to the codepoint scalar,
matching Rust’s char ABI for round-tripping cost. The variant
values stay inside the PUA range (0xE000..=0xF8FF); pinning the
4-byte layout instead of u8 lets the enum carry the codepoint
directly without a lookup table.
Variants§
Inline = 57_345
Inline Aozora span (ruby / bouten / annotation / gaiji / TCY / kaeriten).
BlockLeaf = 57_346
Block-leaf Aozora line (page break, section break, leaf indent, sashie).
BlockOpen = 57_347
Paired-container open line (e.g. [#ここから字下げ]).
BlockClose = 57_348
Paired-container close line (e.g. [#ここで字下げ終わり]).
Implementations§
§impl Sentinel
impl Sentinel
pub const ALL: [Sentinel; 4]
pub const ALL: [Sentinel; 4]
All sentinel kinds in declaration order. Useful for collision scans, exhaustive iteration, and round-trip property tests.
pub const fn as_char(self) -> char
pub const fn as_char(self) -> char
Codepoint for this sentinel kind. Compiles to a constant — the
#[repr(u32)] discriminant is the codepoint scalar, so the
transmute via char::from_u32_unchecked is a noop. We use the
safe char::from_u32 path here and rely on the variant
discriminants being valid scalar values (they are: PUA is a
proper subset of the scalar range and all four sentinels lie
inside it).
§Panics
panic!s with a const-eval-friendly message if a future
variant ever lands an invalid Unicode scalar discriminant.
All current variants (Self::Inline / Self::BlockLeaf /
Self::BlockOpen / Self::BlockClose) lie in the
U+E001..U+E004 PUA range and never trigger the panic; the
arm exists to keep #[repr(u32)] discriminants honest at
const-eval time.
pub const fn from_char(c: char) -> Option<Sentinel>
pub const fn from_char(c: char) -> Option<Sentinel>
Reverse of Sentinel::as_char. Returns None for any
codepoint outside the four reserved sentinels.
Trait Implementations§
impl Copy for Sentinel
impl Eq for Sentinel
impl StructuralPartialEq for Sentinel
Auto Trait Implementations§
impl Freeze for Sentinel
impl RefUnwindSafe for Sentinel
impl Send for Sentinel
impl Sync for Sentinel
impl Unpin for Sentinel
impl UnsafeUnpin for Sentinel
impl UnwindSafe for Sentinel
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> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§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.§impl<D> OwoColorize for D
impl<D> OwoColorize for D
§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::fg] or
a color-specific method, such as [OwoColorize::green], Read more§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
OwoColorize::bg] or
a color-specific method, such as [OwoColorize::on_yellow], Read more