feat: docs

This commit is contained in:
davidontop 2024-06-15 11:44:25 +02:00
parent a335490717
commit 5696c4e346
Signed by: DavidOnTop
GPG key ID: 5D05538A45D5149F
3 changed files with 9 additions and 0 deletions

View file

@ -2,6 +2,12 @@
name = "leptos_reactive_axum_macros"
version = "0.1.0"
edition = "2021"
description = "reactive context for axum handlers"
authors = ["davidontop <me@davidon.top>"]
readme = "../README.md"
documentation = "https://docs.rs/leptos_reactive_axum_macros"
license = "MIT"
repository = "https://git.davidon.top/public/leptos_reactive_axum.git"
[lib]
proc-macro = true

View file

@ -1,5 +1,6 @@
mod reactive;
/// macro that when applied on an axum handler will provide leptos_reactive runtime and will allow you to use `leptos_reactive_axum::extract` by providing a context holding request parts
#[proc_macro_attribute]
pub fn reactive(
attr: proc_macro::TokenStream,

View file

@ -6,6 +6,7 @@ use axum::{extract::FromRequestParts, http::request::Parts};
use error::ExtractionError;
pub use leptos_reactive_axum_macros::reactive;
/// used to extract request parts from handlers, should be used in conjunction with `leptos_reactive_axum_macros::reactive macro`
pub async fn extract<T>() -> Result<T, ExtractionError>
where
T: FromRequestParts<()>,
@ -14,6 +15,7 @@ where
extract_with_state::<T, ()>(&()).await
}
/// used to extract request parts from handlers with state, should be used in conjunction with `leptos_reactive_axum_macros::reactive macro`
pub async fn extract_with_state<T, S>(state: &S) -> Result<T, ExtractionError>
where
T: FromRequestParts<S>,