[−][src]Struct templar::Data
The Data struct is used to represent the raw execution result of a node in a template.
Data can currently be in one of three states:
- Empty: The execution was successful but there was no result associated. For example, value assignments (x = y)
- Success: The document data can be safely retrieved
- Failure: An error occurred executing this node
Implementations
impl<'a> Data[src]
pub fn empty() -> Data[src]
Create a new empty result
pub fn render(self) -> Result<String>[src]
Render this result
If the data is empty, an empty string is returned. If this data is in an error state, the error is returned Otherwise, the rendered string is returned
pub fn is_failed(&self) -> bool[src]
Check if this data struct has a failure
pub fn is_empty(&self) -> bool[src]
Check if this data struct is empty
pub fn unwrap(self) -> Document[src]
pub fn unwrap_err(self) -> TemplarError[src]
Unwrap the data error
PANIC!
This will panic if this data struct is empty or does not contain an error
pub fn into_result(self) -> Result<Document>[src]
Convert the data into a Result
pub fn clone_result(&self) -> Result<Document>[src]
Clone this data into a new Result
pub fn to_result(&'a self) -> Result<&'a Document>[src]
Retrieve a result with a reference to the underlying document
pub fn from_result(result: Result<Document>) -> Data[src]
Create Data from a result
Trait Implementations
impl Clone for Data[src]
impl Debug for Data[src]
impl<T: Into<Document>> From<T> for Data[src]
impl From<TemplarError> for Data[src]
fn from(error: TemplarError) -> Self[src]
Auto Trait Implementations
impl !RefUnwindSafe for Data
impl Send for Data
impl Sync for Data
impl Unpin for Data
impl !UnwindSafe for Data
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone, [src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T[src]
fn clone_into(&self, target: &mut T)[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,