mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 14:54:16 +00:00
Remove actions (moved to leptos_server
)
This commit is contained in:
parent
8873ddc40a
commit
d5e3661bcf
2 changed files with 0 additions and 34 deletions
|
@ -1,32 +0,0 @@
|
|||
use std::{future::Future, rc::Rc};
|
||||
|
||||
use crate::{PinnedFuture, Request, Response};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct Action {
|
||||
f: Rc<dyn Fn(&Request) -> PinnedFuture<Response>>,
|
||||
}
|
||||
|
||||
impl Action {
|
||||
pub async fn send(&self, req: &Request) -> Response {
|
||||
(self.f)(req).await
|
||||
}
|
||||
}
|
||||
|
||||
impl<F, Fu> From<F> for Action
|
||||
where
|
||||
F: Fn(&Request) -> Fu + 'static,
|
||||
Fu: Future<Output = Response> + 'static,
|
||||
{
|
||||
fn from(f: F) -> Self {
|
||||
Self {
|
||||
f: Rc::new(move |req| Box::pin(f(req))),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl std::fmt::Debug for Action {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.debug_struct("Action").finish()
|
||||
}
|
||||
}
|
|
@ -1,9 +1,7 @@
|
|||
mod action;
|
||||
mod loader;
|
||||
|
||||
use std::{future::Future, pin::Pin};
|
||||
|
||||
pub use action::*;
|
||||
pub use loader::*;
|
||||
|
||||
pub(crate) type PinnedFuture<T> = Pin<Box<dyn Future<Output = T>>>;
|
||||
|
|
Loading…
Reference in a new issue