Struct termimad::StrFit [−][src]
pub struct StrFit { /* fields omitted */ }
Expand description
information about the fitting of a string into a given width in cols.
The implementation here properly takes into account the width of special characters.
Backspaces are considered as having a width of -1.
This implementation is based on a replacement of the tab character.
Implementations
impl StrFit
[src]
impl StrFit
[src]pub fn from(s: &str, cols_max: usize) -> Self
[src]
pub fn count_fitting(s: &str, cols_max: usize) -> (usize, usize)
[src]
pub fn count_fitting(s: &str, cols_max: usize) -> (usize, usize)
[src]return the counts in bytes and columns of the longest substring fitting the given number of columns
pub fn make_string(s: &str, cols_max: usize) -> (String, usize)
[src]
pub fn make_string(s: &str, cols_max: usize) -> (String, usize)
[src]return both the longest fitting string and the number of cols it takes on screen. We don’t build a string around the whole str, which could be costly if it’s very big
pub fn make_cow<'a>(s: &'a str, cols_max: usize) -> (Cow<'a, str>, usize)
[src]
pub fn make_cow<'a>(s: &'a str, cols_max: usize) -> (Cow<'a, str>, usize)
[src]return both the longest fitting string and the number of cols it takes on screen. We don’t build a string around the whole str, which could be costly if it’s very big In case there’s no tab in the input string, we can return a pointer over part of the original str)
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for StrFit
impl Send for StrFit
impl Sync for StrFit
impl Unpin for StrFit
impl UnwindSafe for StrFit
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more