Remove dioxus-lib, fix doc imports (#4438)
* remove dioxus lib * inline some doc items * fix tests * test docs * Fix doc tests * Pull out dioxus/lib feature * disable logger and devtools in library feature * fix cargo doc * fix cargo doc
This commit is contained in:
1 parent
4cb32d372b
commit
98f7667fb4
59 files changed
+216
-530
No files matched your search
@@ -54,7 +54,7 @@ impl AssetOptions {
|
||||
/// Create a new css asset builder
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, CssAssetOptions};
|
||||
/// # use manganis::{asset, Asset, AssetOptions};
|
||||
/// const _: Asset = asset!("/assets/style.css", AssetOptions::css());
|
||||
/// ```
|
||||
pub const fn css() -> AssetOptionsBuilder<CssAssetOptions> {
|
||||
@@ -68,7 +68,7 @@ impl AssetOptionsBuilder<CssAssetOptions> {
|
||||
/// Minifying the css can make your site load faster by loading less data
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, CssAssetOptions};
|
||||
/// # use manganis::{asset, Asset, AssetOptions};
|
||||
/// const _: Asset = asset!("/assets/style.css", AssetOptions::css().with_minify(false));
|
||||
/// ```
|
||||
pub const fn with_minify(mut self, minify: bool) -> Self {
|
||||
@@ -81,7 +81,7 @@ impl AssetOptionsBuilder<CssAssetOptions> {
|
||||
/// Preloading css will make the image start to load as soon as possible. This is useful for css that is used soon after the page loads or css that may not be used immediately, but should start loading sooner
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, CssAssetOptions};
|
||||
/// # use manganis::{asset, Asset, AssetOptions};
|
||||
/// const _: Asset = asset!("/assets/style.css", AssetOptions::css().with_preload(true));
|
||||
/// ```
|
||||
pub const fn with_preload(mut self, preload: bool) -> Self {
|
||||
|
||||
@@ -57,7 +57,7 @@ impl AssetOptions {
|
||||
/// Create a new css module asset builder
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, CssModuleAssetOptions};
|
||||
/// # use manganis::{asset, Asset, AssetOptions};
|
||||
/// const _: Asset = asset!("/assets/style.css", AssetOptions::css_module());
|
||||
/// ```
|
||||
pub const fn css_module() -> AssetOptionsBuilder<CssModuleAssetOptions> {
|
||||
|
||||
@@ -127,7 +127,7 @@ impl AssetOptions {
|
||||
/// Create a new image asset builder
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, ImageAssetOptions};
|
||||
/// # use manganis::{asset, Asset, AssetOptions};
|
||||
/// const _: Asset = asset!("/assets/image.png", AssetOptions::image());
|
||||
/// ```
|
||||
pub const fn image() -> AssetOptionsBuilder<ImageAssetOptions> {
|
||||
@@ -141,7 +141,7 @@ impl AssetOptionsBuilder<ImageAssetOptions> {
|
||||
/// Preloading an image will make the image start to load as soon as possible. This is useful for images that will be displayed soon after the page loads or images that may not be visible immediately, but should start loading sooner
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, ImageAssetOptions};
|
||||
/// # use manganis::{asset, Asset, AssetOptions};
|
||||
/// const _: Asset = asset!("/assets/image.png", AssetOptions::image().with_preload(true));
|
||||
/// ```
|
||||
pub const fn with_preload(mut self, preload: bool) -> Self {
|
||||
@@ -154,7 +154,7 @@ impl AssetOptionsBuilder<ImageAssetOptions> {
|
||||
/// Choosing the right format can make your site load much faster. Webp and avif images tend to be a good default for most images
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, ImageAssetOptions, ImageFormat};
|
||||
/// # use manganis::{asset, Asset, AssetOptions, ImageFormat};
|
||||
/// const _: Asset = asset!("/assets/image.png", AssetOptions::image().with_format(ImageFormat::Webp));
|
||||
/// ```
|
||||
pub const fn with_format(mut self, format: ImageFormat) -> Self {
|
||||
@@ -168,7 +168,7 @@ impl AssetOptionsBuilder<ImageAssetOptions> {
|
||||
/// they compress images well
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, ImageAssetOptions, ImageFormat};
|
||||
/// # use manganis::{asset, Asset, AssetOptions, ImageFormat};
|
||||
/// const _: Asset = asset!("/assets/image.png", AssetOptions::image().with_avif());
|
||||
/// ```
|
||||
pub const fn with_avif(self) -> Self {
|
||||
@@ -181,7 +181,7 @@ impl AssetOptionsBuilder<ImageAssetOptions> {
|
||||
/// they compress images well
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, ImageAssetOptions, ImageFormat};
|
||||
/// # use manganis::{asset, Asset, AssetOptions, ImageFormat};
|
||||
/// const _: Asset = asset!("/assets/image.png", AssetOptions::image().with_webp());
|
||||
/// ```
|
||||
pub const fn with_webp(self) -> Self {
|
||||
@@ -193,7 +193,7 @@ impl AssetOptionsBuilder<ImageAssetOptions> {
|
||||
/// Jpeg images compress much better than [`ImageFormat::Png`], but worse than [`ImageFormat::Webp`] or [`ImageFormat::Avif`]
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, ImageAssetOptions, ImageFormat};
|
||||
/// # use manganis::{asset, Asset, AssetOptions, ImageFormat};
|
||||
/// const _: Asset = asset!("/assets/image.png", AssetOptions::image().with_jpg());
|
||||
/// ```
|
||||
pub const fn with_jpg(self) -> Self {
|
||||
@@ -205,7 +205,7 @@ impl AssetOptionsBuilder<ImageAssetOptions> {
|
||||
/// Png images don't compress very well, so they are not recommended for large images
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, ImageAssetOptions, ImageFormat};
|
||||
/// # use manganis::{asset, Asset, AssetOptions, ImageFormat};
|
||||
/// const _: Asset = asset!("/assets/image.png", AssetOptions::image().with_png());
|
||||
/// ```
|
||||
pub const fn with_png(self) -> Self {
|
||||
@@ -217,7 +217,7 @@ impl AssetOptionsBuilder<ImageAssetOptions> {
|
||||
/// If you only use the image in one place, you can set the size of the image to the size it will be displayed at. This will make the image load faster
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, ImageAssetOptions, ImageSize};
|
||||
/// # use manganis::{asset, Asset, AssetOptions, ImageSize};
|
||||
/// const _: Asset = asset!("/assets/image.png", AssetOptions::image().with_size(ImageSize::Manual { width: 512, height: 512 }));
|
||||
/// ```
|
||||
pub const fn with_size(mut self, size: ImageSize) -> Self {
|
||||
|
||||
@@ -55,7 +55,7 @@ impl AssetOptions {
|
||||
/// Create a new js asset builder
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, JsAssetOptions};
|
||||
/// # use manganis::{asset, Asset, AssetOptions};
|
||||
/// const _: Asset = asset!("/assets/script.js", AssetOptions::js());
|
||||
/// ```
|
||||
pub const fn js() -> AssetOptionsBuilder<JsAssetOptions> {
|
||||
@@ -69,7 +69,7 @@ impl AssetOptionsBuilder<JsAssetOptions> {
|
||||
/// Minifying the js can make your site load faster by loading less data
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, JsAssetOptions};
|
||||
/// # use manganis::{asset, Asset, AssetOptions};
|
||||
/// const _: Asset = asset!("/assets/script.js", AssetOptions::js().with_minify(false));
|
||||
/// ```
|
||||
#[allow(unused)]
|
||||
@@ -83,7 +83,7 @@ impl AssetOptionsBuilder<JsAssetOptions> {
|
||||
/// 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
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, JsAssetOptions};
|
||||
/// # use manganis::{asset, Asset, AssetOptions};
|
||||
/// const _: Asset = asset!("/assets/script.js", AssetOptions::js().with_preload(true));
|
||||
/// ```
|
||||
#[allow(unused)]
|
||||
|
||||
@@ -62,10 +62,10 @@ impl AssetOptions {
|
||||
/// A builder for [`AssetOptions`]
|
||||
///
|
||||
/// ```rust
|
||||
/// # use manganis::AssetOptionsBuilder;
|
||||
/// # use manganis::{AssetOptions, Asset, asset};
|
||||
/// static ASSET: Asset = asset!(
|
||||
/// "image.png",
|
||||
/// AssetOptionsBuilder::new()
|
||||
/// "/assets/style.css",
|
||||
/// AssetOptions::builder()
|
||||
/// .with_hash_suffix(false)
|
||||
/// );
|
||||
/// ```
|
||||
@@ -130,8 +130,8 @@ impl<T> AssetOptionsBuilder<T> {
|
||||
/// ```rust
|
||||
/// #[used]
|
||||
/// static ASSET: manganis::Asset = manganis::asset!(
|
||||
/// "path/to/asset.png",
|
||||
/// AssetVariant::Unknown.into_asset_options()
|
||||
/// "/assets/style.css",
|
||||
/// manganis::AssetOptions::builder()
|
||||
/// .with_hash_suffix(false)
|
||||
/// );
|
||||
/// ```
|
||||
|
||||
@@ -45,17 +45,17 @@ use linker::generate_link_section;
|
||||
/// ```
|
||||
/// Resize the image at compile time to make the assets file size smaller:
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, ImageAssetOptions, ImageSize};
|
||||
/// # use manganis::{asset, Asset, AssetOptions, ImageSize};
|
||||
/// const _: Asset = asset!("/assets/image.png", AssetOptions::image().with_size(ImageSize::Manual { width: 52, height: 52 }));
|
||||
/// ```
|
||||
/// Or convert the image at compile time to a web friendly format:
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, ImageAssetOptions, ImageSize, ImageFormat};
|
||||
/// # use manganis::{asset, Asset, AssetOptions, ImageSize, ImageFormat};
|
||||
/// const _: Asset = asset!("/assets/image.png", AssetOptions::image().with_format(ImageFormat::Avif));
|
||||
/// ```
|
||||
/// You can mark images as preloaded to make them load faster in your app
|
||||
/// ```rust
|
||||
/// # use manganis::{asset, Asset, ImageAssetOptions};
|
||||
/// # use manganis::{asset, Asset, AssetOptions};
|
||||
/// const _: Asset = asset!("/assets/image.png", AssetOptions::image().with_preload(true));
|
||||
/// ```
|
||||
#[proc_macro]
|
||||
@@ -77,7 +77,7 @@ pub fn asset(input: TokenStream) -> TokenStream {
|
||||
/// - The asset string path. This is the absolute path (from the crate root) to your CSS module.
|
||||
/// - An optional `CssModuleAssetOptions` struct to configure the processing of your CSS module.
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust, ignore
|
||||
/// css_module!(StylesIdent = "/my.module.css", AssetOptions::css_module());
|
||||
/// ```
|
||||
///
|
||||
@@ -90,7 +90,7 @@ pub fn asset(input: TokenStream) -> TokenStream {
|
||||
/// - It generates an asset using the `asset!()` macro and automatically inserts it into the app meta.
|
||||
/// - It generates a struct with snake-case associated constants of your CSS idents.
|
||||
///
|
||||
/// ```rust
|
||||
/// ```rust, ignore
|
||||
/// // This macro usage:
|
||||
/// css_module!(Styles = "/mycss.module.css");
|
||||
///
|
||||
@@ -99,7 +99,7 @@ pub fn asset(input: TokenStream) -> TokenStream {
|
||||
///
|
||||
/// impl Styles {
|
||||
/// // This can be accessed with `Styles::your_ident`
|
||||
/// pub const your_ident: &str = "abc",
|
||||
/// pub const your_ident: &str = "abc";
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
@@ -121,13 +121,13 @@ pub fn asset(input: TokenStream) -> TokenStream {
|
||||
/// # Variable Visibility
|
||||
/// If you want your asset or styles constant to be public, you can add the `pub` keyword in front of them.
|
||||
/// Restricted visibility (`pub(super)`, `pub(crate)`, etc) is also supported.
|
||||
/// ```rust
|
||||
/// ```rust, ignore
|
||||
/// css_module!(pub Styles = "/mycss.module.css");
|
||||
/// ```
|
||||
///
|
||||
/// # Asset Options
|
||||
/// Similar to the `asset!()` macro, you can pass an optional `CssModuleAssetOptions` to configure a few processing settings.
|
||||
/// ```rust
|
||||
/// ```rust, ignore
|
||||
/// use manganis::CssModuleAssetOptions;
|
||||
///
|
||||
/// css_module!(Styles = "/mycss.module.css",
|
||||
@@ -155,7 +155,7 @@ pub fn asset(input: TokenStream) -> TokenStream {
|
||||
/// }
|
||||
/// ```
|
||||
/// Then you can use the `css_module!()` macro in your Rust project:
|
||||
/// ```rust
|
||||
/// ```rust, ignore
|
||||
/// css_module!(Styles = "/mycss.module.css");
|
||||
///
|
||||
/// println!("{}", Styles::header);
|
||||
|
||||
@@ -12,7 +12,7 @@ const AVIF_ASSET: Asset = manganis::asset!("/assets/image.png");
|
||||
AVIF_ASSET will be set to a new file name that will be served by some CLI. That file can be collected by any package that depends on the component library.
|
||||
|
||||
```rust
|
||||
use manganis::{ImageFormat, ImageAssetOptions, Asset, asset, ImageSize};
|
||||
use manganis::{ImageFormat, Asset, asset, ImageSize, AssetOptions};
|
||||
// You can collect arbitrary files. Absolute paths are resolved relative to the package root
|
||||
const _: Asset = asset!("/assets/script.js");
|
||||
|
||||
|
||||
Reference in new issue
Block a user