repo stringlengths 6 65 | file_url stringlengths 81 311 | file_path stringlengths 6 227 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:31:58 2026-01-04 20:25:31 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/login_with_token_csr_only/client/src/pages/register.rs | projects/login_with_token_csr_only/client/src/pages/register.rs | use crate::{
api::{self, UnauthorizedApi},
components::credentials::*,
Page,
};
use api_boundary::*;
use leptos::{logging::log, *};
use leptos_router::*;
#[component]
pub fn Register(api: UnauthorizedApi) -> impl IntoView {
let (register_response, set_register_response) = create_signal(None::<()>);
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/login_with_token_csr_only/client/src/pages/login.rs | projects/login_with_token_csr_only/client/src/pages/login.rs | use crate::{
api::{self, AuthorizedApi, UnauthorizedApi},
components::credentials::*,
Page,
};
use api_boundary::*;
use leptos::prelude::*;
use leptos_router::*;
#[component]
pub fn Login(
api: UnauthorizedApi,
#[prop(into)] on_success: Callback<AuthorizedApi>,
) -> impl IntoView {
let (login_e... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/login_with_token_csr_only/client/src/pages/home.rs | projects/login_with_token_csr_only/client/src/pages/home.rs | use crate::Page;
use api_boundary::UserInfo;
use leptos::prelude::*;
use leptos_router::*;
#[component]
pub fn Home(user_info: Signal<Option<UserInfo>>) -> impl IntoView {
view! {
<h2>"Leptos Login example"</h2>
{move || match user_info.get() {
Some(info) => {
view! { <p... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/login_with_token_csr_only/client/src/pages/mod.rs | projects/login_with_token_csr_only/client/src/pages/mod.rs | pub mod home;
pub mod login;
pub mod register;
pub use self::{home::*, login::*, register::*};
#[derive(Debug, Clone, Copy, Default)]
pub enum Page {
#[default]
Home,
Login,
Register,
}
impl Page {
pub fn path(&self) -> &'static str {
match self {
Self::Home => "/",
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/login_with_token_csr_only/client/src/components/navbar.rs | projects/login_with_token_csr_only/client/src/components/navbar.rs | use crate::Page;
use leptos::prelude::*;
use leptos_router::*;
#[component]
pub fn NavBar(
logged_in: Signal<bool>,
#[prop(into)] on_logout: Callback<()>,
) -> impl IntoView {
view! {
<nav>
<Show
when=move || logged_in.get()
fallback=|| {
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/login_with_token_csr_only/client/src/components/mod.rs | projects/login_with_token_csr_only/client/src/components/mod.rs | pub mod credentials;
pub mod navbar;
pub use self::navbar::*;
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/login_with_token_csr_only/client/src/components/credentials.rs | projects/login_with_token_csr_only/client/src/components/credentials.rs | use leptos::prelude::*;
#[component]
pub fn CredentialsForm(
title: &'static str,
action_label: &'static str,
action: Action<(String, String), ()>,
error: Signal<Option<String>>,
disabled: Signal<bool>,
) -> impl IntoView {
let (password, set_password) = create_signal(String::new());
let (e... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/hexagonal-architecture/src/config.rs | projects/hexagonal-architecture/src/config.rs | use super::server_types::*;
pub fn config() -> HandlerStructAlias {
cfg_if::cfg_if! {
if #[cfg(feature="config_1")] {
fn server_handler_config_1() -> HandlerStruct<
SubDomainStruct1<ExternalService1_1, ExternalService2_1>,
SubDomainStruct2<ExternalService... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/hexagonal-architecture/src/app.rs | projects/hexagonal-architecture/src/app.rs | use leptos::prelude::*;
use leptos_meta::{provide_meta_context, MetaTags, Stylesheet, Title};
use leptos_router::{
components::{Route, Router, Routes},
StaticSegment,
};
#[cfg(feature = "ssr")]
use super::{server_types::HandlerStructAlias, traits::HandlerTrait};
use crate::ui_types::*;
pub fn shell(options: Le... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/hexagonal-architecture/src/lib.rs | projects/hexagonal-architecture/src/lib.rs | pub mod app;
pub mod ui_types;
#[cfg(feature = "ssr")]
pub mod config;
#[cfg(feature = "ssr")]
pub mod middleware;
#[cfg(feature = "ssr")]
pub mod server_types;
#[cfg(feature = "ssr")]
pub mod trait_impl;
#[cfg(feature = "ssr")]
pub mod traits;
#[cfg(feature = "hydrate")]
#[wasm_bindgen::prelude::wasm_bindgen]
pub f... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/hexagonal-architecture/src/ui_types.rs | projects/hexagonal-architecture/src/ui_types.rs | use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize)]
pub struct UiMappingFromDomainData;
#[derive(Serialize, Deserialize)]
pub struct UiMappingFromDomainData2;
#[derive(Serialize, Deserialize)]
pub struct UiMappingFromDomainData3;
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/hexagonal-architecture/src/server_types.rs | projects/hexagonal-architecture/src/server_types.rs | use super::traits::*;
use leptos::config::LeptosOptions;
use thiserror::Error;
#[derive(Clone)]
pub struct ServerState<Handler: HandlerTrait> {
pub handler: Handler,
pub leptos_options: LeptosOptions,
}
#[cfg(feature = "config_1")]
pub type HandlerStructAlias = HandlerStruct<
SubDomainStruct1<ExternalServ... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/hexagonal-architecture/src/middleware.rs | projects/hexagonal-architecture/src/middleware.rs | use axum::{
body::Body,
http::{Request, Response},
};
use leptos::prelude::expect_context;
use std::{
future::Future,
pin::Pin,
task::{Context, Poll},
};
use tower::{Layer, Service};
use crate::{
server_types::{HandlerStructAlias, ServerState},
traits::SubDomainTrait1,
};
use pin_project_li... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/hexagonal-architecture/src/trait_impl.rs | projects/hexagonal-architecture/src/trait_impl.rs | use crate::ui_types::*;
use super::server_types::*;
use super::traits::*;
use axum::async_trait;
use axum::extract::FromRef;
use leptos::config::LeptosOptions;
// So we can pass our server state as state into our leptos router.
impl<Handler: HandlerTrait + Clone> FromRef<ServerState<Handler>> for LeptosOptions {
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/hexagonal-architecture/src/main.rs | projects/hexagonal-architecture/src/main.rs | #[cfg(feature = "ssr")]
#[tokio::main]
async fn main() {
use axum::Router;
use leptos::logging::log;
use leptos::prelude::*;
use leptos_axum::{generate_route_list, LeptosRoutes};
use leptos_hexagonal_design::{
app::*,
config::config,
server_types::{HandlerStructAlias, ServerS... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/hexagonal-architecture/src/traits.rs | projects/hexagonal-architecture/src/traits.rs | use super::server_types::*;
use axum::async_trait;
use mockall::automock;
pub trait New {
fn new() -> Self;
}
#[automock]
#[async_trait]
pub trait HandlerTrait {
async fn server_fn_1(&self) -> Result<DomainData, DomainError>;
async fn server_fn_2(&self) -> Result<DomainData2, DomainError>;
async fn ser... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/meilisearch-searchbar/src/lib.rs | projects/meilisearch-searchbar/src/lib.rs | use leptos::*;
use leptos_meta::*;
use leptos_router::*;
#[cfg(feature = "ssr")]
pub mod fallback;
#[cfg(feature = "hydrate")]
#[wasm_bindgen::prelude::wasm_bindgen]
pub fn hydrate() {
// initializes logging using the `log` crate
_ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/meilisearch-searchbar/src/main.rs | projects/meilisearch-searchbar/src/main.rs | #[cfg(feature = "ssr")]
#[tokio::main]
async fn main() {
use axum::{routing::get, Extension, Router};
use leptos::get_configuration;
use leptos_axum::{generate_route_list, LeptosRoutes};
use meilisearch_searchbar::StockRow;
use meilisearch_searchbar::{fallback::file_and_error_handler, *};
// si... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/meilisearch-searchbar/src/fallback.rs | projects/meilisearch-searchbar/src/fallback.rs | use axum::{
body::Body,
extract::State,
http::{Request, Response, StatusCode, Uri},
response::{IntoResponse, Response as AxumResponse},
};
use leptos::{view, LeptosOptions};
use tower::ServiceExt;
use tower_http::services::ServeDir;
pub async fn file_and_error_handler(
uri: Uri,
State(options):... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/app-2/src/app.rs | projects/nginx-mpmc/app-2/src/app.rs | use crate::error_template::{AppError, ErrorTemplate};
use leptos::*;
use leptos_meta::*;
use leptos_router::*;
#[component]
pub fn App() -> impl IntoView {
// Provides context that manages stylesheets, titles, meta tags, etc.
provide_meta_context();
view! {
// injects a stylesheet into the docum... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/app-2/src/fileserv.rs | projects/nginx-mpmc/app-2/src/fileserv.rs | use axum::{
body::Body,
extract::State,
response::IntoResponse,
http::{Request, Response, StatusCode, Uri},
};
use axum::response::Response as AxumResponse;
use tower::ServiceExt;
use tower_http::services::ServeDir;
use leptos::*;
use crate::app::App;
pub async fn file_and_error_handler(uri: Uri, State... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/app-2/src/lib.rs | projects/nginx-mpmc/app-2/src/lib.rs | pub mod app;
pub mod error_template;
#[cfg(feature = "ssr")]
pub mod fileserv;
#[cfg(feature = "hydrate")]
#[wasm_bindgen::prelude::wasm_bindgen]
pub fn hydrate() {
use crate::app::*;
console_error_panic_hook::set_once();
leptos::mount_to_body(App);
}
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/app-2/src/error_template.rs | projects/nginx-mpmc/app-2/src/error_template.rs | use http::status::StatusCode;
use leptos::*;
use thiserror::Error;
#[derive(Clone, Debug, Error)]
pub enum AppError {
#[error("Not Found")]
NotFound,
}
impl AppError {
pub fn status_code(&self) -> StatusCode {
match self {
AppError::NotFound => StatusCode::NOT_FOUND,
}
}
}
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/app-2/src/main.rs | projects/nginx-mpmc/app-2/src/main.rs | #[cfg(feature = "ssr")]
#[tokio::main]
async fn main() {
use axum::{
Router,
routing::get,
};
use leptos::*;
use leptos_axum::{generate_route_list, LeptosRoutes};
use app_2::app::*;
use app_2::fileserv::file_and_error_handler;
// Setting get_configuration(None) means we'll b... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/app-1/src/app.rs | projects/nginx-mpmc/app-1/src/app.rs | use crate::error_template::{AppError, ErrorTemplate};
use leptos::*;
use leptos_meta::*;
use leptos_router::*;
#[component]
pub fn App() -> impl IntoView {
// Provides context that manages stylesheets, titles, meta tags, etc.
provide_meta_context();
view! {
// injects a stylesheet into the docum... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/app-1/src/fileserv.rs | projects/nginx-mpmc/app-1/src/fileserv.rs | use axum::{
body::Body,
extract::State,
response::IntoResponse,
http::{Request, Response, StatusCode, Uri},
};
use axum::response::Response as AxumResponse;
use tower::ServiceExt;
use tower_http::services::ServeDir;
use leptos::*;
use crate::app::App;
pub async fn file_and_error_handler(uri: Uri, State... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/app-1/src/lib.rs | projects/nginx-mpmc/app-1/src/lib.rs | pub mod app;
pub mod error_template;
#[cfg(feature = "ssr")]
pub mod fileserv;
#[cfg(feature = "hydrate")]
#[wasm_bindgen::prelude::wasm_bindgen]
pub fn hydrate() {
use crate::app::*;
console_error_panic_hook::set_once();
leptos::mount_to_body(App);
}
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/app-1/src/error_template.rs | projects/nginx-mpmc/app-1/src/error_template.rs | use http::status::StatusCode;
use leptos::*;
use thiserror::Error;
#[derive(Clone, Debug, Error)]
pub enum AppError {
#[error("Not Found")]
NotFound,
}
impl AppError {
pub fn status_code(&self) -> StatusCode {
match self {
AppError::NotFound => StatusCode::NOT_FOUND,
}
}
}
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/app-1/src/main.rs | projects/nginx-mpmc/app-1/src/main.rs | #[cfg(feature = "ssr")]
#[tokio::main]
async fn main() {
use axum::Router;
use leptos::*;
use leptos_axum::{generate_route_list, LeptosRoutes};
use app_1::app::*;
use app_1::fileserv::file_and_error_handler;
use axum::routing::post;
tracing_subscriber::fmt()
.pretty()
.with_thre... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/shared-server-1/src/lib.rs | projects/nginx-mpmc/shared-server-1/src/lib.rs | use leptos::*;
#[cfg(feature="ssr")]
#[derive(Clone)]
pub struct SharedServerState;
#[tracing::instrument]
#[server(prefix="/api_shared",endpoint="/a")]
pub async fn shared_server_function() -> Result<String,ServerFnError> {
tracing::debug!("SHARED SERVER 1");
let _ : axum::Extension<SharedServerState> = le... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/shared-server-1/src/main.rs | projects/nginx-mpmc/shared-server-1/src/main.rs | #[cfg(feature = "ssr")]
#[tokio::main]
async fn main() {
use axum::Router;
use axum::routing::post;
tracing_subscriber::fmt()
.pretty()
.with_thread_names(true)
// enable everything
.with_max_level(tracing::Level::TRACE)
// sets this to be the default, global collector for this applicat... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/shared-server-2/src/lib.rs | projects/nginx-mpmc/shared-server-2/src/lib.rs | use leptos::*;
#[cfg(feature="ssr")]
#[derive(Clone)]
pub struct SharedServerState2;
#[tracing::instrument]
#[server(prefix="/api_shared2",endpoint="/a")]
pub async fn shared_server_function2() -> Result<String,ServerFnError> {
tracing::debug!("SHARED SERVER 2");
let _ : axum::Extension<SharedServerState2> =... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/nginx-mpmc/shared-server-2/src/main.rs | projects/nginx-mpmc/shared-server-2/src/main.rs | #[cfg(feature = "ssr")]
#[tokio::main]
async fn main() {
use axum::Router;
use axum::routing::post;
// In production you wouldn't want to use a hardcoded address like this.
let addr = "127.0.0.1:3003";
// build our application with a route
let app = Router::new()
.route("/api_shared2/*fn... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/openapi-openai-api-swagger-ui/src/app.rs | projects/openapi-openai-api-swagger-ui/src/app.rs | use crate::error_template::{AppError, ErrorTemplate};
use leptos::*;
use leptos_meta::*;
use leptos_router::*;
#[component]
pub fn App() -> impl IntoView {
// Provides context that manages stylesheets, titles, meta tags, etc.
provide_meta_context();
view! {
// injects a stylesheet into the docum... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/openapi-openai-api-swagger-ui/src/fileserv.rs | projects/openapi-openai-api-swagger-ui/src/fileserv.rs | use axum::{
body::Body,
extract::State,
response::IntoResponse,
http::{Request, Response, StatusCode, Uri},
};
use axum::response::Response as AxumResponse;
use tower::ServiceExt;
use tower_http::services::ServeDir;
use leptos::*;
use crate::app::App;
pub async fn file_and_error_handler(uri: Uri, State... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/openapi-openai-api-swagger-ui/src/lib.rs | projects/openapi-openai-api-swagger-ui/src/lib.rs | pub mod app;
pub mod error_template;
#[cfg(feature = "ssr")]
pub mod fileserv;
#[cfg(feature="ssr")]
pub mod open_ai;
#[cfg(feature = "hydrate")]
#[wasm_bindgen::prelude::wasm_bindgen]
pub fn hydrate() {
use crate::app::*;
console_error_panic_hook::set_once();
leptos::mount_to_body(App);
}
#[cfg(feature="... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/openapi-openai-api-swagger-ui/src/open_ai.rs | projects/openapi-openai-api-swagger-ui/src/open_ai.rs | /*
Follows
https://cookbook.openai.com/examples/function_calling_with_an_openapi_spec
closely
*/
pub static SYSTEM_MESSAGE :&'static str = "
You are a helpful assistant.
Respond to the following prompt by using function_call and then summarize actions.
Ask for clarification if a user request is ambiguous.
";
use serd... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/openapi-openai-api-swagger-ui/src/error_template.rs | projects/openapi-openai-api-swagger-ui/src/error_template.rs | use http::status::StatusCode;
use leptos::*;
use thiserror::Error;
#[derive(Clone, Debug, Error)]
pub enum AppError {
#[error("Not Found")]
NotFound,
}
impl AppError {
pub fn status_code(&self) -> StatusCode {
match self {
AppError::NotFound => StatusCode::NOT_FOUND,
}
}
}
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/openapi-openai-api-swagger-ui/src/main.rs | projects/openapi-openai-api-swagger-ui/src/main.rs | #[cfg(feature = "ssr")]
#[tokio::main]
async fn main() {
use axum::Router;
use leptos::*;
use leptos_axum::{generate_route_list, LeptosRoutes};
use openapi_swagger_ui::app::*;
use openapi_swagger_ui::api_doc::ApiDoc;
use openapi_swagger_ui::fileserv::file_and_error_handler;
use utoipa::OpenA... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/lib.rs | projects/ory-kratos/app/src/lib.rs | #![feature(box_patterns)]
use crate::error_template::{AppError, ErrorTemplate};
use leptos::*;
use leptos_meta::*;
use leptos_router::*;
pub mod auth;
#[cfg(feature = "ssr")]
pub mod database_calls;
pub mod error_template;
use auth::*;
pub mod posts;
pub use posts::*;
#[derive(Clone, Copy, PartialEq, Debug, Default)... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/error_template.rs | projects/ory-kratos/app/src/error_template.rs | use cfg_if::cfg_if;
use http::status::StatusCode;
use leptos::*;
#[cfg(feature = "ssr")]
use leptos_axum::ResponseOptions;
use thiserror::Error;
#[derive(Clone, Debug, Error)]
pub enum AppError {
#[error("Not Found")]
NotFound,
}
impl AppError {
pub fn status_code(&self) -> StatusCode {
match self... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/database_calls.rs | projects/ory-kratos/app/src/database_calls.rs | use leptos::ServerFnError;
use serde::{Deserialize, Serialize};
use sqlx::{sqlite::SqlitePool, FromRow};
// This will just map into ServerFnError when we call it in our serverfunctions with ? error handling
use sqlx::Error;
use crate::posts_page::PostData;
#[tracing::instrument(err)]
pub async fn create_user(
poo... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/auth/settings.rs | projects/ory-kratos/app/src/auth/settings.rs | use std::collections::HashMap;
use super::*;
use ory_kratos_client::models::{SettingsFlow, UiContainer, UiText};
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone)]
pub struct ViewableSettingsFlow(SettingsFlow);
impl IntoView for ViewableSettingsFlow {
fn into_view(self) -> View {
format!("{self:#... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/auth/extractors.rs | projects/ory-kratos/app/src/auth/extractors.rs | use axum::{async_trait, extract::FromRequestParts, RequestPartsExt};
use axum_extra::extract::CookieJar;
use http::request::Parts;
use ory_kratos_client::models::session::Session;
use sqlx::SqlitePool;
use crate::database_calls::UserRow;
#[derive(Clone, Debug, PartialEq)]
pub struct ExtractSession(pub Session);
#[as... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/auth/session.rs | projects/ory-kratos/app/src/auth/session.rs | use super::*;
use ory_kratos_client::models::session::Session;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ViewableSession(pub Session);
impl IntoView for ViewableSession {
fn into_view(self) -> View {
format!("{:#?}", self).into_view()
}
}
#[tracing::instrument]
#[server]
pu... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/auth/login.rs | projects/ory-kratos/app/src/auth/login.rs | use super::*;
use ory_kratos_client::models::LoginFlow;
use ory_kratos_client::models::UiContainer;
use ory_kratos_client::models::UiText;
use std::collections::HashMap;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct ViewableLoginFlow(LoginFlow);
impl IntoView for ViewableLoginFlow {
fn into... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/auth/verification.rs | projects/ory-kratos/app/src/auth/verification.rs | use std::collections::HashMap;
use super::*;
use ory_kratos_client::models::{UiContainer, UiText, VerificationFlow};
#[cfg(feature = "ssr")]
use tracing::debug;
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct ViewableVerificationFlow(VerificationFlow);
impl IntoView for ViewableVerificationFlow {
fn in... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/auth/kratos_html.rs | projects/ory-kratos/app/src/auth/kratos_html.rs | use super::*;
use ory_kratos_client::models::ui_node_attributes::UiNodeAttributes;
use ory_kratos_client::models::ui_node_attributes::UiNodeAttributesTypeEnum;
use ory_kratos_client::models::UiNode;
use ory_kratos_client::models::UiText;
use std::collections::HashMap;
/// https://www.ory.sh/docs/kratos/concepts/ui-use... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/auth/mod.rs | projects/ory-kratos/app/src/auth/mod.rs | use super::error_template::ErrorTemplate;
use leptos::*;
use leptos_router::*;
use leptos_meta::*;
pub mod kratos_html;
use kratos_html::kratos_html;
pub mod registration;
pub use registration::RegistrationPage;
pub mod verification;
use serde::{Deserialize, Serialize};
pub use verification::VerificationPage;
pub mod l... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/auth/logout.rs | projects/ory-kratos/app/src/auth/logout.rs | use super::*;
#[tracing::instrument]
#[server]
pub async fn logout() -> Result<(), ServerFnError> {
use ory_kratos_client::models::logout_flow::LogoutFlow;
use ory_kratos_client::models::ErrorGeneric;
use reqwest::StatusCode;
let cookie_jar = leptos_axum::extract::<axum_extra::extract::CookieJar>().aw... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/auth/kratos_error.rs | projects/ory-kratos/app/src/auth/kratos_error.rs | use super::*;
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
pub struct KratosError {
code: Option<usize>,
message: Option<String>,
reason: Option<String>,
debug: Option<String>,
}
impl KratosError {
pub fn to_err_msg(self) -> String {
format!(
"{}\n{}\n{}\n{}\n",
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/auth/recovery.rs | projects/ory-kratos/app/src/auth/recovery.rs | use std::collections::HashMap;
use super::*;
use ory_kratos_client::models::{
ContinueWith, ContinueWithSettingsUiFlow, ErrorGeneric, RecoveryFlow, UiContainer, UiText,
};
/*
User clicks recover account button and is directed to the initiate recovery page
On the initiate recovery page they are asked for th... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/auth/registration.rs | projects/ory-kratos/app/src/auth/registration.rs | use super::kratos_html;
use super::*;
use ory_kratos_client::models::RegistrationFlow;
use ory_kratos_client::models::UiContainer;
use ory_kratos_client::models::UiText;
use std::collections::HashMap;
#[cfg(feature = "ssr")]
use reqwest::StatusCode;
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struc... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/posts/posts_page.rs | projects/ory-kratos/app/src/posts/posts_page.rs | use serde::{Deserialize, Serialize};
use super::*;
#[derive(Serialize, Deserialize, Debug, Clone)]
#[cfg_attr(feature = "ssr", derive(sqlx::FromRow))]
pub struct PostData {
pub post_id: String,
pub user_id: String,
pub content: String,
}
impl IntoView for PostData {
fn into_view(self) -> View {
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/posts/mod.rs | projects/ory-kratos/app/src/posts/mod.rs | use super::*;
mod post;
use post::Post;
pub mod posts_page;
pub use posts_page::PostPage;
mod create_posts;
use crate::posts_page::PostData;
use create_posts::CreatePost;
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/posts/post.rs | projects/ory-kratos/app/src/posts/post.rs | use self::posts_page::PostData;
use super::*;
// This is the post, contains all other functionality.
#[component]
pub fn Post(post: PostData) -> impl IntoView {
let PostData {
post_id, content, ..
} = post;
view! {
<div>{content}</div>
<AddEditor post_id=post_id.clone()/>
<... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/app/src/posts/create_posts.rs | projects/ory-kratos/app/src/posts/create_posts.rs | use super::*;
// An user can post a post. Technically all server functions are POST, so this is a Post Post Post.
#[tracing::instrument(ret)]
#[server]
pub async fn post_post(content: String) -> Result<(), ServerFnError> {
use crate::database_calls::{create_post, create_post_permissions, PostPermission};
let p... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/e2e/tests/app_suite.rs | projects/ory-kratos/e2e/tests/app_suite.rs | #![feature(never_type)]
mod fixtures;
use anyhow::anyhow;
use anyhow::Result;
use chromiumoxide::cdp::browser_protocol::log::EventEntryAdded;
use chromiumoxide::cdp::js_protocol::runtime::EventConsoleApiCalled;
use chromiumoxide::{
browser::{Browser, BrowserConfig},
cdp::browser_protocol::{
network::{E... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/e2e/tests/fixtures/mod.rs | projects/ory-kratos/e2e/tests/fixtures/mod.rs | pub mod steps;
use anyhow::{anyhow, Result};
pub async fn wait() {
tokio::time::sleep(tokio::time::Duration::from_millis(75)).await;
}
use regex::Regex;
fn extract_code_and_link(text: &str) -> Result<(String, String)> {
// Regex pattern for a six-digit number
let number_regex = Regex::new(r"\b\d{6}\b").u... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/e2e/tests/fixtures/steps.rs | projects/ory-kratos/e2e/tests/fixtures/steps.rs | use crate::{AppWorld, EMAIL_ID_MAP};
use anyhow::anyhow;
use anyhow::{Ok, Result};
use chromiumoxide::cdp::browser_protocol::input::TimeSinceEpoch;
use chromiumoxide::cdp::browser_protocol::network::{CookieParam, DeleteCookiesParams};
use cucumber::{given, then, when};
use fake::locales::EN;
use fake::{faker::internet:... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/frontend/src/lib.rs | projects/ory-kratos/frontend/src/lib.rs | use app::*;
use leptos::*;
use wasm_bindgen::prelude::wasm_bindgen;
#[wasm_bindgen]
pub fn hydrate() {
// initializes logging using the `log` crate
// _ = console_log::init_with_level(tracing::Level::Debug);
console_error_panic_hook::set_once();
leptos::mount_to_body(App);
}
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/server/src/fileserv.rs | projects/ory-kratos/server/src/fileserv.rs | use app::App;
use axum::response::Response as AxumResponse;
use axum::{
body::Body,
extract::State,
http::{Request, Response, StatusCode, Uri},
response::IntoResponse,
};
use leptos::*;
use tower::ServiceExt;
use tower_http::services::ServeDir;
pub async fn file_and_error_handler(
uri: Uri,
Sta... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/server/src/extract_session.rs | projects/ory-kratos/server/src/extract_session.rs | use axum::{async_trait, extract::FromRequestParts, RequestPartsExt};
use axum_extra::extract::CookieJar;
use http::request::Parts;
use ory_kratos_client::models::session::Session;
pub struct ExtractSession(pub Session);
#[async_trait]
impl<S> FromRequestParts<S> for ExtractSession
where
S: Send + Sync,
{
type ... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/server/src/main.rs | projects/ory-kratos/server/src/main.rs | use app::*;
use axum::Router;
use axum_server::tls_rustls::RustlsConfig;
use fileserv::file_and_error_handler;
use leptos::*;
use leptos_axum::{generate_route_list, LeptosRoutes};
use std::path::PathBuf;
use tracing_subscriber::EnvFilter;
pub mod fileserv;
#[tokio::main]
async fn main() {
tracing_subscriber::fmt()... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/ory-kratos/ids/src/lib.rs | projects/ory-kratos/ids/src/lib.rs | pub static REGISTER_BUTTON_ID: &'static str = "register_button_id";
pub static REGISTRATION_FORM_ID: &'static str = "registration_form_id";
pub static EMAIL_INPUT_ID: &'static str = "email_input_id";
pub static PASSWORD_INPUT_ID: &'static str = "password_input_id";
pub static VERIFY_EMAIL_DIV_ID: &'static str = "veri... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/sitemap_axum/src/app.rs | projects/sitemap_axum/src/app.rs | use crate::error_template::{AppError, ErrorTemplate};
use leptos::*;
use leptos_meta::*;
use leptos_router::*;
#[component]
pub fn App() -> impl IntoView {
// Provides context that manages stylesheets, titles, meta tags, etc.
provide_meta_context();
view! {
// injects a stylesheet into the docum... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/sitemap_axum/src/fileserv.rs | projects/sitemap_axum/src/fileserv.rs | use crate::app::App;
use axum::{
body::Body,
extract::State,
http::{Request, Response, StatusCode, Uri},
response::{IntoResponse, Response as AxumResponse},
};
use leptos::*;
use tower::ServiceExt;
use tower_http::services::ServeDir;
pub async fn file_and_error_handler(
uri: Uri,
State(options)... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/sitemap_axum/src/lib.rs | projects/sitemap_axum/src/lib.rs | pub mod app;
pub mod error_template;
#[cfg(feature = "ssr")]
pub mod fileserv;
#[cfg(feature = "ssr")]
pub mod sitemap;
#[cfg(feature = "hydrate")]
#[wasm_bindgen::prelude::wasm_bindgen]
pub fn hydrate() {
use crate::app::*;
console_error_panic_hook::set_once();
leptos::mount_to_body(App);
}
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/sitemap_axum/src/error_template.rs | projects/sitemap_axum/src/error_template.rs | use http::status::StatusCode;
use leptos::*;
use thiserror::Error;
#[derive(Clone, Debug, Error)]
pub enum AppError {
#[error("Not Found")]
NotFound,
}
impl AppError {
pub fn status_code(&self) -> StatusCode {
match self {
AppError::NotFound => StatusCode::NOT_FOUND,
}
}
}
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/sitemap_axum/src/main.rs | projects/sitemap_axum/src/main.rs | #[cfg(feature = "ssr")]
#[tokio::main]
async fn main() {
use axum::{routing::get, Router};
use leptos::*;
use leptos_axum::{generate_route_list, LeptosRoutes};
use sitemap_axum::{
app::*, fileserv::file_and_error_handler, sitemap::generate_sitemap,
};
use tower_http::services::ServeFile;... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/sitemap_axum/src/sitemap.rs | projects/sitemap_axum/src/sitemap.rs | use axum::{
body::Body,
response::{IntoResponse, Response},
};
use sqlx::{PgPool, Pool, Postgres};
use std::{
env::{self, current_dir},
fs::File,
io::{BufWriter, Read},
path::Path,
};
use time::{format_description, PrimitiveDateTime};
use xml::{writer::XmlEvent, EmitterConfig, EventWriter};
#[d... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/counter_dwarf_debug/src/lib.rs | projects/counter_dwarf_debug/src/lib.rs | use leptos::*;
/// A simple counter component.
///
/// You can use doc comments like this to document your component.
#[component]
pub fn SimpleCounter(
/// The starting value for the counter
initial_value: i32,
/// The change that should be applied each time the button is clicked.
step: i32,
) -> impl... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/counter_dwarf_debug/src/main.rs | projects/counter_dwarf_debug/src/main.rs | use counter_dwarf_debug::SimpleCounter;
use leptos::*;
pub fn main() {
_ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook::set_once();
mount_to_body(|| {
view! {
<SimpleCounter
initial_value=0
step=1
/>
}
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/session_auth_axum/src/errors.rs | projects/session_auth_axum/src/errors.rs | use http::status::StatusCode;
use thiserror::Error;
#[derive(Debug, Clone, Error)]
pub enum TodoAppError {
#[error("Not Found")]
NotFound,
#[error("Internal Server Error")]
InternalServerError,
}
impl TodoAppError {
pub fn status_code(&self) -> StatusCode {
match self {
TodoApp... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/session_auth_axum/src/lib.rs | projects/session_auth_axum/src/lib.rs | pub mod auth;
pub mod error_template;
pub mod errors;
#[cfg(feature = "ssr")]
pub mod state;
pub mod todo;
#[cfg(feature = "hydrate")]
#[wasm_bindgen::prelude::wasm_bindgen]
pub fn hydrate() {
use crate::todo::*;
_ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook::set_once();
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/session_auth_axum/src/state.rs | projects/session_auth_axum/src/state.rs | use axum::extract::FromRef;
use leptos::prelude::LeptosOptions;
use leptos_axum::AxumRouteListing;
use sqlx::SqlitePool;
/// This takes advantage of Axum's SubStates feature by deriving FromRef. This is the only way to have more than one
/// item in Axum's State. Leptos requires you to have leptosOptions in your State... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/session_auth_axum/src/todo.rs | projects/session_auth_axum/src/todo.rs | use crate::{auth::*, error_template::ErrorTemplate};
use leptos::prelude::*;
use leptos_meta::*;
use leptos_router::{components::*, path};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Todo {
id: u32,
user: Option<User>,
title: String,
cr... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/session_auth_axum/src/auth.rs | projects/session_auth_axum/src/auth.rs | use leptos::prelude::*;
use serde::{Deserialize, Serialize};
use std::collections::HashSet;
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct User {
pub id: i64,
pub username: String,
pub permissions: HashSet<String>,
}
// Explicitly is not Serialize/Deserialize!
#[derive(Clone, De... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/session_auth_axum/src/error_template.rs | projects/session_auth_axum/src/error_template.rs | use crate::errors::TodoAppError;
use leptos::prelude::*;
#[cfg(feature = "ssr")]
use leptos_axum::ResponseOptions;
// A basic function to display errors served by the error boundaries. Feel free to do more complicated things
// here than just displaying them
#[component]
pub fn ErrorTemplate(
#[prop(optional)] out... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/session_auth_axum/src/main.rs | projects/session_auth_axum/src/main.rs | use axum::Router;
use axum_session::{SessionConfig, SessionLayer, SessionStore};
use axum_session_auth::{AuthConfig, AuthSessionLayer};
use axum_session_sqlx::SessionSqlitePool;
use leptos::{config::get_configuration, logging::log};
use leptos_axum::{generate_route_list, LeptosRoutes};
use session_auth_axum::{auth::Use... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/tauri-from-scratch/src-orig/src/app.rs | projects/tauri-from-scratch/src-orig/src/app.rs | use leptos::prelude::*;
#[cfg(feature = "ssr")]
pub fn shell(options: LeptosOptions) -> impl IntoView {
use leptos_meta::MetaTags;
view! {
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-widt... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/tauri-from-scratch/src-orig/src/lib.rs | projects/tauri-from-scratch/src-orig/src/lib.rs | pub mod app;
#[cfg(feature = "ssr")]
pub mod fallback;
#[cfg(feature = "hydrate")]
#[wasm_bindgen::prelude::wasm_bindgen]
pub fn hydrate() {
console_error_panic_hook::set_once();
leptos::mount::hydrate_body(app::App);
}
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/tauri-from-scratch/src-orig/src/main.rs | projects/tauri-from-scratch/src-orig/src/main.rs | #[cfg(feature = "ssr")]
#[tokio::main]
async fn main() {
use axum::{
body::Body,
extract::{Request, State},
response::IntoResponse,
routing::get,
Router,
};
use leptos::logging::log;
use leptos::prelude::*;
use leptos_axum::{generate_route_list, LeptosRoutes};... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/tauri-from-scratch/src-orig/src/fallback.rs | projects/tauri-from-scratch/src-orig/src/fallback.rs | use axum::{
body::Body,
extract::State,
http::{Request, Response, StatusCode, Uri},
response::{IntoResponse, Response as AxumResponse},
};
use leptos::{prelude::LeptosOptions, view};
use tower::ServiceExt;
use tower_http::services::ServeDir;
pub async fn file_and_error_handler(
uri: Uri,
State(... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/tauri-from-scratch/src-tauri/build.rs | projects/tauri-from-scratch/src-tauri/build.rs | fn main() {
tauri_build::build();
}
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/tauri-from-scratch/src-tauri/src/lib.rs | projects/tauri-from-scratch/src-tauri/src/lib.rs | use tauri::Manager;
#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
tauri::Builder::default()
.plugin(tauri_plugin_http::init())
.setup(|app| {
{
let window = app.get_webview_window("main").unwrap();
window.open_devtools();
}
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/tauri-from-scratch/src-tauri/src/main.rs | projects/tauri-from-scratch/src-tauri/src/main.rs | // Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
fn main() {
app_lib::run();
}
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/bevy3d_ui/src/main.rs | projects/bevy3d_ui/src/main.rs | mod demos;
mod routes;
use leptos::prelude::*;
use routes::RootPage;
pub fn main() {
// Bevy will output a lot of debug info to the console when this is enabled.
//_ = console_log::init_with_level(log::Level::Debug);
console_error_panic_hook::set_once();
mount_to_body(|| view! { <RootPage/> })
}
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/bevy3d_ui/src/demos/mod.rs | projects/bevy3d_ui/src/demos/mod.rs | pub mod bevydemo1;
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/bevy3d_ui/src/demos/bevydemo1/state.rs | projects/bevy3d_ui/src/demos/bevydemo1/state.rs | use bevy::ecs::system::Resource;
use std::sync::{Arc, Mutex};
pub type Shared<T> = Arc<Mutex<T>>;
/// Shared Resource used for Bevy
#[derive(Resource)]
pub struct SharedResource(pub Shared<SharedState>);
/// Shared State
pub struct SharedState {
pub name: String,
}
impl SharedState {
/// Get a new shared st... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/bevy3d_ui/src/demos/bevydemo1/scene.rs | projects/bevy3d_ui/src/demos/bevydemo1/scene.rs | use super::eventqueue::events::{
ClientInEvents, CounterEvtData, EventProcessor, PluginOutEvents,
};
use super::eventqueue::plugin::DuplexEventsPlugin;
use super::state::{Shared, SharedResource, SharedState};
use bevy::prelude::*;
/// Represents the Cube in the scene
#[derive(Component, Copy, Clone)]
pub struct Cu... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/bevy3d_ui/src/demos/bevydemo1/mod.rs | projects/bevy3d_ui/src/demos/bevydemo1/mod.rs | pub mod eventqueue;
pub mod scene;
pub mod state;
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/bevy3d_ui/src/demos/bevydemo1/eventqueue/mod.rs | projects/bevy3d_ui/src/demos/bevydemo1/eventqueue/mod.rs | pub mod events;
pub mod plugin;
| rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/bevy3d_ui/src/demos/bevydemo1/eventqueue/events.rs | projects/bevy3d_ui/src/demos/bevydemo1/eventqueue/events.rs | use bevy::prelude::*;
/// Event Processor
#[derive(Resource)]
pub struct EventProcessor<TSender, TReceiver> {
pub sender: crossbeam_channel::Sender<TSender>,
pub receiver: crossbeam_channel::Receiver<TReceiver>,
}
impl<TSender, TReceiver> Clone for EventProcessor<TSender, TReceiver> {
fn clone(&self) -> S... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/bevy3d_ui/src/demos/bevydemo1/eventqueue/plugin.rs | projects/bevy3d_ui/src/demos/bevydemo1/eventqueue/plugin.rs | use super::events::*;
use bevy::prelude::*;
/// Events plugin for bevy
#[derive(Clone)]
pub struct DuplexEventsPlugin {
/// Client processor for sending ClientInEvents, receiving PluginOutEvents
client_processor: EventProcessor<ClientInEvents, PluginOutEvents>,
/// Internal processor for sending PluginOutE... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/bevy3d_ui/src/routes/demo1.rs | projects/bevy3d_ui/src/routes/demo1.rs | use crate::demos::bevydemo1::eventqueue::events::{
ClientInEvents, CounterEvtData,
};
use crate::demos::bevydemo1::scene::Scene;
use leptos::prelude::*;
/// 3d view component
#[component]
pub fn Demo1() -> impl IntoView {
// Setup a Counter
let initial_value: i32 = 0;
let step: i32 = 1;
let (value,... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/projects/bevy3d_ui/src/routes/mod.rs | projects/bevy3d_ui/src/routes/mod.rs | pub mod demo1;
use demo1::Demo1;
use leptos::prelude::*;
use leptos_meta::Meta;
use leptos_meta::Title;
use leptos_meta::{provide_meta_context, MetaTags, Stylesheet};
use leptos_router::components::*;
use leptos_router::StaticSegment;
#[component]
pub fn RootPage() -> impl IntoView {
provide_meta_context();
vi... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/either_of/src/lib.rs | either_of/src/lib.rs | #![cfg_attr(feature = "no_std", no_std)]
#![forbid(unsafe_code)]
//! Utilities for working with enumerated types that contain one of `2..n` other types.
use core::{
cmp::Ordering,
fmt::Display,
future::Future,
iter::{Product, Sum},
pin::Pin,
task::{Context, Poll},
};
use paste::paste;
use pin_... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | true |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/or_poisoned/src/lib.rs | or_poisoned/src/lib.rs | //! Provides a simple trait that unwraps the locks provide by [`std::sync::RwLock`].
//!
//! In every case, this is the same as calling `.expect("lock poisoned")`. However, it
//! does not use `.unwrap()` or `.expect()`, which makes it easier to distinguish from
//! other forms of unwrapping when reading code.
//!
//! ... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
leptos-rs/leptos | https://github.com/leptos-rs/leptos/blob/dd507168fa47b5eead64339431b0bd654bd1c951/next_tuple/src/lib.rs | next_tuple/src/lib.rs | //! Defines a trait that allows you to extend a tuple, by returning
//! a new tuple with an element of an arbitrary type added.
#![no_std]
#![allow(non_snake_case)]
#![forbid(unsafe_code)]
#![deny(missing_docs)]
/// Allows extending a tuple, or creating a new tuple, by adding the next value.
pub trait NextTuple {
... | rust | MIT | dd507168fa47b5eead64339431b0bd654bd1c951 | 2026-01-04T15:41:20.302544Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.