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 |
|---|---|---|---|---|---|---|---|---|
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew/tests/use_prepared_state.rs | packages/yew/tests/use_prepared_state.rs | #![cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
#![cfg(feature = "hydration")]
#![cfg_attr(nightly_yew, feature(async_closure))]
use std::time::Duration;
mod common;
use common::obtain_result_by_id;
use wasm_bindgen_test::*;
use yew::platform::time::sleep;
use yew::prelude::*;
use yew::{Renderer, Serve... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew/tests/hydration.rs | packages/yew/tests/hydration.rs | #![cfg(feature = "hydration")]
#![cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use std::ops::Range;
use std::rc::Rc;
use std::time::Duration;
mod common;
use common::{obtain_result, obtain_result_by_id};
use wasm_bindgen::JsCast;
use wasm_bindgen_futures::spawn_local;
use wasm_bindgen_test::*;
use web_... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | true |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew/tests/use_reducer.rs | packages/yew/tests/use_reducer.rs | #![cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use std::collections::HashSet;
use std::rc::Rc;
use std::time::Duration;
use gloo::utils::document;
use wasm_bindgen::JsCast;
use wasm_bindgen_test::*;
use web_sys::HtmlElement;
use yew::platform::time::sleep;
use yew::prelude::*;
mod common;
use common:... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew/tests/mod.rs | packages/yew/tests/mod.rs | #![cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
mod common;
use std::time::Duration;
use common::obtain_result;
use wasm_bindgen_test::*;
use yew::platform::time::sleep;
use yew::prelude::*;
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test]
async fn props_are_passe... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew/tests/layout.rs | packages/yew/tests/layout.rs | #![cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
mod common;
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
use std::time::Duration;
use common::obtain_result;
use wasm_bindgen_futures::spawn_local;
use wasm_bindgen_test::*;
use yew::platform::time::sleep;
use yew::prelude::*;
#[wasm... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew/tests/raw_html.rs | packages/yew/tests/raw_html.rs | mod common;
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use wasm_bindgen::JsCast;
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use wasm_bindgen_test::wasm_bindgen_test as test;
use yew::prelude::*;
#[cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
wasm_bindgen_test::wasm_bin... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew/tests/use_memo.rs | packages/yew/tests/use_memo.rs | #![cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use std::sync::atomic::{AtomicBool, Ordering};
mod common;
use std::time::Duration;
use common::obtain_result;
use wasm_bindgen_test::*;
use yew::platform::time::sleep;
use yew::prelude::*;
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser)... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew/tests/use_context.rs | packages/yew/tests/use_context.rs | #![cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
mod common;
use std::rc::Rc;
use std::time::Duration;
use common::obtain_result_by_id;
use wasm_bindgen_test::*;
use yew::platform::time::sleep;
use yew::prelude::*;
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
#[wasm_bindgen_test]
a... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew/tests/common/mod.rs | packages/yew/tests/common/mod.rs | #![allow(dead_code)]
pub fn obtain_result() -> String {
gloo::utils::document()
.get_element_by_id("result")
.expect("No result found. Most likely, the application crashed and burned")
.inner_html()
}
pub fn obtain_result_by_id(id: &str) -> String {
gloo::utils::document()
.get... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-router-macro/src/lib.rs | packages/yew-router-macro/src/lib.rs | mod routable_derive;
use routable_derive::{routable_derive_impl, Routable};
use syn::parse_macro_input;
/// Derive macro used to mark an enum as Routable.
///
/// This macro can only be used on enums. Every varient of the macro needs to be marked
/// with the `at` attribute to specify the URL of the route. It generate... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-router-macro/src/routable_derive.rs | packages/yew-router-macro/src/routable_derive.rs | use proc_macro2::TokenStream;
use quote::quote;
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
use syn::{Data, DeriveInput, Fields, Ident, LitStr, Variant};
const AT_ATTR_IDENT: &str = "at";
const NOT_FOUND_ATTR_IDENT: &str = "not_found";
pub struct Routable {
id... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-router-macro/tests/routable_derive_test.rs | packages/yew-router-macro/tests/routable_derive_test.rs | #[allow(dead_code)]
#[rustversion::attr(stable(1.84.0), test)]
fn tests() {
let t = trybuild::TestCases::new();
t.pass("tests/routable_derive/*-pass.rs");
t.compile_fail("tests/routable_derive/*-fail.rs");
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-router-macro/tests/routable_derive/unnamed-fields-fail.rs | packages/yew-router-macro/tests/routable_derive/unnamed-fields-fail.rs | #[derive(yew_router::Routable)]
enum Routes {
#[at("/one/:two")]
One(u32),
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-router-macro/tests/routable_derive/struct-fail.rs | packages/yew-router-macro/tests/routable_derive/struct-fail.rs | #[derive(yew_router::Routable)]
struct Test {}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-router-macro/tests/routable_derive/route-with-hash-fail.rs | packages/yew-router-macro/tests/routable_derive/route-with-hash-fail.rs | #[derive(yew_router::Routable)]
enum Routes {
#[at("/#/one")]
One,
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-router-macro/tests/routable_derive/valid-pass.rs | packages/yew-router-macro/tests/routable_derive/valid-pass.rs | #![no_implicit_prelude]
#[derive(Debug, PartialEq, Clone, ::yew_router::Routable)]
enum Routes {
#[at("/")]
One,
#[at("/two/:id")]
Two { id: u32 },
#[at("/:a/:b/*rest")]
Three { a: u32, b: u32, rest: ::std::string::String },
#[at("/404")]
#[not_found]
NotFound,
}
#[derive(Debug, Pa... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-router-macro/tests/routable_derive/relative-path-fail.rs | packages/yew-router-macro/tests/routable_derive/relative-path-fail.rs | #[derive(yew_router::Routable)]
enum Routes {
#[at("one")]
One,
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-router-macro/tests/routable_derive/bad-ats-fail.rs | packages/yew-router-macro/tests/routable_derive/bad-ats-fail.rs | #[derive(yew_router::Routable)]
enum Routes {
One,
}
#[derive(yew_router::Routable)]
enum RoutesTwo {
#[at("/one")]
#[at("/two")]
One,
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-router-macro/tests/routable_derive/invalid-not-found-fail.rs | packages/yew-router-macro/tests/routable_derive/invalid-not-found-fail.rs | #[derive(Debug, PartialEq, yew_router::Routable)]
enum RoutesOne {
#[at("/")]
#[not_found]
Home,
#[at("/404")]
#[not_found]
NotFound,
}
#[derive(Debug, PartialEq, yew_router::Routable)]
enum RoutesTwo {
#[at("/404")]
#[not_found]
#[not_found]
NotFound,
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-agent-macro/src/lib.rs | packages/yew-agent-macro/src/lib.rs | use proc_macro::TokenStream;
use syn::parse_macro_input;
mod agent_fn;
mod oneshot;
mod reactor;
use agent_fn::{AgentFn, AgentName};
use oneshot::{oneshot_impl, OneshotFn};
use reactor::{reactor_impl, ReactorFn};
#[proc_macro_attribute]
pub fn reactor(attr: TokenStream, item: TokenStream) -> TokenStream {
let it... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-agent-macro/src/agent_fn.rs | packages/yew-agent-macro/src/agent_fn.rs | use proc_macro2::{Span, TokenStream};
use quote::ToTokens;
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::token::Comma;
use syn::{Attribute, FnArg, Generics, Ident, Item, ItemFn, Signature, Type, Visibility};
pub trait AgentFnType {
type RecvType;
type OutputType;
fn attr_... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-agent-macro/src/oneshot.rs | packages/yew-agent-macro/src/oneshot.rs | use proc_macro2::{Span, TokenStream};
use quote::quote;
use syn::{parse_quote, Ident, ReturnType, Signature, Type};
use crate::agent_fn::{AgentFn, AgentFnType, AgentName};
pub struct OneshotFn {}
impl AgentFnType for OneshotFn {
type OutputType = Type;
type RecvType = Type;
fn attr_name() -> &'static st... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-agent-macro/src/reactor.rs | packages/yew-agent-macro/src/reactor.rs | use proc_macro2::{Span, TokenStream};
use quote::quote;
use syn::{Ident, ReturnType, Signature, Type};
use crate::agent_fn::{AgentFn, AgentFnType, AgentName};
pub struct ReactorFn {}
impl AgentFnType for ReactorFn {
type OutputType = ();
type RecvType = Type;
fn attr_name() -> &'static str {
"re... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/use_transitive_state.rs | packages/yew-macro/src/use_transitive_state.rs | use proc_macro2::TokenStream;
use quote::quote;
use syn::parse::{Parse, ParseStream};
use syn::{Expr, ExprClosure, ReturnType, Token, Type};
#[derive(Debug)]
pub struct TransitiveState {
closure: ExprClosure,
return_type: Type,
deps: Expr,
}
impl Parse for TransitiveState {
fn parse(input: ParseStream... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/lib.rs | packages/yew-macro/src/lib.rs | //! This crate provides Yew's procedural macro `html!` which allows using JSX-like syntax
//! for generating html and the `Properties` derive macro for deriving the `Properties` trait
//! for components.
//!
//! ```
//! use yew::prelude::*;
//!
//! struct Component;
//!
//! #[derive(Properties, PartialEq)]
//! struct P... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/use_prepared_state.rs | packages/yew-macro/src/use_prepared_state.rs | use proc_macro2::TokenStream;
use quote::quote;
use syn::parse::{Parse, ParseStream};
use syn::{Expr, ExprClosure, ReturnType, Token, Type};
#[derive(Debug)]
pub struct PreparedState {
closure: ExprClosure,
return_type: Type,
deps: Expr,
}
impl Parse for PreparedState {
fn parse(input: ParseStream) ->... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/function_component.rs | packages/yew-macro/src/function_component.rs | use proc_macro2::{Span, TokenStream};
use quote::{quote, ToTokens};
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::token::{Comma, Fn};
use syn::{
parse_quote, parse_quote_spanned, visit_mut, Attribute, Block, FnArg, Generics, Ident, Item,
ItemFn, LitStr, ReturnType, Type, Visibi... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/stringify.rs | packages/yew-macro/src/stringify.rs | use std::borrow::Cow;
use std::mem::size_of;
use proc_macro2::{Span, TokenStream};
use quote::{quote_spanned, ToTokens};
use syn::spanned::Spanned;
use syn::{Expr, Lit, LitStr};
/// Stringify a value at runtime.
fn stringify_at_runtime(src: impl ToTokens) -> TokenStream {
quote_spanned! {src.span().resolved_at(Sp... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/hook/lifetime.rs | packages/yew-macro/src/hook/lifetime.rs | use std::sync::{Arc, Mutex};
use proc_macro2::Span;
use syn::visit_mut::{self, VisitMut};
use syn::{
GenericArgument, Lifetime, ParenthesizedGenericArguments, Receiver, TypeBareFn, TypeImplTrait,
TypeParamBound, TypeReference, TypeTraitObject,
};
// borrowed from the awesome async-trait crate.
pub struct Coll... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/hook/signature.rs | packages/yew-macro/src/hook/signature.rs | use std::iter::once;
use std::mem::take;
use proc_macro2::{Span, TokenStream};
use proc_macro_error::emit_error;
use quote::{quote, ToTokens};
use syn::punctuated::{Pair, Punctuated};
use syn::spanned::Spanned;
use syn::visit_mut::VisitMut;
use syn::{
parse_quote, parse_quote_spanned, visit_mut, FnArg, GenericPara... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/hook/mod.rs | packages/yew-macro/src/hook/mod.rs | use proc_macro2::{Span, TokenStream};
use proc_macro_error::emit_error;
use quote::quote;
use syn::parse::{Parse, ParseStream};
use syn::spanned::Spanned;
use syn::{
visit_mut, AttrStyle, Attribute, Block, Expr, ExprPath, File, Ident, Item, ItemFn, LitStr,
Meta, MetaNameValue, ReturnType, Signature, Stmt, Token... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/hook/body.rs | packages/yew-macro/src/hook/body.rs | use std::sync::{Arc, Mutex};
use proc_macro_error::emit_error;
use syn::spanned::Spanned;
use syn::visit_mut::VisitMut;
use syn::{
parse_quote_spanned, visit_mut, Expr, ExprCall, ExprClosure, ExprForLoop, ExprIf, ExprLoop,
ExprMatch, ExprWhile, Ident, Item,
};
#[derive(Debug)]
pub struct BodyRewriter {
br... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/html_tree/html_dashed_name.rs | packages/yew-macro/src/html_tree/html_dashed_name.rs | use std::fmt;
use proc_macro2::{Ident, Span, TokenStream};
use quote::{quote, ToTokens};
use syn::buffer::Cursor;
use syn::ext::IdentExt;
use syn::parse::{Parse, ParseStream};
use syn::spanned::Spanned;
use syn::{LitStr, Token};
use crate::stringify::Stringify;
use crate::{non_capitalized_ascii, Peek};
#[derive(Clon... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/html_tree/html_for.rs | packages/yew-macro/src/html_tree/html_for.rs | use proc_macro2::{Ident, TokenStream};
use quote::{quote, ToTokens};
use syn::buffer::Cursor;
use syn::parse::{Parse, ParseStream};
use syn::spanned::Spanned;
use syn::token::{For, In};
use syn::{braced, Expr, Pat};
use super::{HtmlChildrenTree, ToNodeIterator};
use crate::html_tree::HtmlTree;
use crate::PeekValue;
/... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/html_tree/html_component.rs | packages/yew-macro/src/html_tree/html_component.rs | use proc_macro2::Span;
use quote::{quote, quote_spanned, ToTokens};
use syn::parse::discouraged::Speculative;
use syn::parse::{Parse, ParseStream};
use syn::spanned::Spanned;
use syn::{Token, Type};
use super::{HtmlChildrenTree, TagTokens};
use crate::is_ide_completion;
use crate::props::ComponentProps;
pub struct Ht... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/html_tree/html_list.rs | packages/yew-macro/src/html_tree/html_list.rs | use quote::{quote, quote_spanned, ToTokens};
use syn::buffer::Cursor;
use syn::parse::{Parse, ParseStream};
use syn::spanned::Spanned;
use syn::Expr;
use super::html_dashed_name::HtmlDashedName;
use super::{HtmlChildrenTree, TagTokens};
use crate::props::Prop;
use crate::{Peek, PeekValue};
pub struct HtmlList {
p... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/html_tree/html_iterable.rs | packages/yew-macro/src/html_tree/html_iterable.rs | use proc_macro2::TokenStream;
use quote::{quote_spanned, ToTokens};
use syn::buffer::Cursor;
use syn::parse::{Parse, ParseStream};
use syn::spanned::Spanned;
use syn::{Expr, Token};
use super::ToNodeIterator;
use crate::PeekValue;
pub struct HtmlIterable(Expr);
impl PeekValue<()> for HtmlIterable {
fn peek(curso... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/html_tree/mod.rs | packages/yew-macro/src/html_tree/mod.rs | use proc_macro2::{Delimiter, Ident, Span, TokenStream};
use quote::{quote, quote_spanned, ToTokens};
use syn::buffer::Cursor;
use syn::ext::IdentExt;
use syn::parse::{Parse, ParseStream};
use syn::spanned::Spanned;
use syn::{braced, token, Token};
use crate::{is_ide_completion, PeekValue};
mod html_block;
mod html_co... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/html_tree/html_if.rs | packages/yew-macro/src/html_tree/html_if.rs | use proc_macro2::TokenStream;
use quote::{quote_spanned, ToTokens};
use syn::buffer::Cursor;
use syn::parse::{Parse, ParseStream};
use syn::spanned::Spanned;
use syn::{parse_quote, Expr, Token};
use super::HtmlRootBraced;
use crate::PeekValue;
pub struct HtmlIf {
if_token: Token![if],
cond: Box<Expr>,
the... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/html_tree/html_block.rs | packages/yew-macro/src/html_tree/html_block.rs | use proc_macro2::Delimiter;
use quote::{quote, quote_spanned, ToTokens};
use syn::buffer::Cursor;
use syn::parse::{Parse, ParseStream};
use syn::{braced, token};
use super::{HtmlIterable, HtmlNode, ToNodeIterator};
use crate::PeekValue;
pub struct HtmlBlock {
pub content: BlockContent,
brace: token::Brace,
}
... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/html_tree/html_element.rs | packages/yew-macro/src/html_tree/html_element.rs | use proc_macro2::{Delimiter, Group, Span, TokenStream};
use proc_macro_error::emit_warning;
use quote::{quote, quote_spanned, ToTokens};
use syn::buffer::Cursor;
use syn::parse::{Parse, ParseStream};
use syn::spanned::Spanned;
use syn::{Expr, Ident, Lit, LitStr, Token};
use super::{HtmlChildrenTree, HtmlDashedName, Ta... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/html_tree/tag.rs | packages/yew-macro/src/html_tree/tag.rs | use proc_macro2::{Span, TokenStream, TokenTree};
use quote::{quote, ToTokens};
use syn::parse::{ParseStream, Parser};
use syn::Token;
/// Check whether two spans are equal.
/// The implementation is really silly but I couldn't find another way to do it on stable.
/// This check isn't required to be fully accurate so i... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/html_tree/html_node.rs | packages/yew-macro/src/html_tree/html_node.rs | use proc_macro2::{Span, TokenStream};
use quote::{quote, quote_spanned, ToTokens};
use syn::buffer::Cursor;
use syn::parse::{Parse, ParseStream, Result};
use syn::spanned::Spanned;
use syn::Lit;
use super::ToNodeIterator;
use crate::stringify::Stringify;
use crate::PeekValue;
pub enum HtmlNode {
Literal(Box<Lit>)... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/html_tree/lint/mod.rs | packages/yew-macro/src/html_tree/lint/mod.rs | //! Lints to catch possible misuse of the `html!` macro use. At the moment these are mostly focused
//! on accessibility.
use proc_macro_error::emit_warning;
use syn::spanned::Spanned;
use super::html_element::{HtmlElement, TagName};
use super::HtmlTree;
use crate::props::{ElementProps, Prop};
/// Lints HTML element... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/derive_props/field.rs | packages/yew-macro/src/derive_props/field.rs | use std::cmp::{Ord, Ordering, PartialEq, PartialOrd};
use std::convert::TryFrom;
use proc_macro2::{Ident, Span};
use quote::{format_ident, quote, quote_spanned};
use syn::parse::Result;
use syn::spanned::Spanned;
use syn::{parse_quote, Attribute, Error, Expr, Field, GenericParam, Generics, Type, Visibility};
use supe... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/derive_props/builder.rs | packages/yew-macro/src/derive_props/builder.rs | //! The `PropsBuilder` constructs props in alphabetical order and enforces that required props have
//! been set before allowing the build to complete. Each property has a corresponding method in the
//! builder. Required property builder methods advance the builder to the next step, optional
//! properties can be adde... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/derive_props/generics.rs | packages/yew-macro/src/derive_props/generics.rs | use proc_macro2::Ident;
use syn::punctuated::Punctuated;
use syn::{GenericArgument, GenericParam, Generics, Path, Token, Type, TypePath};
/// Alias for a comma-separated list of `GenericArgument`
pub type GenericArguments = Punctuated<GenericArgument, Token![,]>;
/// Finds the index of the first generic param with a ... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/derive_props/wrapper.rs | packages/yew-macro/src/derive_props/wrapper.rs | use proc_macro2::Ident;
use quote::{quote, ToTokens};
use syn::{Attribute, Generics};
use super::PropField;
pub struct PropsWrapper<'a> {
wrapper_name: &'a Ident,
generics: &'a Generics,
prop_fields: &'a [PropField],
extra_attrs: &'a [Attribute],
}
impl ToTokens for PropsWrapper<'_> {
fn to_token... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/derive_props/mod.rs | packages/yew-macro/src/derive_props/mod.rs | mod builder;
mod field;
mod generics;
mod wrapper;
use std::convert::TryInto;
use builder::PropsBuilder;
use field::PropField;
use proc_macro2::{Ident, Span};
use quote::{format_ident, quote, ToTokens};
use syn::parse::{Parse, ParseStream, Result};
use syn::punctuated::Pair;
use syn::visit_mut::VisitMut;
use syn::{
... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/props/element.rs | packages/yew-macro/src/props/element.rs | use std::collections::HashSet;
use once_cell::sync::Lazy;
use syn::parse::{Parse, ParseStream};
use super::{Prop, Props, SpecialProps};
pub struct ElementProps {
pub attributes: Vec<Prop>,
pub listeners: Vec<Prop>,
pub classes: Option<Prop>,
pub booleans: Vec<Prop>,
pub value: Option<Prop>,
p... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/props/prop.rs | packages/yew-macro/src/props/prop.rs | use std::convert::TryFrom;
use std::ops::{Deref, DerefMut};
use proc_macro2::{Spacing, Span, TokenStream, TokenTree};
use quote::{quote, quote_spanned};
use syn::parse::{Parse, ParseBuffer, ParseStream};
use syn::spanned::Spanned;
use syn::token::Brace;
use syn::{braced, Block, Expr, ExprBlock, ExprMacro, ExprPath, Ex... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/props/mod.rs | packages/yew-macro/src/props/mod.rs | mod component;
mod element;
mod prop;
mod prop_macro;
pub use component::*;
pub use element::*;
pub use prop::*;
pub use prop_macro::PropsMacroInput;
const CHILDREN_LABEL: &str = "children";
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/props/prop_macro.rs | packages/yew-macro/src/props/prop_macro.rs | use std::convert::TryInto;
use proc_macro2::TokenStream;
use quote::{quote_spanned, ToTokens};
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
use syn::token::Brace;
use syn::{Expr, Token, TypePath};
use super::{ComponentProps, Prop, PropList, Props};
use crate::html_... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/props/component.rs | packages/yew-macro/src/props/component.rs | use std::convert::TryFrom;
use proc_macro2::{Ident, Span, TokenStream};
use quote::{quote, quote_spanned, ToTokens};
use syn::parse::{Parse, ParseStream};
use syn::spanned::Spanned;
use syn::token::DotDot;
use syn::Expr;
use super::{Prop, Props, SpecialProps, CHILDREN_LABEL};
struct BaseExpr {
pub dot_dot: DotDo... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/src/classes/mod.rs | packages/yew-macro/src/classes/mod.rs | use proc_macro2::TokenStream;
use quote::{quote, quote_spanned, ToTokens};
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::spanned::Spanned;
use syn::{Expr, ExprLit, Lit, LitStr, Token};
/// List of HTML classes.
pub struct Classes(Punctuated<ClassExpr, Token![,]>);
impl Parse for Clas... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/derive_props_test.rs | packages/yew-macro/tests/derive_props_test.rs | #[allow(dead_code)]
#[rustversion::attr(stable(1.84.0), test)]
fn derive_props() {
let t = trybuild::TestCases::new();
t.pass("tests/derive_props/pass.rs");
t.compile_fail("tests/derive_props/fail.rs");
}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/props_macro_test.rs | packages/yew-macro/tests/props_macro_test.rs | #[allow(dead_code)]
#[rustversion::attr(stable(1.84.0), test)]
fn props_macro() {
let t = trybuild::TestCases::new();
t.pass("tests/props_macro/*-pass.rs");
t.compile_fail("tests/props_macro/*-fail.rs");
}
#[test]
fn props_order() {
#[derive(yew::Properties, PartialEq)]
struct Props {
first... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/html_lints_test.rs | packages/yew-macro/tests/html_lints_test.rs | #[allow(dead_code)]
#[cfg(yew_lints)]
#[rustversion::attr(nightly, test)]
fn test_html_lints() {
let t = trybuild::TestCases::new();
t.compile_fail("tests/html_lints/fail.rs");
}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/classes_macro_test.rs | packages/yew-macro/tests/classes_macro_test.rs | #[allow(dead_code)]
#[rustversion::attr(stable(1.84.0), test)]
fn classes_macro() {
let t = trybuild::TestCases::new();
t.pass("tests/classes_macro/*-pass.rs");
t.compile_fail("tests/classes_macro/*-fail.rs");
}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_macro_test.rs | packages/yew-macro/tests/hook_macro_test.rs | #[allow(dead_code)]
#[rustversion::attr(stable(1.84.0), test)]
fn tests() {
let t = trybuild::TestCases::new();
t.pass("tests/hook_macro/*-pass.rs");
t.compile_fail("tests/hook_macro/*-fail.rs");
}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_attr_test.rs | packages/yew-macro/tests/function_attr_test.rs | #[allow(dead_code)]
#[rustversion::attr(stable(1.84.0), test)]
fn tests() {
let t = trybuild::TestCases::new();
t.pass("tests/function_component_attr/*-pass.rs");
t.compile_fail("tests/function_component_attr/*-fail.rs");
}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/html_macro_test.rs | packages/yew-macro/tests/html_macro_test.rs | use yew::{html, html_nested};
#[allow(dead_code)]
#[rustversion::attr(stable(1.84.0), test)]
fn html_macro() {
let t = trybuild::TestCases::new();
t.pass("tests/html_macro/*-pass.rs");
t.compile_fail("tests/html_macro/*-fail.rs");
}
#[test]
#[should_panic(
expected = "a dynamic tag tried to create a ... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_attr_test.rs | packages/yew-macro/tests/hook_attr_test.rs | #[allow(dead_code)]
#[rustversion::attr(stable(1.84.0), test)]
fn tests() {
let t = trybuild::TestCases::new();
t.pass("tests/hook_attr/*-pass.rs");
t.compile_fail("tests/hook_attr/*-fail.rs");
}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/props_macro/props-pass.rs | packages/yew-macro/tests/props_macro/props-pass.rs |
// Shadow primitives
#[allow(non_camel_case_types)]
pub struct bool;
#[allow(non_camel_case_types)]
pub struct char;
#[allow(non_camel_case_types)]
pub struct f32;
#[allow(non_camel_case_types)]
pub struct f64;
#[allow(non_camel_case_types)]
pub struct i128;
#[allow(non_camel_case_types)]
pub struct i16;
#[allow(non_c... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/props_macro/props-fail.rs | packages/yew-macro/tests/props_macro/props-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
fn compile_fail() {
yew::props!(Props { ref: NodeRef::default(), key: "key" });
yew::props!(Props { a: 5, fail: 10 });
let props = yew::props!(Props { a: 1 });
yew::props!(Props { a: 1, ..props });
yew::p... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/props_macro/resolve-prop-pass.rs | packages/yew-macro/tests/props_macro/resolve-prop-pass.rs |
// Shadow primitives
#[allow(non_camel_case_types)]
pub struct bool;
#[allow(non_camel_case_types)]
pub struct char;
#[allow(non_camel_case_types)]
pub struct f32;
#[allow(non_camel_case_types)]
pub struct f64;
#[allow(non_camel_case_types)]
pub struct i128;
#[allow(non_camel_case_types)]
pub struct i16;
#[allow(non_c... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/props_macro/resolve-prop-fail.rs | packages/yew-macro/tests/props_macro/resolve-prop-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties)]
struct Props {}
struct MyComp;
impl Component for MyComp {
type Message = ();
type Properties = Props;
fn create(_ctx: &Context<Self>) -> Self {
unimplemented!()
}
fn view(&self, _ctx: &Context<Self>) -> Html {
unimplemented!()
... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/extern-fail.rs | packages/yew-macro/tests/function_component_attr/extern-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
#[component(Comp)]
extern "C" fn comp(props: &Props) -> Html {
html! {
<p>
{ props.a }
</p>
}
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/const-fail.rs | packages/yew-macro/tests/function_component_attr/const-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
#[component(Comp)]
const fn comp(props: &Props) -> Html {
html! {
<p>
{ props.a }
</p>
}
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/generic-props-fail.rs | packages/yew-macro/tests/function_component_attr/generic-props-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
#[component(Comp)]
fn comp<P>(_props: &P) -> Html
where
P: Properties + PartialEq,
{
html! {
<p></p>
}
}
struct MissingTypeBounds;
fn compile_fail() {
// missing prop 'a'
html! { <Comp<Props> /> }... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/no-name-default-pass.rs | packages/yew-macro/tests/function_component_attr/no-name-default-pass.rs |
#[derive(::yew::prelude::Properties, ::std::prelude::rust_2021::PartialEq,)]
struct Props {
a: usize,
}
#[::yew::prelude::component]
fn Comp(props: &Props) -> ::yew::prelude::Html {
::yew::prelude::html! {
<p>
{ props.a }
</p>
}
}
fn main() {
let _ = ::yew::prelude::html! ... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/without-props-pass.rs | packages/yew-macro/tests/function_component_attr/without-props-pass.rs | #![no_implicit_prelude]
// Shadow primitives
#[allow(non_camel_case_types)]
pub struct bool;
#[allow(non_camel_case_types)]
pub struct char;
#[allow(non_camel_case_types)]
pub struct f32;
#[allow(non_camel_case_types)]
pub struct f64;
#[allow(non_camel_case_types)]
pub struct i128;
#[allow(non_camel_case_types)]
pub s... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/mut-ref-props-param-fail.rs | packages/yew-macro/tests/function_component_attr/mut-ref-props-param-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
#[component(Comp)]
fn comp(props: &mut Props) -> Html {
html! {
<p>
{ props.a }
</p>
}
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/with-defaulted-type-param-pass.rs | packages/yew-macro/tests/function_component_attr/with-defaulted-type-param-pass.rs |
#[derive(::yew::prelude::Properties, ::std::fmt::Debug)]
pub struct CompProps<A> {
#[prop_or_default]
_phantom: ::std::marker::PhantomData<A>,
}
impl<A> ::std::cmp::PartialEq for CompProps<A> {
fn eq(&self, _rhs: &Self) -> bool {
true
}
}
#[::yew::prelude::component(Comp)]
pub fn comp<A = ()>... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/multiple-param-fail.rs | packages/yew-macro/tests/function_component_attr/multiple-param-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
#[component(Comp)]
fn comp(props: &Props, invalid: String) -> Html {
html! {
<p>
{ props.a }
{ invalid }
</p>
}
}
#[component(Comp)]
fn comp3(props: &Props, invalid: String, ano... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/with-props-pass.rs | packages/yew-macro/tests/function_component_attr/with-props-pass.rs | // Shadow primitives
#[allow(non_camel_case_types)]
pub struct bool;
#[allow(non_camel_case_types)]
pub struct char;
#[allow(non_camel_case_types)]
pub struct f32;
#[allow(non_camel_case_types)]
pub struct f64;
#[allow(non_camel_case_types)]
pub struct i128;
#[allow(non_camel_case_types)]
pub struct i16;
#[allow(non_ca... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/generic-lifetime-fail.rs | packages/yew-macro/tests/function_component_attr/generic-lifetime-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
#[component(Comp)]
fn comp<'a>(props: &'a Props) -> Html {
html! {
<p>
{ props.a }
</p>
}
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/generic-pass.rs | packages/yew-macro/tests/function_component_attr/generic-pass.rs |
// Shadow primitives
#[allow(non_camel_case_types)]
pub struct bool;
#[allow(non_camel_case_types)]
pub struct char;
#[allow(non_camel_case_types)]
pub struct f32;
#[allow(non_camel_case_types)]
pub struct f64;
#[allow(non_camel_case_types)]
pub struct i128;
#[allow(non_camel_case_types)]
pub struct i16;
#[allow(non_c... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/bad-return-type-fail.rs | packages/yew-macro/tests/function_component_attr/bad-return-type-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
#[component(Comp1)]
fn comp_1(_props: &Props) {}
#[component(Comp)]
fn comp(_props: &Props) -> u32 {
1
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/with-receiver-fail.rs | packages/yew-macro/tests/function_component_attr/with-receiver-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
struct Test;
impl Test {
#[component(Comp)]
fn comp(self, props: &Props) -> Html {
html! {
<p>
{ props.a }
</p>
}
}
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/hook_location-fail.rs | packages/yew-macro/tests/function_component_attr/hook_location-fail.rs | use yew::prelude::*;
#[derive(Debug, PartialEq, Clone)]
struct Ctx;
#[component]
fn Comp() -> Html {
if let Some(_m) = use_context::<Ctx>() {
use_context::<Ctx>().unwrap();
todo!()
}
let _ = || {
use_context::<Ctx>().unwrap();
todo!()
};
for _ in 0..10 {
u... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/hook_location-pass.rs | packages/yew-macro/tests/function_component_attr/hook_location-pass.rs |
#[derive(
::std::prelude::rust_2021::Debug,
::std::prelude::rust_2021::PartialEq,
::std::prelude::rust_2021::Clone,
)]
struct Ctx;
#[::yew::prelude::component]
fn Comp() -> ::yew::prelude::Html {
::yew::prelude::use_context::<Ctx>().unwrap();
if let ::std::prelude::rust_2021::Some(_m) = ::yew::pr... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/applied-to-non-fn-fail.rs | packages/yew-macro/tests/function_component_attr/applied-to-non-fn-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
#[component(Comp)]
struct Test;
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/async-fail.rs | packages/yew-macro/tests/function_component_attr/async-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
#[component(Comp)]
async fn comp(props: &Props) -> Html {
html! {
<p>
{ props.a }
</p>
}
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/bad-props-param-fail.rs | packages/yew-macro/tests/function_component_attr/bad-props-param-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
#[component(Comp)]
fn comp(props: Props) -> Html {
html! {
<p>
{ props.a }
</p>
}
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/bad-name-fail.rs | packages/yew-macro/tests/function_component_attr/bad-name-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
#[component(let)]
fn comp(props: &Props) -> Html {
html! {
<p>
{ props.a }
</p>
}
}
#[component(x, y, z)]
fn comp_2(props: &Props) -> Html {
html! {
<p>
{ props.a }
... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/function_component_attr/lifetime-props-param-fail.rs | packages/yew-macro/tests/function_component_attr/lifetime-props-param-fail.rs | use yew::prelude::*;
#[derive(Clone, Properties, PartialEq)]
struct Props {
a: usize,
}
#[component(Comp)]
fn comp(props: &'static Props) -> Html {
html! {
<p>
{ props.a }
</p>
}
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_attr/hook_macro-fail.rs | packages/yew-macro/tests/hook_attr/hook_macro-fail.rs | use yew::prelude::*;
#[hook]
pub fn use_some_macro_inner(val: &str) -> String {
use_state(|| val.to_owned()).to_string()
}
macro_rules! use_some_macro {
() => {
use_some_macro_inner("default str")
};
($t: tt) => {
use_some_macro_inner($t)
};
}
#[component]
fn Comp() -> Html {
... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_attr/hook-lifetime-pass.rs | packages/yew-macro/tests/hook_attr/hook-lifetime-pass.rs | #![no_implicit_prelude]
#[::yew::functional::hook]
fn use_as_is<'a>(input: &'a ()) -> &'a () {
input
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_attr/hook-const-generic-pass.rs | packages/yew-macro/tests/hook_attr/hook-const-generic-pass.rs | #![no_implicit_prelude]
#[::yew::prelude::hook]
fn use_a_const<const N: u32>() -> u32 {
N
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_attr/hook-call-generics-pass.rs | packages/yew-macro/tests/hook_attr/hook-call-generics-pass.rs | use yew::prelude::*;
#[hook]
fn use_reducer_default_action<T>() -> T::Action
where
T: Reducible + 'static,
T::Action: Default + 'static,
{
T::Action::default()
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_attr/hook-dynamic-dispatch-pass.rs | packages/yew-macro/tests/hook_attr/hook-dynamic-dispatch-pass.rs | #![no_implicit_prelude]
#[::yew::prelude::hook]
fn use_boxed_fn(_f: ::std::boxed::Box<dyn::std::ops::Fn(&str) -> &str>) {
::std::todo!()
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_attr/hook-return-ref-pass.rs | packages/yew-macro/tests/hook_attr/hook-return-ref-pass.rs | #![no_implicit_prelude]
#[::yew::prelude::hook]
fn use_str_ref(f: &::std::primitive::str) -> &::std::primitive::str {
f
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_attr/hook_location-fail.rs | packages/yew-macro/tests/hook_attr/hook_location-fail.rs | use yew::prelude::*;
#[derive(Debug, PartialEq, Clone)]
struct Ctx;
#[hook]
fn use_some_html() -> Html {
if let Some(_m) = use_context::<Ctx>() {
use_context::<Ctx>().unwrap();
todo!()
}
let _ = || {
use_context::<Ctx>().unwrap();
todo!()
};
for _ in 0..10 {
... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_attr/hook_location-pass.rs | packages/yew-macro/tests/hook_attr/hook_location-pass.rs | #![no_implicit_prelude]
#[derive(
::std::prelude::rust_2021::Debug,
::std::prelude::rust_2021::PartialEq,
::std::prelude::rust_2021::Clone,
)]
struct Ctx;
#[::yew::prelude::hook]
fn use_some_html() -> ::yew::prelude::Html {
::yew::prelude::use_context::<Ctx>().unwrap();
if let ::std::prelude::rus... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_attr/hook-return-impl-trait-pass.rs | packages/yew-macro/tests/hook_attr/hook-return-impl-trait-pass.rs | #![no_implicit_prelude]
#[::yew::prelude::hook]
fn use_deref_as_u32() -> impl ::std::ops::Deref<Target = ::std::primitive::u32> {
::std::rc::Rc::new(0)
}
fn main() {}
| rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_attr/hook-impl-trait-pass.rs | packages/yew-macro/tests/hook_attr/hook-impl-trait-pass.rs | // we need to re-test the macro hygiene here as it uses a different implementation for impl traits.
#![no_implicit_prelude]
#[::yew::prelude::hook]
fn use_some_string(a: impl ::std::convert::Into<::std::string::String>) -> ::std::string::String {
a.into()
}
#[::yew::prelude::hook]
fn use_impl_fn<T, U>(_callback: ... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_attr/hook-trait-item-pass.rs | packages/yew-macro/tests/hook_attr/hook-trait-item-pass.rs | use std::marker::PhantomData;
pub struct QueryState<T> {
p: PhantomData<T>
}
pub trait MyTrait {
type Associated;
}
#[yew::hook]
pub fn use_query_state<Props>(
_selector: impl yew::html::IntoPropValue<bool>,
) -> QueryState<Props::Associated>
where
Props: MyTrait,
{
QueryState::<Props::Associate... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/hook_attr/hook_macro-pass.rs | packages/yew-macro/tests/hook_attr/hook_macro-pass.rs | #![no_implicit_prelude]
#[::yew::functional::hook]
pub fn use_some_macro_inner(val: &str) -> ::std::string::String {
let state = ::yew::functional::use_state(|| ::std::borrow::ToOwned::to_owned(val));
::std::string::ToString::to_string(&*state)
}
macro_rules! use_some_macro {
() => {
use_some_macr... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
yewstack/yew | https://github.com/yewstack/yew/blob/2019f4577cbdcd389b34973fdec3164be3af941a/packages/yew-macro/tests/classes_macro/classes-pass.rs | packages/yew-macro/tests/classes_macro/classes-pass.rs | #![no_implicit_prelude]
// Shadow primitives
#[allow(non_camel_case_types)]
pub struct bool;
#[allow(non_camel_case_types)]
pub struct char;
#[allow(non_camel_case_types)]
pub struct f32;
#[allow(non_camel_case_types)]
pub struct f64;
#[allow(non_camel_case_types)]
pub struct i128;
#[allow(non_camel_case_types)]
pub s... | rust | Apache-2.0 | 2019f4577cbdcd389b34973fdec3164be3af941a | 2026-01-04T15:33:05.007302Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.