[−][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 new<T: Into<InnerData>>(inner: T) -> Self
[src]
Create new data value
pub fn inner_data(&self) -> &InnerData
[src]
Get reference to the inner value
pub fn inner_data_mut(&mut self) -> &mut InnerData
[src]
Get reference to the inner value
pub fn into_inner(self) -> InnerData
[src]
Get reference to the inner value
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) -> Self
[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<Self>
[src]
Convert the data into a Result
pub fn clone_result(&self) -> Result<Self>
[src]
Clone this data into a new Result
pub fn to_result(&'a self) -> Result<&'a InnerData>
[src]
Retrieve a result with a reference to the underlying document
pub fn from_result(result: Result<InnerData>) -> Data
[src]
Trait Implementations
impl Clone for Data
[src]
impl Debug for Data
[src]
impl Deref for Data
[src]
type Target = InnerData
The resulting type after dereferencing.
pub fn deref(&self) -> &Self::Target
[src]
impl DerefMut for Data
[src]
impl Display for Data
[src]
impl<T: Into<InnerData>> From<T> for Data
[src]
impl From<TemplarError> for Data
[src]
pub fn from(error: TemplarError) -> Self
[src]
impl UnstructuredDataTrait for Data
[src]
type ErrorType = TemplarError
type OtherType = OtherData
Auto Trait Implementations
impl !RefUnwindSafe for Data
[src]
impl Send for Data
[src]
impl Sync for Data
[src]
impl Unpin for Data
[src]
impl !UnwindSafe for Data
[src]
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,
pub 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.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
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.
pub 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>,