[−][src]Struct genpdf::style::StyledString
A String
with a Style
annotation.
Example
use genpdf::style; let ss1 = style::StyledString::new("bold".to_owned(), style::Effect::Bold); let ss2 = style::StyledString::new("red".to_owned(), style::Color::Rgb(255, 0, 0));
Fields
s: String
The annotated string.
style: Style
The style annotation.
Implementations
impl StyledString
[src]
pub fn new(s: impl Into<String>, style: impl Into<Style>) -> StyledString
[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 Clone for StyledString
[src]
fn clone(&self) -> StyledString
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for StyledString
[src]
impl Default for StyledString
[src]
fn default() -> StyledString
[src]
impl<'a> From<&'a String> for StyledString
[src]
fn from(s: &'a String) -> StyledString
[src]
impl<'a> From<&'a str> for StyledString
[src]
fn from(s: &'a str) -> StyledString
[src]
impl<'s> From<&'s StyledString> for StyledStr<'s>
[src]
fn from(s: &'s StyledString) -> StyledStr<'s>
[src]
impl From<String> for StyledString
[src]
fn from(s: String) -> StyledString
[src]
Auto Trait Implementations
impl RefUnwindSafe for StyledString
impl Send for StyledString
impl Sync for StyledString
impl Unpin for StyledString
impl UnwindSafe for StyledString
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>,