pub struct Run<'a> {
pub rsid_r: Option<Cow<'a, str>>,
pub rsid_r_default: Option<Cow<'a, str>>,
pub property: Option<CharacterProperty<'a>>,
pub content: Vec<RunContent<'a>>,
pub shall_destroy: Option<bool>,
}
Expand description
Run
Run is a non-block region of text with properties.
use docx::document::*;
use docx::formatting::*;
let run = Run::default()
.property(CharacterProperty::default())
.push_text("text")
.push_break(None)
.push_text((" text ", TextSpace::Preserve))
.push_break(BreakType::Column);
Fields
rsid_r: Option<Cow<'a, str>>
Specifies the properties of a run
rsid_r_default: Option<Cow<'a, str>>
property: Option<CharacterProperty<'a>>
Just as paragraph, a run’s properties is applied to all the contents of the run.
content: Vec<RunContent<'a>>
Specifies the content of a run
shall_destroy: Option<bool>
Implementations
sourceimpl<'a> Run<'a>
impl<'a> Run<'a>
pub fn property<T: Into<CharacterProperty<'a>>>(self, value: T) -> Self
pub fn shall_destroy<T: Into<bool>>(self, value: T) -> Self
pub fn push<T: Into<RunContent<'a>>>(self, content: T) -> Self
pub fn push_text<T: Into<Text<'a>>>(self, content: T) -> Self
pub fn push_break<T: Into<Break>>(self, br: T) -> Self
pub fn iter_text(&self) -> impl Iterator<Item = &Cow<'a, str>>
pub fn iter_text_mut(&mut self) -> impl Iterator<Item = &mut Cow<'a, str>>
pub fn replace_text_simple<S>(&mut self, old: S, new: S) where
S: AsRef<str>,
pub fn replace_text<'b, T, S>(&mut self, dic: T) -> DocxResult<()> where
S: AsRef<str> + 'b,
T: IntoIterator<Item = &'b (S, S)> + Copy,
Trait Implementations
sourceimpl<'a> From<Run<'a>> for ParagraphContent<'a>
impl<'a> From<Run<'a>> for ParagraphContent<'a>
sourcefn from(original: Run<'a>) -> ParagraphContent<'a>
fn from(original: Run<'a>) -> ParagraphContent<'a>
Converts to this type from the input type.
Auto Trait Implementations
impl<'a> RefUnwindSafe for Run<'a>
impl<'a> Send for Run<'a>
impl<'a> Sync for Run<'a>
impl<'a> Unpin for Run<'a>
impl<'a> UnwindSafe for Run<'a>
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