pub struct Line<const C: usize> { /* private fields */ }
Expand description
A single line with fixed capacity for C characters
At the moment, C
must be <= 255.
This Line acts more or less like a small, fixed size vector of ascii characters
Lines ONLY contain valid ascii characters, that are not control characters.
Implementations§
source§impl<const C: usize> Line<C>
impl<const C: usize> Line<C>
pub const fn cap_u8() -> u8
sourcepub fn extend(&mut self, s: &str) -> Result<(), LineError>
pub fn extend(&mut self, s: &str) -> Result<(), LineError>
Extend the current line with the given string slice.
Returns an error if the provided slice would not fit, or if any characters are invalid ascii or ascii control characters
sourcepub fn overwrite(&mut self, pos: usize, ovrw: u8) -> Result<(), LineError>
pub fn overwrite(&mut self, pos: usize, ovrw: u8) -> Result<(), LineError>
Overwrite an ascii character at the given position
Returns an error if the provided location would leave a gap (beyond the end of the current line), or if the given character is invalid ascii or an ascii control character
sourcepub fn push(&mut self, ins: u8) -> Result<(), LineError>
pub fn push(&mut self, ins: u8) -> Result<(), LineError>
Push an ascii character to the end of the line
Returns an error if the provided character would not fit, or if the character is invalid ascii or an ascii control character
sourcepub fn insert(&mut self, pos: usize, ins: u8) -> Result<(), LineError>
pub fn insert(&mut self, pos: usize, ins: u8) -> Result<(), LineError>
Insert an ascii character at the given position
Returns an error if the provided location would leave a gap (beyond the end of the current line), or if the given character is invalid ascii or an ascii control character, or if the line is already full