pub struct Stylist { /* private fields */ }
Expand description
A stylist is a builder of styles.
Implementations§
source§impl Stylist
impl Stylist
sourcepub fn py_with_reset() -> Self
pub fn py_with_reset() -> Self
Create a new style builder that has a reset token as first token.
sourcepub fn py_bold(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
pub fn py_bold(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
Add bold formatting to this style builder.
sourcepub fn py_thin(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
pub fn py_thin(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
Add thin formatting to this style builder.
sourcepub fn py_italic(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
pub fn py_italic(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
Add italic formatting to this style builder.
sourcepub fn py_underlined(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
pub fn py_underlined(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
Add underlined formatting to this style builder.
sourcepub fn py_blinking(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
pub fn py_blinking(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
Add blinking formatting to this style builder.
sourcepub fn py_reversed(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
pub fn py_reversed(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
Add reversed formatting to this style builder.
Add hidden formatting to this style builder.
sourcepub fn py_stricken(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
pub fn py_stricken(slf: PyRef<'_, Self>) -> PyRef<'_, Self>
Add stricken formatting to this style builder.
sourcepub fn py_embedded_rgb(slf: PyRef<'_, Self>, r: u8, g: u8, b: u8) -> Colorist
pub fn py_embedded_rgb(slf: PyRef<'_, Self>, r: u8, g: u8, b: u8) -> Colorist
Prepare the embedded RGB color.
pub fn py_foreground( slf: PyRef<'_, Self>, colorant: Colorant, ) -> PyRef<'_, Self>
sourcepub fn py_background(
slf: PyRef<'_, Self>,
colorant: Colorant,
) -> PyRef<'_, Self>
pub fn py_background( slf: PyRef<'_, Self>, colorant: Colorant, ) -> PyRef<'_, Self>
Add the background color to this style builder.
sourcepub fn et_voila(&self) -> Style
pub fn et_voila(&self) -> Style
Finish building and return a new style.
This method moves the builder’s data into the new style and leaves an empty builder behind.
sourcepub fn build(&self) -> Style
pub fn build(&self) -> Style
Finish building and return a new style.
This method moves the builder’s data into the new style and leaves an
empty builder behind. Consider using Stylist::et_voila
instead.
source§impl Stylist
impl Stylist
sourcepub fn with_reset() -> Self
pub fn with_reset() -> Self
Create a new style builder for a style that resets the terminal appearance.
sourcepub fn underlined(&self) -> &Self
pub fn underlined(&self) -> &Self
Add underlined formatting to this style builder.
Add hidden formatting to this style builder.
sourcepub fn embedded_rgb(&self, r: u8, g: u8, b: u8) -> Colorist
pub fn embedded_rgb(&self, r: u8, g: u8, b: u8) -> Colorist
Prepare an embedded RGB color.
If any of the given components is invalid, i.e., greater than 5, this method and the subsequent layer selection method will have no effect.
sourcepub fn gray(&self, level: u8) -> Colorist
pub fn gray(&self, level: u8) -> Colorist
Prepare a gray gradient.
If the given level is invalid, i.e., greater than 23, this method and the subsequent layer selection method will have no effect.
sourcepub fn rgb(&self, r: u8, g: u8, b: u8) -> Colorist
pub fn rgb(&self, r: u8, g: u8, b: u8) -> Colorist
Prepare a RGB color.
If any of the given components is invalid, i.e., greater than 5, this method and the subsequent layer selection method will have no effect.
sourcepub fn foreground(&self, color: impl Into<Colorant>) -> &Self
pub fn foreground(&self, color: impl Into<Colorant>) -> &Self
Add the foreground color to this style builder.
sourcepub fn background(&self, color: impl Into<Colorant>) -> &Self
pub fn background(&self, color: impl Into<Colorant>) -> &Self
Add the background color to this style builder.
Trait Implementations§
source§impl<'py> IntoPyObject<'py> for Stylist
impl<'py> IntoPyObject<'py> for Stylist
source§impl PyClassImpl for Stylist
impl PyClassImpl for Stylist
source§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
source§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
source§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
source§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
source§type ThreadChecker = ThreadCheckerImpl
type ThreadChecker = ThreadCheckerImpl
source§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::MutableChild
source§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny
by default, and when you declare
#[pyclass(extends=PyDict)]
, it’s PyDict
.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
source§impl PyClassNewTextSignature<Stylist> for PyClassImplCollector<Stylist>
impl PyClassNewTextSignature<Stylist> for PyClassImplCollector<Stylist>
fn new_text_signature(self) -> Option<&'static str>
source§impl PyMethods<Stylist> for PyClassImplCollector<Stylist>
impl PyMethods<Stylist> for PyClassImplCollector<Stylist>
fn py_methods(self) -> &'static PyClassItems
source§impl PyTypeInfo for Stylist
impl PyTypeInfo for Stylist
source§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object(py: Python<'_>) -> Bound<'_, PyType>
fn type_object(py: Python<'_>) -> Bound<'_, PyType>
§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
PyTypeInfo::type_object
PyTypeInfo::type_object
].§fn is_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type or a subclass of this type.§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_type_of
PyTypeInfo::is_type_of
].§fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of(object: &Bound<'_, PyAny>) -> bool
object
is an instance of this type.§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
PyTypeInfo::is_exact_type_of
PyTypeInfo::is_exact_type_of
].impl DerefToPyAny for Stylist
Auto Trait Implementations§
impl !Freeze for Stylist
impl !RefUnwindSafe for Stylist
impl Send for Stylist
impl !Sync for Stylist
impl Unpin for Stylist
impl UnwindSafe for Stylist
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> FromPyObject<'_> for Twhere
T: PyClass + Clone,
impl<T> FromPyObject<'_> for Twhere
T: PyClass + Clone,
§fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>
fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>
§impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
impl<'py, T> FromPyObjectBound<'_, 'py> for Twhere
T: FromPyObject<'py>,
§fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>
fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>
§impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
impl<'py, T> IntoPyObjectExt<'py> for Twhere
T: IntoPyObject<'py>,
§fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
fn into_bound_py_any(self, py: Python<'py>) -> Result<Bound<'py, PyAny>, PyErr>
self
into an owned Python object, dropping type information.§fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
fn into_py_any(self, py: Python<'py>) -> Result<Py<PyAny>, PyErr>
self
into an owned Python object, dropping type information and unbinding it
from the 'py
lifetime.§fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
fn into_pyobject_or_pyerr(self, py: Python<'py>) -> Result<Self::Output, PyErr>
self
into a Python object. Read more