pub struct Template<G: Html> { /* private fields */ }
Expand description
A single template in an app. Each template is comprised of a Sycamore view,
a state type, and some functions involved with generating that state. Pages
can then be generated from particular states. For instance, a single docs
template could have a state struct
that stores a title and some content,
which could then render as many pages as desired.
You can read more about the templates system here.
Note that all template states are passed around as String
s to avoid
type maps and other inefficiencies, since they need to be transmitted over
the network anyway. As such, this struct
is entirely state-agnostic,
since all the state-relevant functions merely return String
s. The
various proc macros used to annotate such functions (e.g.
#[perseus::build_state]
) perform serialization/deserialization
automatically for convenience.
Implementations
sourceimpl<G: Html> Template<G>
impl<G: Html> Template<G>
sourcepub fn new(path: impl Into<String> + Display) -> Self
pub fn new(path: impl Into<String> + Display) -> Self
Creates a new Template
. By default, this has absolutely no
associated data. If rendered, it would result in a blank screen.
sourcepub fn render_for_template_server<'a>(
&self,
props: PageProps,
cx: Scope<'a>,
translator: &Translator
) -> View<G>
pub fn render_for_template_server<'a>(
&self,
props: PageProps,
cx: Scope<'a>,
translator: &Translator
) -> View<G>
Executes the user-given function that renders the template on the server-side ONLY. This automatically initializes an isolated global state.
sourcepub fn render_head_str(&self, props: PageProps, translator: &Translator) -> String
pub fn render_head_str(&self, props: PageProps, translator: &Translator) -> String
Executes the user-given function that renders the document <head>
,
returning a string to be interpolated manually. Reactivity in this
function will not take effect due to this string rendering. Note that
this function will provide a translator context.
sourcepub async fn get_build_paths(&self) -> Result<Vec<String>, ServerError>
pub async fn get_build_paths(&self) -> Result<Vec<String>, ServerError>
Gets the list of templates that should be prerendered for at build-time.
sourcepub async fn get_build_state(
&self,
path: String,
locale: String
) -> Result<String, ServerError>
pub async fn get_build_state(
&self,
path: String,
locale: String
) -> Result<String, ServerError>
Gets the initial state for a template. This needs to be passed the full
path of the template, which may be one of those generated by
.get_build_paths()
. This also needs the locale being rendered to so
that more complex applications like custom documentation systems can
be enabled.
sourcepub async fn get_request_state(
&self,
path: String,
locale: String,
req: Request
) -> Result<String, ServerError>
pub async fn get_request_state(
&self,
path: String,
locale: String,
req: Request
) -> Result<String, ServerError>
Gets the request-time state for a template. This is equivalent to SSR,
and will not be performed at build-time. Unlike .get_build_paths()
though, this will be passed information about the request that triggered
the render. Errors here can be caused by either the server or the
client, so the user must specify an ErrorCause
. This is also passed
the locale being rendered to.
sourcepub async fn amalgamate_states(
&self,
path: String,
locale: String,
build_state: String,
request_state: String
) -> Result<String, ServerError>
pub async fn amalgamate_states(
&self,
path: String,
locale: String,
build_state: String,
request_state: String
) -> Result<String, ServerError>
Amalgamates given request and build states. Errors here can be caused by
either the server or the client, so the user must specify
an ErrorCause
.
This takes a separate build state and request state to ensure there are
no None
s for either of the states. This will only be called if both
states are generated.
sourcepub async fn should_revalidate(
&self,
path: String,
locale: String,
req: Request
) -> Result<bool, ServerError>
pub async fn should_revalidate(
&self,
path: String,
locale: String,
req: Request
) -> Result<bool, ServerError>
Checks, by the user’s custom logic, if this template should revalidate.
This function isn’t presently parsed anything, but has
network access etc., and can really do whatever it likes. Errors here
can be caused by either the server or the client, so the
user must specify an ErrorCause
.
sourcepub fn get_headers(&self, state: Option<String>) -> HeaderMap
pub fn get_headers(&self, state: Option<String>) -> HeaderMap
Gets the template’s headers for the given state. These will be inserted into any successful HTTP responses for this template, and they have the power to override.
sourcepub fn get_path(&self) -> String
pub fn get_path(&self) -> String
Gets the path of the template. This is the root path under which any generated pages will be served. In the simplest case, there will only be one page rendered, and it will occupy that root position.
Note that this will automatically transform index
to an empty string.
sourcepub fn get_revalidate_interval(&self) -> Option<ComputedDuration>
pub fn get_revalidate_interval(&self) -> Option<ComputedDuration>
Gets the interval after which the template will next revalidate.
sourcepub fn revalidates(&self) -> bool
pub fn revalidates(&self) -> bool
Checks if this template can revalidate existing prerendered templates.
sourcepub fn revalidates_with_time(&self) -> bool
pub fn revalidates_with_time(&self) -> bool
Checks if this template can revalidate existing prerendered templates after a given time.
sourcepub fn revalidates_with_logic(&self) -> bool
pub fn revalidates_with_logic(&self) -> bool
Checks if this template can revalidate existing prerendered templates based on some given logic.
sourcepub fn uses_incremental(&self) -> bool
pub fn uses_incremental(&self) -> bool
Checks if this template can render more templates beyond those paths it explicitly defines.
sourcepub fn uses_build_paths(&self) -> bool
pub fn uses_build_paths(&self) -> bool
Checks if this template is a template to generate paths beneath it.
sourcepub fn uses_request_state(&self) -> bool
pub fn uses_request_state(&self) -> bool
Checks if this template needs to do anything on requests for it.
sourcepub fn uses_build_state(&self) -> bool
pub fn uses_build_state(&self) -> bool
Checks if this template needs to do anything at build time.
sourcepub fn can_amalgamate_states(&self) -> bool
pub fn can_amalgamate_states(&self) -> bool
Checks if this template has custom logic to amalgamate build and request states if both are generated.
sourcepub fn is_basic(&self) -> bool
pub fn is_basic(&self) -> bool
Checks if this template defines no rendering logic whatsoever. Such templates will be rendered using SSG. Basic templates can still modify headers (which could hypothetically be using global state that’s dependent on server-side generation).
sourcepub fn template(
self,
val: impl Fn(Scope<'_>, PageProps) -> View<G> + Send + Sync + 'static
) -> Template<G>
pub fn template(
self,
val: impl Fn(Scope<'_>, PageProps) -> View<G> + Send + Sync + 'static
) -> Template<G>
Sets the template rendering function to use. This function might take in
some state (use the #[perseus::template_rx]
macro for serialization
convenience) and/or some global state, and then it must return a
Sycamore [View
].
sourcepub fn head(
self,
val: impl Fn(Scope<'_>, PageProps) -> View<SsrNode> + Send + Sync + 'static
) -> Template<G>
pub fn head(
self,
val: impl Fn(Scope<'_>, PageProps) -> View<SsrNode> + Send + Sync + 'static
) -> Template<G>
Sets the document <head>
rendering function to use. The [View
]
produced by this will only be rendered on the engine-side, and will
not be reactive (since it only contains metadata).
sourcepub fn set_headers_fn(
self,
val: impl Fn(Option<String>) -> HeaderMap + Send + Sync + 'static
) -> Template<G>
pub fn set_headers_fn(
self,
val: impl Fn(Option<String>) -> HeaderMap + Send + Sync + 'static
) -> Template<G>
Sets the function to set headers. This will override Perseus’ inbuilt header defaults.
sourcepub fn build_paths_fn(
self,
val: impl GetBuildPathsFnType + Send + Sync + 'static
) -> Template<G>
pub fn build_paths_fn(
self,
val: impl GetBuildPathsFnType + Send + Sync + 'static
) -> Template<G>
Enables the build paths strategy with the given function.
sourcepub fn incremental_generation(self) -> Template<G>
pub fn incremental_generation(self) -> Template<G>
Enables the incremental generation strategy.
sourcepub fn build_state_fn(
self,
val: impl GetBuildStateFnType + Send + Sync + 'static
) -> Template<G>
pub fn build_state_fn(
self,
val: impl GetBuildStateFnType + Send + Sync + 'static
) -> Template<G>
Enables the build state strategy with the given function.
sourcepub fn request_state_fn(
self,
val: impl GetRequestStateFnType + Send + Sync + 'static
) -> Template<G>
pub fn request_state_fn(
self,
val: impl GetRequestStateFnType + Send + Sync + 'static
) -> Template<G>
Enables the request state strategy with the given function.
sourcepub fn should_revalidate_fn(
self,
val: impl ShouldRevalidateFnType + Send + Sync + 'static
) -> Template<G>
pub fn should_revalidate_fn(
self,
val: impl ShouldRevalidateFnType + Send + Sync + 'static
) -> Template<G>
Enables the revalidation strategy (logic variant) with the given function.
sourcepub fn revalidate_after<I: PerseusDuration>(self, val: I) -> Template<G>
pub fn revalidate_after<I: PerseusDuration>(self, val: I) -> Template<G>
Enables the revalidation strategy (time variant). This takes a time
string of a form like 1w
for one week.
- s: second,
- m: minute,
- h: hour,
- d: day,
- w: week,
- M: month (30 days used here, 12M ≠ 1y!),
- y: year (365 days always, leap years ignored, if you want them add them as days)
sourcepub fn amalgamate_states_fn(
self,
val: impl AmalgamateStatesFnType + Send + Sync + 'static
) -> Template<G>
pub fn amalgamate_states_fn(
self,
val: impl AmalgamateStatesFnType + Send + Sync + 'static
) -> Template<G>
Enables state amalgamation with the given function. State amalgamation
allows you to have one template generate state at both build time
and request time. The function you provide here is responsible for
rationalizing the two into one single state to be sent to the client,
and this will be run just after the request state function
completes. See [States
] for further details.
Trait Implementations
Auto Trait Implementations
impl<G> !RefUnwindSafe for Template<G>
impl<G> Send for Template<G>
impl<G> Sync for Template<G>
impl<G> Unpin for Template<G>
impl<G> !UnwindSafe for Template<G>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> FmtForward for T
impl<T> FmtForward for T
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self
to use its Binary
implementation when Debug
-formatted.fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self
to use its Octal
implementation when Debug
-formatted.fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read morefn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read morefn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> Rwhere
Self: Borrow<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R
) -> Rwhere
Self: BorrowMut<B>,
B: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> Rwhere
Self: AsRef<U>,
U: 'a + ?Sized,
R: 'a,
self
, then passes self.as_ref()
into the pipe function.fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> Rwhere
Self: AsMut<U>,
U: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Deref<Target = T>,
T: 'a + ?Sized,
R: 'a,
self
, then passes self.deref()
into the pipe function.impl<T> PipeAsRef for T
impl<T> PipeAsRef for T
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: AsRef<T>,
T: 'a,
R: 'a,
fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: AsRef<T>,
T: 'a,
R: 'a,
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> Rwhere
Self: AsMut<T>,
T: 'a,
R: 'a,
fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> Rwhere
Self: AsMut<T>,
T: 'a,
R: 'a,
impl<T> PipeBorrow for T
impl<T> PipeBorrow for T
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Borrow<T>,
T: 'a,
R: 'a,
fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> Rwhere
Self: Borrow<T>,
T: 'a,
R: 'a,
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> Rwhere
Self: BorrowMut<T>,
T: 'a,
R: 'a,
fn pipe_borrow_mut<'a, T, R>(
&'a mut self,
func: impl FnOnce(&'a mut T) -> R
) -> Rwhere
Self: BorrowMut<T>,
T: 'a,
R: 'a,
impl<T> PipeDeref for T
impl<T> PipeDeref for T
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> Rwhere
Self: Deref,
R: 'a,
fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> Rwhere
Self: Deref,
R: 'a,
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> Rwhere
Self: DerefMut,
R: 'a,
fn pipe_deref_mut<'a, R>(
&'a mut self,
func: impl FnOnce(&'a mut Self::Target) -> R
) -> Rwhere
Self: DerefMut,
R: 'a,
impl<T> PipeRef for T
impl<T> PipeRef for T
impl<T> Tap for T
impl<T> Tap for T
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
Borrow<B>
of a value. Read morefn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
BorrowMut<B>
of a value. Read morefn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
AsRef<R>
view of a value. Read morefn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
AsMut<R>
view of a value. Read morefn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Selfwhere
Self: Deref<Target = T>,
T: ?Sized,
Deref::Target
of a value. Read morefn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Selfwhere
Self: DerefMut<Target = T> + Deref,
T: ?Sized,
Deref::Target
of a value. Read morefn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds. Read morefn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Selfwhere
Self: Borrow<B>,
B: ?Sized,
.tap_borrow()
only in debug builds, and is erased in release
builds. Read morefn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Selfwhere
Self: BorrowMut<B>,
B: ?Sized,
.tap_borrow_mut()
only in debug builds, and is erased in release
builds. Read morefn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Selfwhere
Self: AsRef<R>,
R: ?Sized,
.tap_ref()
only in debug builds, and is erased in release
builds. Read morefn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Selfwhere
Self: AsMut<R>,
R: ?Sized,
.tap_ref_mut()
only in debug builds, and is erased in release
builds. Read moreimpl<T> Tap for T
impl<T> Tap for T
fn tap<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
fn tap_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&Self) -> R,
tap
in debug builds, and does nothing in release builds.fn tap_mut<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
fn tap_mut_dbg<F, R>(self, func: F) -> Selfwhere
F: FnOnce(&mut Self) -> R,
tap_mut
in debug builds, and does nothing in release builds.impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
impl<T, U> TapAsRef<U> for Twhere
U: ?Sized,
fn tap_ref<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
fn tap_ref_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsRef<T>,
F: FnOnce(&T) -> R,
tap_ref
in debug builds, and does nothing in release builds.fn tap_ref_mut<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_ref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: AsMut<T>,
F: FnOnce(&mut T) -> R,
tap_ref_mut
in debug builds, and does nothing in release builds.impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
impl<T, U> TapBorrow<U> for Twhere
U: ?Sized,
fn tap_borrow<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow_dbg<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
fn tap_borrow_dbg<F, R>(self, func: F) -> Selfwhere
Self: Borrow<T>,
F: FnOnce(&T) -> R,
tap_borrow
in debug builds, and does nothing in release builds.fn tap_borrow_mut<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: BorrowMut<T>,
F: FnOnce(&mut T) -> R,
tap_borrow_mut
in debug builds, and does nothing in release
builds. Read moreimpl<T> TapDeref for T
impl<T> TapDeref for T
fn tap_deref<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
self
for inspection.fn tap_deref_dbg<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
fn tap_deref_dbg<F, R>(self, func: F) -> Selfwhere
Self: Deref,
F: FnOnce(&Self::Target) -> R,
tap_deref
in debug builds, and does nothing in release builds.fn tap_deref_mut<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
self
for modification.fn tap_deref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
fn tap_deref_mut_dbg<F, R>(self, func: F) -> Selfwhere
Self: DerefMut,
F: FnOnce(&mut Self::Target) -> R,
tap_deref_mut
in debug builds, and does nothing in release
builds. Read more