pub struct AssetConfig { /* private fields */ }Expand description
Overrides for PHP’s core AdminLTE asset locations.
A missing location uses the shipped preset. An explicit JSON null disables that location.
use oxblade_adminlte::AssetConfig;
let config: AssetConfig = serde_json::from_str(r#"{"mode":"cdn"}"#)?;
assert_eq!(config.version("v4.10.4"), "4.10");Implementations§
Source§impl AssetConfig
impl AssetConfig
Sourcepub fn version<'a>(&'a self, distribution: &'a str) -> &'a str
pub fn version<'a>(&'a self, distribution: &'a str) -> &'a str
Version used by the PHP placeholder. An override wins, else use the installed release line.
let config = oxblade_adminlte::AssetConfig::default();
assert_eq!(config.version("v4.10.4"), "4.10");Sourcepub fn resolve(
&self,
key: &str,
rtl: bool,
distribution: &str,
host: &impl AssetHost,
) -> Result<Option<SafeUrl>, Error>
pub fn resolve( &self, key: &str, rtl: bool, distribution: &str, host: &impl AssetHost, ) -> Result<Option<SafeUrl>, Error>
Resolves one PHP asset key, with RTL selection and local/CDN fallback.
let url = AssetConfig::default().resolve("adminlte_css", false, "4.10.4", &Public)?;
assert!(url.is_some());Trait Implementations§
Source§impl Clone for AssetConfig
impl Clone for AssetConfig
Source§impl Debug for AssetConfig
impl Debug for AssetConfig
Source§impl Default for AssetConfig
impl Default for AssetConfig
Source§impl<'de> Deserialize<'de> for AssetConfigwhere
AssetConfig: Default,
impl<'de> Deserialize<'de> for AssetConfigwhere
AssetConfig: Default,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Forget for AssetConfig
impl Freeze for AssetConfigwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Value>: Freeze,
PhantomData<usize>: Freeze,
PhantomData<Bucket<String, Value>>: Freeze,
*const LeafNode<String, Option<String>> is !null: Freeze,
PhantomData<(Owned, LeafOrInternal)>: Freeze,
PhantomData<Box<(String, Option<String>)>>: Freeze,
impl Move for AssetConfig
impl RefUnwindSafe for AssetConfig
impl Send for AssetConfig
impl Sync for AssetConfig
impl Unpin for AssetConfig
impl UnsafeUnpin for AssetConfigwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
PhantomData<Bucket<String, Value>>: UnsafeUnpin,
*const LeafNode<String, Option<String>> is !null: UnsafeUnpin,
PhantomData<(Owned, LeafOrInternal)>: UnsafeUnpin,
PhantomData<Box<(String, Option<String>)>>: UnsafeUnpin,
impl UnwindSafe for AssetConfigwhere
RawVecInner: UnwindSafe,
NonNull<u8>: UnwindSafe,
BTreeMap<String, Option<String>>: 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
Mutably borrows from an owned value. Read more