* fix: add support for placing attributes on server functions
Adding instrumentation to server functions is not straightforward (requires calling out to another ssr-only function which is instrumented). This commit adds all attributes on the server function to both the generated front end and back end functions. If those attributes are only desirable on the backend say, a user can always wrap their attribute in `#[cfg_attr(feature = "ssr", ..)]`.
* nit: formatting in example cargo
This allows form submission with checkbox inputs to work.
For example:
let doit = create_server_action::<DoItSFn>();
<ActionForm action=doit>
<input type="checkbox" name="is_good" value="true"/>
<input type="submit"/>
</ActionForm>
#[server(DoItSFn, "/api")]
pub async fn doit(#[server(default)] is_good: bool) -> Result<(), ServerFnError> {}
If is_good is absent in the request to the server API,
`Default::default()` is used instead.
On the latest lifetime we're getting the following warning in the server
macro:
warning: `&` without an explicit lifetime name cannot be used here
--> src/login.rs:19:1
|
19 | #[server(Login, "/api")]
| ^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #115010 <https://github.com/rust-lang/rust/issues/115010>
= note: this warning originates in the attribute macro `server` (in Nightly builds, run with -Z macro-backtrace for more info)
When running cargo clippy on server functions that use `cx: Scope` it
has an unused variable error.
It appears that the logic for adding an `#[allow(unused)]` notation is
inverted.