Struct hexchat_unsafe_plugin::Strip
source · [−]pub struct Strip { /* private fields */ }
Expand description
Stripping mode for PluginHandle::strip
.
Implementations
sourceimpl Strip
impl Strip
sourcepub const fn new() -> Strip
pub const fn new() -> Strip
Creates a new Strip
that, by default, strips no attributes.
Examples
use hexchat_unsafe_plugin::{PluginHandle, Strip};
fn strip_nothing(s: &str, ph: &PluginHandle<'_>) -> String {
ph.strip(s, Strip::new())
}
sourcepub const fn colors(self, strip: bool) -> Self
pub const fn colors(self, strip: bool) -> Self
Sets whether to remove mIRC color attributes.
Examples
use hexchat_unsafe_plugin::{PluginHandle, Strip};
fn strip_colors(s: &str, ph: &PluginHandle<'_>) -> String {
ph.strip(s, Strip::new().colors(true))
}
sourcepub const fn formatting(self, strip: bool) -> Self
pub const fn formatting(self, strip: bool) -> Self
Sets whether to remove formatting attributes.
Examples
use hexchat_unsafe_plugin::{PluginHandle, Strip};
fn strip_formatting(s: &str, ph: &PluginHandle<'_>) -> String {
ph.strip(s, Strip::new().formatting(true))
}
Sets whether to remove internal “hidden text” formatting attributes.
This is split from Self::formatting
because these attributes are
only processed when writing directly to a buffer - they’re for
internal/plugin use. This tends to be useful when processing user or
remote input and writing it directly to a buffer.
Examples
use hexchat_unsafe_plugin::{PluginHandle, Strip};
fn strip_hidden(s: &str, ph: &PluginHandle<'_>) -> String {
ph.strip(s, Strip::new().hidden(true))
}
Trait Implementations
impl Copy for Strip
impl Eq for Strip
impl StructuralEq for Strip
impl StructuralPartialEq for Strip
Auto Trait Implementations
impl RefUnwindSafe for Strip
impl Send for Strip
impl Sync for Strip
impl Unpin for Strip
impl UnwindSafe for Strip
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more