Skip to main content

Empty

Struct Empty 

Source
pub struct Empty;
Expand description

A variable that was never given a value.

Handlebars treats an undefined variable as empty, and so does this: Empty writes nothing when displayed, and stands in for a list with no items. Generated code uses it; you should never need to name it.

Trait Implementations§

Source§

impl<T> AsRef<[T]> for Empty

Source§

fn as_ref(&self) -> &[T]

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl Display for Empty

Source§

fn fmt(&self, _: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Length for Empty

A variable that was never set is absent, and absent has no count — {{ rows.length }} writes nothing, rather than 0, exactly as it does for an undefined value in handlebars.js.

Source§

type Count = Empty

What the count renders as: a number, or nothing at all when the list was never set.
Source§

fn length(&self) -> Empty

How many items this holds.
Source§

impl Truthy for Empty

A variable that was never set is absent, and absent is falsy.

Source§

fn is_truthy(&self) -> bool

Whether {{#if}} should render its block for this value.

Auto Trait Implementations§

§

impl Freeze for Empty

§

impl RefUnwindSafe for Empty

§

impl Send for Empty

§

impl Sync for Empty

§

impl Unpin for Empty

§

impl UnsafeUnpin for Empty

§

impl UnwindSafe for Empty

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> Render<ViaDisplay> for T
where T: Display + ?Sized,

Source§

fn render_to<W>(&self, out: &mut W) -> Result<(), Error>
where W: Write + ?Sized,

Writes this value into out, unescaped.
Source§

impl<T, K> RenderExt<K> for T
where T: Render<K> + ?Sized,

Source§

fn shown(&self) -> Shown<'_, Self, K>

Wraps this value for {{{ }}}: written exactly as given.
Source§

fn escaped(&self) -> Escaped<'_, Self, K>

Wraps this value for {{ }}: written HTML-escaped.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = Infallible

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.