pub struct JsAssetOptions { /* private fields */ }
Expand description
Options for a javascript asset
Implementations§
Source§impl JsAssetOptions
impl JsAssetOptions
Sourcepub const fn new() -> JsAssetOptions
pub const fn new() -> JsAssetOptions
Create a new js asset builder
Sourcepub const fn with_minify(self, minify: bool) -> JsAssetOptions
pub const fn with_minify(self, minify: bool) -> JsAssetOptions
Sets whether the js should be minified (default: true)
Minifying the js can make your site load faster by loading less data
const _: Asset = asset!("/assets/script.js", JsAssetOptions::new().with_minify(false));
Sourcepub const fn with_preload(self, preload: bool) -> JsAssetOptions
pub const fn with_preload(self, preload: bool) -> JsAssetOptions
Make the asset preloaded
Preloading the javascript will make the javascript start to load as soon as possible. This is useful for javascript that will be used soon after the page loads or javascript that may not be used immediately, but should start loading sooner
const _: Asset = asset!("/assets/script.js", JsAssetOptions::new().with_preload(true));
Sourcepub const fn into_asset_options(self) -> AssetOptions
pub const fn into_asset_options(self) -> AssetOptions
Convert the options into options for a generic asset
Trait Implementations§
Source§impl Clone for JsAssetOptions
impl Clone for JsAssetOptions
Source§fn clone(&self) -> JsAssetOptions
fn clone(&self) -> JsAssetOptions
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for JsAssetOptions
impl Debug for JsAssetOptions
Source§impl Default for JsAssetOptions
impl Default for JsAssetOptions
Source§fn default() -> JsAssetOptions
fn default() -> JsAssetOptions
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for JsAssetOptions
impl<'de> Deserialize<'de> for JsAssetOptions
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<JsAssetOptions, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<JsAssetOptions, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for JsAssetOptions
impl Hash for JsAssetOptions
Source§impl PartialEq for JsAssetOptions
impl PartialEq for JsAssetOptions
Source§impl PartialOrd for JsAssetOptions
impl PartialOrd for JsAssetOptions
Source§impl Serialize for JsAssetOptions
impl Serialize for JsAssetOptions
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl SerializeConst for JsAssetOptions
impl SerializeConst for JsAssetOptions
impl Copy for JsAssetOptions
impl StructuralPartialEq for JsAssetOptions
Auto Trait Implementations§
impl Freeze for JsAssetOptions
impl RefUnwindSafe for JsAssetOptions
impl Send for JsAssetOptions
impl Sync for JsAssetOptions
impl Unpin for JsAssetOptions
impl UnwindSafe for JsAssetOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> InitializeFromFunction<T> for T
impl<T> InitializeFromFunction<T> for T
Source§fn initialize_from_function(f: fn() -> T) -> T
fn initialize_from_function(f: fn() -> T) -> T
Create an instance of this type from an initialization function
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<Ret> SpawnIfAsync<(), Ret> for Ret
impl<Ret> SpawnIfAsync<(), Ret> for Ret
Source§impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
impl<T, O> SuperFrom<T> for Owhere
O: From<T>,
Source§fn super_from(input: T) -> O
fn super_from(input: T) -> O
Convert from a type to another type.
Source§impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
impl<T, O, M> SuperInto<O, M> for Twhere
O: SuperFrom<T, M>,
Source§fn super_into(self) -> O
fn super_into(self) -> O
Convert from a type to another type.