[][src]Struct jens::Block

pub struct Block(pub Vec<Line>);

A Block is one or many lines of text. More blocks can be embedded within a line, in which case the indentation of the previous line will be preserved when outputting new lines.

Methods

impl Block[src]

pub fn empty() -> Self[src]

pub fn write_to(&self, f: &mut Formatter, prefix: &str) -> Result[src]

pub fn set<T: Into<Block>>(self, placeholder_name: &str, content: T) -> Self[src]

pub fn join_map<T, U, F>(iter: T, mapper: F) -> Self where
    T: IntoIterator<Item = U>,
    F: Fn(U, IteratorLocation) -> Block
[src]

Run a function that maps over each item in an iterator, then join the results.

Provides an IteratorLocation for checking whether the current item is the first/last/only/nth item in the list.

pub fn for_each<T, U, F>(self, iter: T, mapper: F) -> Self where
    T: IntoIterator<Item = U>,
    F: Fn(U, Block) -> Block
[src]

Deprecated

Repeat a template for each element of some iterable value.

Deprecated in favor of join_map.

pub fn join<T>(blocks: T) -> Block where
    T: IntoIterator<Item = Block>, 
[src]

Join multiple blocks into a single block

Trait Implementations

impl<'_> From<&'_ Block> for String[src]

impl<T: Into<String>> From<T> for Block[src]

impl Clone for Block[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl PartialEq<Block> for Block[src]

impl Debug for Block[src]

impl Display for Block[src]

Auto Trait Implementations

impl Send for Block

impl Sync for Block

Blanket Implementations

impl<T> From for T[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.