pub struct Pen {
pub style: Style,
pub link: Option<Arc<Link>>,
}Expand description
Visual style and optional OSC 8 hyperlink for a text paint operation.
Use Pen::new to start empty, then add a style or a shared link with
Pen::with_style and Pen::with_link. Any value that converts
into Style also converts to Pen. Link and Arc<Link> values
convert directly.
use std::sync::Arc;
use uncurses::buffer::{Surface, TextBuffer};
use uncurses::style::{Link, Style};
use uncurses::text::{Pen, TextSurface};
let mut buffer = TextBuffer::new(8, 1);
let link = Arc::new(Link {
url: "https://example.test".into(),
params: String::new(),
});
buffer.set_str(
(0, 0),
"docs",
Pen::new()
.with_style(Style::new().underline())
.with_link(link),
);
assert_eq!(
buffer.cell((0, 0).into()).unwrap().link().unwrap().url,
"https://example.test"
);Fields§
§style: StyleVisual SGR state for painted cells.
link: Option<Arc<Link>>Shared OSC 8 link for painted cells.
Implementations§
Trait Implementations§
impl Eq for Pen
impl StructuralPartialEq for Pen
Auto Trait Implementations§
impl Freeze for Pen
impl RefUnwindSafe for Pen
impl Send for Pen
impl Sync for Pen
impl Unpin for Pen
impl UnsafeUnpin for Pen
impl UnwindSafe for Pen
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
Mutably borrows from an owned value. Read more