[−][src]Struct genpdf::style::StyledStr
A &str
with a Style
annotation.
Example
use genpdf::style; let ss1 = style::StyledStr::new("bold", style::Effect::Bold); let ss2 = style::StyledStr::new("red", style::Color::Rgb(255, 0, 0));
Fields
s: &'s str
The annotated string.
style: Style
The style annotation.
Implementations
impl<'s> StyledStr<'s>
[src]
pub fn new(s: &'s str, style: impl Into<Style>) -> StyledStr<'s>
[src]
Creates a new styled string from the given string and style.
pub fn width(&self, font_cache: &FontCache) -> Mm
[src]
Calculates the width of the this string with this style using the data in the given font cache.
If the font family is set for the style, it must have been created by the given
FontCache
.
Trait Implementations
impl<'s> Clone for StyledStr<'s>
[src]
impl<'s> Debug for StyledStr<'s>
[src]
impl<'s> Default for StyledStr<'s>
[src]
impl<'s> From<&'s String> for StyledStr<'s>
[src]
impl<'s> From<&'s StyledString> for StyledStr<'s>
[src]
fn from(s: &'s StyledString) -> StyledStr<'s>
[src]
impl<'s> From<&'s str> for StyledStr<'s>
[src]
Auto Trait Implementations
impl<'s> RefUnwindSafe for StyledStr<'s>
impl<'s> Send for StyledStr<'s>
impl<'s> Sync for StyledStr<'s>
impl<'s> Unpin for StyledStr<'s>
impl<'s> UnwindSafe for StyledStr<'s>
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,
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.
fn to_owned(&self) -> T
[src]
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.
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>,