pub enum IrcFmtByte {
Bold,
Italics,
Underline,
Strikethrough,
Monospace,
Colour,
HexColour,
ReverseColour,
Reset,
}
Expand description
A byte that indicates formatting to apply to text.
Variants§
Bold
Toggle bold formatting. u8
value of 2
(byte \x02
).
Italics
Toggle italic formatting. u8
value of 29
(byte \x1d
).
Underline
Toggle underline formatting. u8
value of 31
(byte \x1f
).
Strikethrough
Toggle strikethrough formatting. u8
value of 30
(byte \x1e
).
Monospace
Toggle monospace formatting. u8
value of 17
(byte \x11
).
Colour
Reset or apply foreground/background colours using irc colour codes. u8
value of 3
(byte \x03
).
Valid colour codes are 0
-99
.
0
-15
are usually author defined.
16
-98
are specified.
99
indicates a resetting to the default colour.
No colour codes after the colour byte indicates a colour reset.
Background colour cannot be specified without first specifying a foreground colour followed by a comma.
HexColour
Reset or apply foreground/background colours using hex values. u8
value of 4
(byte \x04
).
6
hexadecimal digits, 2
each representing the red, green and blue values.
No colour codes after the colour byte indicates a colour reset.
Background colour cannot be specified without first specifying a foreground colour followed by a comma.
ReverseColour
Toggle reversing the colour. u8
value of 22
(byte \x16
).
Reset
Reset all formatting to default. u8
value of 15
(byte \x0f
).
Implementations§
source§impl IrcFmtByte
impl IrcFmtByte
sourcepub const fn contains_irc_formatting(input: &[u8]) -> bool
pub const fn contains_irc_formatting(input: &[u8]) -> bool
Checks whether the input
contains an IrcFmtByte
.
sourcepub const fn find_nth_fmt_byte_and_position(
input: &[u8],
nth: usize
) -> Option<(Self, usize)>
pub const fn find_nth_fmt_byte_and_position( input: &[u8], nth: usize ) -> Option<(Self, usize)>
Returns both the IrcFmtByte
and the index
it occurs at if present.
The nth
parameter is a 0 based index.
sourcepub const fn count_fmt_bytes(input: &[u8]) -> usize
pub const fn count_fmt_bytes(input: &[u8]) -> usize
Counts each IrcFmtByte
in input
.
The count does not contain the bytes that represent irc colour codes or hex values.
sourcepub const fn split_at_first_fmt_byte(
input: &[u8]
) -> Option<(OptMsgPart<'_>, Option<Self>, OptIrcColours<'_>, OptMsgPart<'_>)>
pub const fn split_at_first_fmt_byte( input: &[u8] ) -> Option<(OptMsgPart<'_>, Option<Self>, OptIrcColours<'_>, OptMsgPart<'_>)>
Returns message parts split both sides of the IrcFmtByte
along with the byte and colours if present.
If input
is empty it returns None
.
Output is split into 4 parts:
1 - All bytes before the first IrcFmtByte
. None
if the first byte is the IrcFmtByte
.
2 - The IrcFmtByte
if present.
3 - The colours specified for IrcFmtByte::Colour
or IrcFmtByte::HexColour
if present.
4 - All bytes after the colours if present including further formatting bytes. None
if the last byte is part of a colour or the IrcFmtByte
.
Trait Implementations§
source§impl Clone for IrcFmtByte
impl Clone for IrcFmtByte
source§fn clone(&self) -> IrcFmtByte
fn clone(&self) -> IrcFmtByte
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for IrcFmtByte
impl Debug for IrcFmtByte
source§impl PartialEq for IrcFmtByte
impl PartialEq for IrcFmtByte
source§fn eq(&self, other: &IrcFmtByte) -> bool
fn eq(&self, other: &IrcFmtByte) -> bool
self
and other
values to be equal, and is used
by ==
.