Skip to main content

LiteralBlock

Struct LiteralBlock 

Source
pub(crate) struct LiteralBlock<'a>(&'a str);
Expand description

Text for a | block scalar.

Tuple Fields§

§0: &'a str

Implementations§

Source§

impl<'a> LiteralBlock<'a>

Source

pub(crate) const fn new(text: &'a str) -> Self

Source

pub(crate) fn is_representable(&self) -> bool

Whether a block scalar reproduces the text exactly.

Control characters other than line feeds, and line separators, have no faithful block form. A tab is fine inside a line but not at its start. Text of only line feeds has none either. Empty text is |- with no lines.

Source

pub(super) fn header(&self) -> String

The header, such as |-, |+, or |2.

The indicator is needed when the first line is empty or starts with a space.

Content is written two columns deeper than the node that owns the scalar, so the indicator is always 2.

Source

pub(super) fn lines(&self) -> impl Iterator<Item = &str>

The content lines, followed by the empty lines that keep chomping needs.

Source

fn trailing_newlines(&self) -> usize

Auto Trait Implementations§

§

impl<'a> Freeze for LiteralBlock<'a>

§

impl<'a> RefUnwindSafe for LiteralBlock<'a>

§

impl<'a> Send for LiteralBlock<'a>

§

impl<'a> Sync for LiteralBlock<'a>

§

impl<'a> Unpin for LiteralBlock<'a>

§

impl<'a> UnsafeUnpin for LiteralBlock<'a>

§

impl<'a> UnwindSafe for LiteralBlock<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.