Struct prettytable::Cell [−][src]
Represent a table cell containing a string.
Once created, a cell’s content cannot be modified. The cell would have to be replaced by another one
Implementations
impl Cell
[src]
pub fn new_align(string: &str, align: Alignment) -> Cell
[src]
Create a new Cell
initialized with content from string
.
Text alignment in cell is configurable with the align
argument
pub fn new(string: &str) -> Cell
[src]
Create a new Cell
initialized with content from string
.
By default, content is align to LEFT
pub fn align(&mut self, align: Alignment)
[src]
Set text alignment in the cell
pub fn style(&mut self, attr: Attr)
[src]
Add a style attribute to the cell
pub fn with_style(self, attr: Attr) -> Cell
[src]
Add a style attribute to the cell. Can be chained
pub fn with_hspan(self, hspan: usize) -> Cell
[src]
Add horizontal spanning to the cell
pub fn reset_style(&mut self)
[src]
Remove all style attributes and reset alignment to default (LEFT)
pub fn style_spec(self, spec: &str) -> Cell
[src]
Set the cell’s style by applying the given specifier string
Style spec syntax
The syntax for the style specifier looks like this : FrBybl which means Foreground red Background yellow bold left
List of supported specifiers :
- F : Foreground (must be followed by a color specifier)
- B : Background (must be followed by a color specifier)
- H : Horizontal span (must be followed by a number)
- b : bold
- i : italic
- u : underline
- c : Align center
- l : Align left
- r : Align right
- d : default style
List of color specifiers :
- r : Red
- b : Blue
- g : Green
- y : Yellow
- c : Cyan
- m : Magenta
- w : White
- d : Black
And capital letters are for bright colors. Eg :
- R : Bright Red
- B : Bright Blue
- … and so on …
pub fn set_hspan(&mut self, hspan: usize)
[src]
Set horizontal span for this cell (must be > 0)
pub fn get_hspan(&self) -> usize
[src]
Get horizontal span of this cell (> 0)
pub fn get_content(&self) -> String
[src]
Return a copy of the full string contained in the cell
pub fn print_html<T: Write + ?Sized>(&self, out: &mut T) -> Result<usize, Error>
[src]
Print the cell in HTML format to out
.
Trait Implementations
impl Clone for Cell
[src]
impl Debug for Cell
[src]
impl Default for Cell
[src]
impl Eq for Cell
[src]
impl<'a, T: ToString> From<&'a T> for Cell
[src]
impl Hash for Cell
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl PartialEq<Cell> for Cell
[src]
impl StructuralEq for Cell
[src]
impl StructuralPartialEq for Cell
[src]
impl ToString for Cell
[src]
Auto Trait Implementations
impl RefUnwindSafe for Cell
impl Send for Cell
impl Sync for Cell
impl Unpin for Cell
impl UnwindSafe for Cell
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,