[][src]Trait shoebill::Doclike

pub trait Doclike<'p, P>: Sized where
    P: HasPrinter<'p>, 
{ fn alloc(self, pr: &mut P) -> DocPtr<'p>; fn concat(self, other: impl Doclike<'p, P>, pr: &mut P) -> DocPtr<'p> { ... }
fn nest(self, amt: u32, pr: &mut P) -> DocPtr<'p> { ... }
fn nest_line(
        self,
        other: impl Doclike<'p, P>,
        amt: u32,
        pr: &mut P
    ) -> DocPtr<'p> { ... }
fn nest_doc(
        self,
        other: impl Doclike<'p, P>,
        amt: u32,
        pr: &mut P
    ) -> DocPtr<'p> { ... }
fn nest_doc_zero(
        self,
        other: impl Doclike<'p, P>,
        amt: u32,
        pr: &mut P
    ) -> DocPtr<'p> { ... }
fn group(self, pr: &mut P) -> DocPtr<'p> { ... } }

Trait that defines items we can treat as Doc elements. We can use methods like alloc, concat, group, nest, etc. directly on types implementing Doclike.

Required methods

fn alloc(self, pr: &mut P) -> DocPtr<'p>

Generic over any Doclike, so you can use this for text as well.

Loading content...

Provided methods

fn concat(self, other: impl Doclike<'p, P>, pr: &mut P) -> DocPtr<'p>

fn nest(self, amt: u32, pr: &mut P) -> DocPtr<'p>

fn nest_line(
    self,
    other: impl Doclike<'p, P>,
    amt: u32,
    pr: &mut P
) -> DocPtr<'p>

fn nest_doc(
    self,
    other: impl Doclike<'p, P>,
    amt: u32,
    pr: &mut P
) -> DocPtr<'p>

fn nest_doc_zero(
    self,
    other: impl Doclike<'p, P>,
    amt: u32,
    pr: &mut P
) -> DocPtr<'p>

fn group(self, pr: &mut P) -> DocPtr<'p>

Loading content...

Implementors

impl<'p, A, P: HasPrinter<'p>> Doclike<'p, P> for A where
    Cow<'p, str>: From<A>, 
[src]

Anything that can be turned into a Cow string (a CowStr, a string slice, or an owned string) is Doclike.

impl<'p, P: HasPrinter<'p>> Doclike<'p, P> for Doc<'p>[src]

impl<'p, P: HasPrinter<'p>> Doclike<'p, P> for StrOrDoc<'p>[src]

StrOrDoc is doclike; in the case of a doc, you just get the doc back. In the case of a Cow string, we allocate defer to the implementation that's generic over any A such that A can become a Cow string

impl<'p, P: HasPrinter<'p>> Doclike<'p, P> for DocPtr<'p>[src]

Loading content...