pub struct TemplateEngineServiceProvider { /* private fields */ }Expand description
Adds the package’s settings, its migration, its command and the application’s filters.
Implementations§
Source§impl TemplateEngineServiceProvider
impl TemplateEngineServiceProvider
Sourcepub fn image(self, name: impl Into<String>, bytes: impl Into<Vec<u8>>) -> Self
pub fn image(self, name: impl Into<String>, bytes: impl Into<Vec<u8>>) -> Self
Lets templates show the picture bytes with <img src="name">: in PDFs, in HTML
documents, in previews, and in emails as an attached picture.
let provider = TemplateEngineServiceProvider::new().image("logo", logo);§Panics
When name has characters other than letters, digits, ., - and _, or bytes
aren’t a PNG, JPEG or GIF.
Sourcepub fn layout(self, name: impl Into<String>, source: impl Into<String>) -> Self
pub fn layout(self, name: impl Into<String>, source: impl Into<String>) -> Self
Adds a layout templates can choose: shared HTML, such as a header, a footer and styles,
with {{ content }} where a template’s text goes. It also sees subject and locale.
let provider = TemplateEngineServiceProvider::new().layout(
"brand",
r#"<style>h1 { color: #0a6 }</style><img src="logo">{{ content }}<p>Acme Ltd.</p>"#,
);§Panics
When source isn’t a valid template or doesn’t use content.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TemplateEngineServiceProvider
impl !UnwindSafe for TemplateEngineServiceProvider
impl Forget for TemplateEngineServiceProvider
impl Freeze for TemplateEngineServiceProviderwhere
*const u8 is !null: Freeze,
PhantomData<Filter>: Freeze,
PhantomData<Image>: Freeze,
PhantomData<Font>: Freeze,
PhantomData<Layout>: Freeze,
PhantomData<Channel>: Freeze,
impl Move for TemplateEngineServiceProvider
impl Send for TemplateEngineServiceProvider
impl Sync for TemplateEngineServiceProvider
impl Unpin for TemplateEngineServiceProvider
impl UnsafeUnpin for TemplateEngineServiceProviderwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Filter>: UnsafeUnpin,
PhantomData<Image>: UnsafeUnpin,
PhantomData<Font>: UnsafeUnpin,
PhantomData<Layout>: UnsafeUnpin,
PhantomData<Channel>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<K> ForeignKey<K> for K
impl<K> ForeignKey<K> for K
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more