pub struct TemplateEngineConfig {
pub locale: String,
pub currency: String,
pub queue_connection: Option<String>,
pub queue: Option<String>,
pub fuel: u64,
pub max_output: usize,
pub timeout_ms: u64,
pub max_depth: usize,
pub max_length: usize,
pub test_prefix: String,
}Expand description
The package’s settings, read from the environment. Every one has a default, so nothing needs
to be set. An application changes them in with_config:
use laravel_template_engine::TemplateEngineConfig;
Application::configure().with_config(|config, _| {
config.section_mut::<TemplateEngineConfig>().locale = "uk".into();
})Fields§
§locale: StringThe language used when a recipient’s language has no text in the template.
currency: StringThe currency | money uses when a template doesn’t name one.
queue_connection: Option<String>The queue connection messages go through. Empty means the application’s default.
queue: Option<String>The queue messages go on. Empty means the connection’s default.
fuel: u64How much work one render may do: roughly the number of steps, loop iterations included.
max_output: usizeThe most bytes one render may write.
timeout_ms: u64The longest one render may take, in milliseconds.
max_depth: usizeHow deeply if and for blocks may nest.
max_length: usizeThe most characters a template’s text may have.
test_prefix: StringWhat a test send puts in front of the subject.
Implementations§
Source§impl TemplateEngineConfig
impl TemplateEngineConfig
Sourcepub fn from_env(env: &Env) -> Self
pub fn from_env(env: &Env) -> Self
Read the section from the environment, starting from its defaults.
| Field | Variable | Default |
|---|---|---|
locale | TEMPLATE_ENGINE_LOCALE | "en".to_owned() |
currency | TEMPLATE_ENGINE_CURRENCY | "USD".to_owned() |
queue_connection | TEMPLATE_ENGINE_QUEUE_CONNECTION | none |
queue | TEMPLATE_ENGINE_QUEUE | none |
fuel | TEMPLATE_ENGINE_FUEL | 2_000_000 |
max_output | TEMPLATE_ENGINE_MAX_OUTPUT | 2 * 1024 * 1024 |
timeout_ms | TEMPLATE_ENGINE_TIMEOUT_MS | 2_000 |
max_depth | TEMPLATE_ENGINE_MAX_DEPTH | 10 |
max_length | TEMPLATE_ENGINE_MAX_LENGTH | 200_000 |
test_prefix | TEMPLATE_ENGINE_TEST_PREFIX | "[Test] ".to_owned() |
from_env records invalid values and missing required values in env. Those problems
stop the application from starting.
Trait Implementations§
Source§impl Clone for TemplateEngineConfig
impl Clone for TemplateEngineConfig
Source§impl Debug for TemplateEngineConfig
impl Debug for TemplateEngineConfig
Auto Trait Implementations§
impl Forget for TemplateEngineConfig
impl Freeze for TemplateEngineConfig
impl Move for TemplateEngineConfig
impl RefUnwindSafe for TemplateEngineConfig
impl Send for TemplateEngineConfigwhere
RawVecInner: Send,
impl Sync for TemplateEngineConfigwhere
RawVecInner: Sync,
impl Unpin for TemplateEngineConfig
impl UnsafeUnpin for TemplateEngineConfig
impl UnwindSafe for TemplateEngineConfigwhere
RawVecInner: UnwindSafe,
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
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> ⓘ
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> ⓘ
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