text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_prefix|>#![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... | fim | yewstack/yew | rust |
mod smth {
const KEY: u32 = 42;
}
fn main() {
_ = ::yew::html!{while};
_ = ::yew::html!{while true};
_ = ::yew::html!{while {} { <div/> }};
_ = ::yew::html!{while true {
<div key="duplicate" />
}};
_ = ::yew::html!{while true {
<div key={smth::KEY} />
}};
}
<|endoftext... | fim | yewstack/yew | rust |
<|fim_prefix|>#![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... | fim | yewstack/yew | rust |
<|fim_prefix|>use yew::{html, html_nested};
#[allow(dead_code)]
#[rustversion::attr(stable(1.85.0), test)]
fn html_macro() {
let t = trybuild::TestCases::new();
t.pass("tes<|fim_suffix|>."
)]
fn dynamic_tags_catch_void_elements() {
let _ = html! {
<@{"br"}>
<span>{ "No children allowed... | fim | yewstack/yew | rust |
<|fim_prefix|>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::<|fim_suffix|>{}
<|fim_middle|>props!(Props { a: 1 });
yew:... | fim | yewstack/yew | rust |
<|fim_prefix|>
// 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;... | fim | yewstack/yew | rust |
<|fim_prefix|>use yew::prelude::*;
#[derive(Clone, Properties)]
struct Props {}
struct MyComp;
impl Component for MyComp {
<|fim_suffix|>nt;
impl NotAComponent for MyNotAComponent {
type Properties = ();
}
fn compile_fail() {
yew::props!(Vec<_> {});
yew::props!(MyComp {});
yew::props!(MyNotACompo... | fim | yewstack/yew | rust |
<|fim_prefix|>
// Shadow primitives
#[allow(non_camel_case_types)]
pub struc<|fim_suffix|>(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;
... | fim | yewstack/yew | rust |
<|fim_prefix|>#[allow(dead_code)]
#[rustversion::attr(stabl<|fim_suffix|>ut g = 1..=3;
let props = yew::props!(Props {
first: g.next().unwrap(),
second: g.next().unwrap(),
last: g.next().unwrap()
});
assert_eq!(props.first, 1);
assert_eq!(props.second, 2);
assert_eq!(props.l... | fim | yewstack/yew | rust |
<|fim_suffix|>utils::compose_path(&pathname, &query))
.unwrap_or_else(|| pathname.into_owned());
if navigator.kind() == NavigatorKind::Hash {
path.insert(0, '#');
}
AttrValue::from(path)
};
html! {
<a class={classes}
{href}
{oncl... | fim | yewstack/yew | rust |
<|fim_suffix|>:*;
pub use redirect::*;
<|fim_prefix|>//! Components to interface with [Router][crate::Router].
mod link;
mod redirect;
<|fim_middle|>pub use link:<|endoftext|> | fim | yewstack/yew | rust |
<|fim_suffix|>omponent(Redirect)]
pub fn redirect<R>(props: &RedirectProps<R>) -> Html
where
R: Routable + 'static,
{
let history = use_navigator().expect_throw("failed to read history.");
let target_route = props.to.clone();
use_effect(move || {
history.push(&target_route);
|| {}
... | fim | yewstack/yew | rust |
//! Hooks to access router state and navigate between pages.
use yew::prelude::*;
use crate::history::*;
use crate::navigator::Navigator;
use crate::routable::Routable;
use crate::router::{LocationContext, NavigatorContext};
/// A hook to access the [`Navigator`].
#[hook]
pub fn use_navigator() -> Option<Navigator> ... | fim | yewstack/yew | rust |
<|fim_prefix|>//! Provides routing faculties using the browser history API to build
//! Single Page Applications (SPAs) using [Yew web framework](https://yew.rs).
//!
//! # Usage
//!
//! ```rust
//! use yew::functional::*;
//! use yew::prelude::*;
//! use yew_router::prelude::*;
//!
//! #[derive(Debug, Clone, Copy, Par... | fim | yewstack/yew | rust |
<|fim_suffix|>tchit::Router` to match the route of a `Routable`
pub fn recognize_with_router<R: Routable>(router: &Router, pathname: &str) -> Option<R> {
let matched = router.at(pathname);
match matched {
Ok(matched) => {
let params: HashMap<&str, &str> = matched.params.iter().collect();
... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::borrow::Cow;
use crate::history::{AnyHistory, History, His<|fim_suffix|>e<'a>(&self, route_s: &'a str) -> Cow<'a, str> {
match self.basename() {
Some(base) => {
if base.is_empty() && route_s.is_empty() {
Cow::from("/")
} els... | fim | yewstack/yew | rust |
<|fim_suffix|>h: String,
}
impl Routable for AnyRoute {
fn from_path(path: &str, params: &HashMap<&str, &str>) -> Option<Self> {
// No params allowed.
if params.is_empty() {
Some(Self {
path: path.to_string(),
})
} else {
None
}
... | fim | yewstack/yew | rust |
<|fim_suffix|>as route.
///
/// # Note
///
/// The router will by default use the value declared in `<base href="..." />` as its basename.
/// You may also specify a different basename with props.
#[component(BrowserRouter)]
pub fn browser_router(props: &ConcreteRouterProps) -> Html {
let ConcreteRouterProps { chil... | fim | yewstack/yew | rust |
<|fim_prefix|>use yew::context::ContextHandle;
use yew::prelude::*;
use crate::history::Location;
use crate::navigator::Navigator;
use crate::routable::Routable;
use crate::router::{LocationContext, NavigatorContext};
/// A [`ContextHandle`] for [`add_location_listener`](RouterScopeExt::add_location_listener).
pub st... | fim | yewstack/yew | rust |
//! The [`Switch`] Component.
use yew::prelude::*;
use crate::prelude::*;
/// Props for [`Switch`]
#[derive(Properties, PartialEq, Clone)]
pub struct SwitchProps<R>
where
R: Routable,
{
/// Callback which returns [`Html`] to be rendered for the current route.
pub render: Callback<R, Html>,
#[prop_or_... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::cell::RefCell;
use wasm_bindgen::JsCast;
pub(crate) fn strip_slash_suffix(path: &str) -> &str {
path.strip_suffix('/').unwrap_or(path)
}
static BASE_URL_LOADED: std::sync::Once = std::sync::Once::new();
thread_local! {
static BASE_URL: RefCell<Option<String>> = const { RefCell::new(Non... | fim | yewstack/yew | rust |
<|fim_suffix|>he time of execution are set and it causes weird behavior (tests
// failing randomly)
// this test tests
// - routing
// - parameters in the path
// - query parameters
// - 404 redirects
#[test]
async fn router_works() {
yew::Renderer::<Root>::with_root(gloo::utils::document().get_element_by_id("outpu... | fim | yewstack/yew | rust |
<|fim_suffix|>cution are set and it causes weird behavior (tests
// failing randomly)
// this test tests
// - routing
// - parameters in the path
// - query parameters
// - 404 redirects
#[test]
async fn router_works() {
yew::Renderer::<Root>::with_root(gloo::utils::document().get_element_by_id("output").unwrap())
... | fim | yewstack/yew | rust |
<|fim_prefix|>// TODO: remove the cfg after wasm-bindgen-test stops emitting the function unconditionally
#![cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))]
use std::time::Duration;
use serde::<|fim_suffix|> .replace_with_query(
&Routes::No { id: 2 },
... | fim | yewstack/yew | rust |
<|fim_prefix|>// TODO: remove the cfg after wasm-bindgen-test stops emitting the function unconditionally
#![cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))]
use std::sync::atomic::{AtomicU8, Ordering};
use std::time::Duration;
use gloo::utils::window;
use js_sys::{JsString, Object, R... | fim | yewstack/yew | rust |
<|fim_prefix|>// TODO: remove the cfg after wasm-bindgen-test stops emitting the function unconditionally
#![cfg(all(target_arch = "wasm32", any(target_os = "unknown", target_os = "none")))]
use wasm_bindgen_test::{wasm_bindgen_test as test, wasm_bindgen_test_configure};
use yew_router::prelude::*;
wasm_bindgen_test_... | fim | yewstack/yew | rust |
<|fim_suffix|> #[at("/search/{query}")]
Search { query: String },
}
#[component]
fn Comp() -> Html {
let switch = move |routes: AppRoute| match routes {
AppRoute::Root => html! {
<h1>{ "Root" }</h1>
<Link<AppRoute> to={AppRoute::Search { query: "a/b".to_string() }}>
... | fim | yewstack/yew | rust |
<|fim_prefix|>use wasm_bindgen::JsCast;
#[allow(dead_code)]
pub fn obtain_result_by_id(id: &str) -> String {
gloo::utils::document()
.get_element_by_id(id)
.expect("No result found. Most likely, the application crashed and burned")
.inner_html()
}
#[allow(dead_code)]
pub fn click(selector:... | fim | yewstack/yew | rust |
<|fim_suffix|>th `Route`
/// component.
///
/// # Example
///
/// ```
/// # use yew_router::Routable;
/// #[derive(Debug, Clone, Copy, PartialEq, Routable)]
/// enum Routes {
/// #[at("/")]
/// Home,
/// #[at("/secure")]
/// Secure,
/// #[at("/404")]
/// NotFound,
/// }
/// ```
#[proc_macro_deri... | fim | yewstack/yew | rust |
<|fim_suffix|> ::yew_router::__macro::encode_path_for_url(&::std::format!("{}", #field))
}
} else {
quote! {
#field = ::yew_router::__macro::encode_for_url(&::std::format!("{}", #field))
... | fim | yewstack/yew | rust |
<|fim_suffix|>")]
#[at("/two")]
One,
}
fn main() {}
<|fim_prefix|>#[derive(yew_router::Ro<|fim_middle|>utable)]
enum Routes {
One,
}
#[derive(yew_router::Routable)]
enum RoutesTwo {
#[at("/one<|endoftext|> | fim | yewstack/yew | rust |
<|fim_prefix|>#[derive(Debug, PartialEq, yew_router:<|fim_suffix|>enum RoutesTwo {
#[at("/404")]
#[not_found]
#[not_found]
NotFound,
}
fn main() {}
<|fim_middle|>:Routable)]
enum RoutesOne {
#[at("/")]
#[not_found]
Home,
#[at("/404")]
#[not_found]
NotFound,
}
#[derive(Debug, Par... | fim | yewstack/yew | rust |
<|fim_prefix|>#[derive(yew_router::Routable, Debug, Clone, PartialEq)]
enum Routes {
#[at("/")]
Home,
#[at("/posts/:id")]
Post { id: u32 },
#[at<|fim_suffix|> { path: String },
}
fn main() {}
<|fim_middle|>("/files/*path")]
File<|endoftext|> | fim | yewstack/yew | rust |
<|fim_suffix|>,
}
fn main() {}
<|fim_prefix|>#[derive(yew_router::Routable, Debug, Cl<|fim_middle|>one, PartialEq)]
enum Routes {
#[at("/")]
Home,
#[at("/settings/{*_rest}")]
Settings<|endoftext|> | fim | yewstack/yew | rust |
<|fim_suffix|>at("one")]
One,
}
fn main() {}
<|fim_prefix|>#[deriv<|fim_middle|>e(yew_router::Routable)]
enum Routes {
#[<|endoftext|> | fim | yewstack/yew | rust |
<|fim_prefix|>#[derive(yew_router::R<|fim_suffix|>ble)]
enum Routes {
#[at("/#/one")]
One,
}
fn main() {}
<|fim_middle|>outa<|endoftext|> | fim | yewstack/yew | rust |
#[derive(yew_router::Routable)]
struct Test {}
fn main() {}
<|endoftext|> | fim | yewstack/yew | rust |
<|fim_prefix|>#[derive<|fim_suffix|>() {}
<|fim_middle|>(yew_router::Routable)]
enum Routes {
#[at("/one/{two}")]
One(u32),
}
fn main<|endoftext|> | fim | yewstack/yew | rust |
<|fim_suffix|>t("/{*all}")]
CatchAll { all: ::std::string::String },
}
fn main() {}
<|fim_prefix|>#![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... | fim | yewstack/yew | rust |
<|fim_prefix|>#[allow<|fim_suffix|>il("tests/routable_derive/*-fail.rs");
}
fn main() {}
<|fim_middle|>(dead_code)]
#[rustversion::attr(stable(1.85.0), test)]
fn tests() {
let t = trybuild::TestCases::new();
t.pass("tests/routable_derive/*-pass.rs");
t.compile_fa<|endoftext|> | fim | yewstack/yew | rust |
<|fim_prefix|>use yew::p<|fim_suffix|>tml! {
<p>{"A custom component"}</p>
}
}
#[divan::bench(sample_size = 10000000)]
fn vnode_clone(bencher: divan::Bencher) {
let html = html! {
<div class={classes!("hello-world")}>
<span>{"Hello"}</span>
<strong style="color:red">{"Wo... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::cmp::min;
use std::ops::Deref;
use std::rc::Rc;
use rand::prelude::*;
use wasm_bindgen::prelude::*;
use web_sys::window;
use yew::prelude::*;
static ADJECTIVES: &[&str] = &[
"pretty",
"large",
"big",
"small",
"tall",
"short",
"long",
"handsome",
"plain",
... | fim | yewstack/yew | rust |
<|fim_suffix|>i > 0 {
baseline_results.push(dur);
if let Some(ref bar) = bar {
bar.inc(1);
}
}
let dur = bench_hello_world().await;
if i > 0 {
hello_world_results.push... | fim | yewstack/yew | rust |
<|fim_suffix|>true"></span>
</a>
</td>
<td class="col-md-6"></td>
</tr>
}
}
}
#[wasm_bindgen(start)]
pub fn start() {
let document = window().unwrap().document().unwrap();
let mount_el = document.query_selector("#main").unwrap().unwrap... | fim | yewstack/yew | rust |
<|fim_suffix|> format!(
r#"[tools]
wasm_opt = "{latest_version}""#
)
})
.to_string()
} else {
// Add wasm_opt configuration
if content.is_empty() {
format!(
r#"[tools]
wasm_opt = "{latest_ve... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::path::Path;
use std::{env, fs};
use serde::Deserialize;
use toml::Table;
/// Examples that don't use Trunk for building
pub const NO_TRUNK_EXAMPLES: [&str; 4] = [
"simple_ssr",
"actix_ssr_router",
"axum_ssr_router",
"wasi_ssr_module",
];
#[derive(Deserialize)]
struct GitHubRele... | fim | yewstack/yew | rust |
<|fim_suffix|>, output_dir: &Path, example: &str) -> bool {
let public_url_prefix = env::var("PUBLIC_URL_PREFIX").unwrap_or_default();
let dist_dir = output_dir.join(example);
// Run trunk build command
let status = Command::new("trunk")
.current_dir(path)
.arg("build")
.arg("-... | fim | yewstack/yew | rust |
<|fim_suffix|> };
// walk over each commit find text, user, issue
let log_lines = create_log_lines(from_ref, to, package_labels, token)?;
// categorize logs
let (breaking_changes, filtered_log_lines): (Vec<_>, Vec<_>) = log_lines
.into_iter()
.partition(|log... | fim | yewstack/yew | rust |
<|fim_suffix|>_line))
}
<|fim_prefix|>use std::sync::{LazyLock, Mutex};
use anyhow::{Context, Result, anyhow};
use git2::{Error, Oid, Repository};
use regex::Regex;
use crate::github_issue_labels_fetcher::GitHubIssueLabelsFetcher;
use crate::github_user_fetcher::GitHubUsersFetcher;
use crate::log_line::LogLine;
stat... | fim | yewstack/yew | rust |
<|fim_prefix|>use anyhow::{Context, Result};
use git2::{Repository, Sort};
use crate::create_log_line::create_log_line;
use crate::github_user_fetcher::GitHubUsersFetcher;
use crate::log_line::LogLine;
pub fn create_log_lines(
from<|fim_suffix|>efault();
let from_oid = repo
.revparse_single(&from)
... | fim | yewstack/yew | rust |
<|fim_suffix|>().context("no version found")
}
<|fim_prefix|>use anyhow::{Context, Result};
use git2::Repository;
use semver::{Error, Version};
use crate::yew_package::YewPackage;
pub fn get_latest_version(package: &YewPackage) -> Result<Version> {
let common_tag_pattern = format!("{package}-v");
let search_p... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::thread;
use std::time::Duration;
use anyhow::{Result, bail};
use reqwest::blocking::Client;
use reqwest::header::{ACCEPT, AUTHORIZATION, HeaderMap, USER_AGENT};
use serde::de::DeserializeOwned;
pub fn github_fetch<T: DeserializeOwned>(url: &str, token: Option<String>) -> Result<T> {
thread:... | fim | yewstack/yew | rust |
<|fim_suffix|>istItem {
name: String,
}
#[derive(Debug, Default)]
pub struct GitHubIssueLabelsFetcher {
cache: HashMap<String, Option<Vec<String>>>,
}
impl GitHubIssueLabelsFetcher {
pub fn fetch_issue_labels(
&mut self,
issue: String,
token: Option<String>,
) -> Option<Vec<Str... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::collections::HashMap;
use anyhow::Result;
use serde::Deserialize;
use super::github_fetch::github_fetch;
#[derive(Deserialize, Debug)]
struct ResponseBody {
author: ResponseB<|fim_suffix|>ebug)]
struct ResponseBodyAuthor {
login: String,
}
#[derive(Debug, Default)]
pub struct GitHubUs... | fim | yewstack/yew | rust |
<|fim_prefix|>mod cli;
pub mod create_l<|fim_suffix|>b_issue_labels_fetcher;
pub mod github_user_fetcher;
pub mod log_line;
pub mod new_version_level;
pub mod stdout_tag_description_changelog;
pub mod write_changelog_file;
pub mod write_log_lines;
pub mod write_version_changelog;
pub mod yew_package;
pub use cli::Cli;... | fim | yewstack/yew | rust |
<|fim_suffix|> pub is_breaking_change: bool,
}
<|fim_prefix|>#[derive(Debug)]
pub struct LogLine {
pub <|fim_middle|>message: String,
pub user: String,
pub user_id: String,
pub issue_id: String,
<|endoftext|> | fim | yewstack/yew | rust |
<|fim_prefix|>use anyhow::Result;
use changelog::Cli;
use clap::Parser;
fn main() -> Result<()> {
<|fim_suffix|>
}
<|fim_middle|> Cli::parse().run()<|endoftext|> | fim | yewstack/yew | rust |
<|fim_suffix|>er;
pub mod log_line;
pub mod yew_package;
<|fim_prefix|>pub mod github_fetch;
pub mod github_issue_labels_fetcher;
pub mod git<|fim_middle|>hub_user_fetch<|endoftext|> | fim | yewstack/yew | rust |
<|fim_suffix|>patch: 0,
..current_version
},
NewVersionLevel::Major => Version {
major: current_version.major + 1,
minor: 0,
patch: 0,
..current_version
},
}
}
}
<|fim_prefix|>use semver::Vers... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::io::{Write, stdout};
use anyhow::Result;
pub fn stdout_tag_description_changelog(
fixes_logs: &[u8],
features_logs: &[u8],
breaking_changes_logs: &[u8],
) -> Result<()> {
let mut tag_changelog = Vec::new();
writeln!(tag_changelog, "# Changelog")?;
writeln!(tag_changelog... | fim | yewstack/yew | rust |
<|fim_suffix|> old_changelog_reader.lines().skip(4) {
writeln!(new_changelog, "{}", old_line?)?;
}
drop(new_changelog);
fs::remove_file(changelog_path).context(format!("Could not delete {changelog_path}"))?;
fs::rename(changelog_path_new, changelog_path).context(format!(
"Could not rep... | fim | yewstack/yew | rust |
<|fim_suffix|>ps://github.com/{user_id}), [#{issue_id}](https://github.com/yewstack/yew/pull/{issue_id})]",
)?;
}
Ok(logs_list)
}
<|fim_prefix|>use std::io::Write;
use anyhow::Result;
use crate::log_line::LogLine;
pub fn write_log_lines(log_lines: Vec<LogLine>) -> Result<Vec<u8>> {
let mut logs_l... | fim | yewstack/yew | rust |
<|fim_suffix|> writeln!(version_only_changelog)?;
version_only_changelog.extend(fixes_logs);
writeln!(version_only_changelog)?;
}
if !features_logs.is_empty() {
writeln!(version_only_changelog, "### ⚡️ Features")?;
writeln!(version_only_changelog)?;
version_only_cha... | fim | yewstack/yew | rust |
<|fim_suffix|>", "A-yew-macro", "macro"],
YewPackage::YewAgent => &["A-yew-agent"],
YewPackage::YewRouter => &["A-yew-router", "A-yew-router-macro"],
YewPackage::YewLink => &["A-yew-link", "A-yew-link-macro"],
}
}
}
<|fim_prefix|>use strum::{Display, EnumString};
#[deriv... | fim | yewstack/yew | rust |
use std::fs;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::str::FromStr;
use anyhow::Result;
use changelog::Cli;
use changelog::new_version_level::NewVersionLevel;
use changelog::yew_package::YewPackage;
use chrono::Utc;
struct FileDeleteOnDrop;
impl Drop for FileDeleteOnDrop {
fn drop(&mut self... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::io::Write;
use std::path::Path;
use std::process::Command;
use std::{env, fs};
use anyhow::{Context, Result, bail};
use regex::Regex;
use serde_json::json;
fn parse_tag(tag: &str) -> Result<(&str, &str)> {
let (package, version) = tag
.rsplit_once("-v")
.context("tag must ma... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::collections::HashMap;
use std::io;
use std::io::{Read, Write};
use anyhow::Result;
use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Serialize)]
struct GhActionBenchmark {
name: String,
unit: String,
value: Value,
}
// from https://github.com/krausest/js-framewor... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::process::ExitCode;
use std::time::Duration;
use clap::Parser;
use tokio::process::{Child, Command};
use tokio::time::{Instant, sleep};
#[derive(Parser)]
struct Args {
/// Shell command to start the SSR server
#[clap(long)]
server_cmd: String,
/// URL to poll until the server is... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::time::Duration;
use gloo::utils::document;
use wasm_bindgen::prelude::*;
use yew::Renderer;
use yew::html::BaseComponent;
/// Returns the `<div id="output">` element used by wasm-bindgen-test as the
/// test output container.
pub fn output_element() -> web_sys::Element {
document().get_elem... | fim | yewstack/yew | rust |
<|fim_suffix|>/ disregard the preamble
preamble.clear();
} else {
if !added.is_empty() || !removed.is_empty() {
diff_applied = true;
apply_diff(&mut res, &preamble, &added, &removed)?;
preamble += &added;
... | fim | yewstack/yew | rust |
<|fim_prefix|>include!(concat!(env!("OUT_DIR"), "/website<|fim_suffix|>));
<|fim_middle|>_tests.rs"<|endoftext|> | fim | yewstack/yew | rust |
<|fim_suffix|>aurus/core/lib/babel/preset')],
}
<|fim_prefix|>module.exports = {
pr<|fim_middle|>esets: [require.resolve('@docus<|endoftext|> | fim | yewstack/yew | javascript |
<|fim_suffix|>cs', version)
const localeDir = path.join(
'i18n',
locale,
'docusaurus-plugin-content-docs',
version
)
if (
!(await fs.promises.access(localeDir, fs.constants.F_OK).then(
... | fim | yewstack/yew | javascript |
<|fim_prefix|>const { API_BUTTON } = require('./src/constants')
const rustDocHiddenLines = require('./src/remark/rustDocHiddenLines')
const yewVersionUrls = require('./src/remark/yewVersionUrls')
const editUrl = 'https://github.com/yewstack/yew/blob/master/website/'
/** @type {import('@docusaurus/types').DocusaurusCo... | fim | yewstack/yew | javascript |
<|fim_prefix|>/**
*<|fim_suffix|>roup
- provide next/previous navigation
The sidebars can be generated from the filesystem, or explicitly defined here.
Create as many sidebars as you want.
*/
module.exports = {
community: [{ type: 'autogenerated', dirName: '.' }],
}
<|fim_middle|> Creating a sidebar enables y... | fim | yewstack/yew | javascript |
<|fim_prefix|>/**
* Creating a sidebar enables you to:
- create an ordered group of docs
- render a sidebar for each doc of that group
- provide next/previous navigation
The sidebars can be generated from the filesystem, or explicitly defined here.
Create as many sidebars as you want.
*/
module.exports = {
... | fim | yewstack/yew | javascript |
<|fim_suffix|>ew-router',
link: {
type: 'generated-index',
title: 'yew-router',
},
items: [
'yew-router/from-0_19_0-to-0_20_0',
'yew-router/from-0_16_0-to-0_17_0',
'yew-router/from-0_15_0-to-0_16_0',
... | fim | yewstack/yew | javascript |
<|fim_suffix|>I',
}
<|fim_prefix|>module.exports <|fim_middle|>= {
API_BUTTON: 'AP<|endoftext|> | fim | yewstack/yew | javascript |
<|fim_suffix|>iv className="card-demo">
<div className="card">
<div className="card__header">
<h3>{props.feature.header}</h3>
</div>
<div className="card__body">
<p>{props.feature.body}</p>
</div>
... | fim | yewstack/yew | typescript |
<|fim_suffix|> if (line.startsWith('## ')) {
// escape
result.push(line.slice(2))
continue
}
result.push(line)
}
node.value = result.join('\n')
})
}
}
module.exports = rustDocHiddenLines
<|f... | fim | yewstack/yew | javascript |
<|fim_suffix|> '{{yew_dependency}}': (ctx) => ctx.dependency,
// Links: `[use_future]({{yew_api}}suspense/fn.use_future.html)`
'{{yew_api}}': (ctx) => ctx.api,
// Prose: `targets Yew {{yew_version}}`
'{{yew_version}}': (ctx) => ctx.display,
}
/** Replace every known yew token in `value` using `ctx`.... | fim | yewstack/yew | javascript |
<|fim_suffix|> * the unreleased API); a `version-X` snapshot resolves to `version = "X"` and
* `docs.rs/yew/X`. Because each token is resolved from the page's own path at
* build time, the snapshots created by `docusaurus docs:version` (and their
* translations) keep resolving correctly with no manual edits — which ... | fim | yewstack/yew | javascript |
// Standalone unit test for the yew-version remark logic.
// Run with: `node src/remark/yewVersionUrls.test.js` (no build / node_modules needed).
const assert = require('assert')
const { versionContextFromPath, applyTokens } = require('./yewVersionUrls.core')
const VERSIONS = ['0.23', '0.22', '0.21', '0.20']
let passe... | fim | yewstack/yew | javascript |
<|fim_suffix|>iginalNavbarItem {...props} />
}
<|fim_prefix|>import React from 'react'
import { useLocation } from '@docusaurus/router'
export * from '@theme-original/NavbarItem/DefaultNavbarItem'
import OriginalNavbarItem from '@theme-original/NavbarItem/DefaultNavbarItem'
import { API_BUTTON } from '../../constants.j... | fim | yewstack/yew | typescript |
<|fim_suffix|>ole.error(e))
}
<|fim_prefix|>const {
i18n: { locales },
} = require('./docusaurus.config.js')
const util = require('util')
const exec = util.promisify(require('child_process').exec)
/**
* @param {string} locale
*/
async function writeTranslation(locale) {
// exec rejects when the sub<|fim_midd... | fim | yewstack/yew | javascript |
<|fim_suffix|>ponse &res) {
res.set_content("Hello World!", "text/plain");
});
svr.listen("0.0.0.0", 8080);
}
<|fim_prefix|>#include "httplib.h"
using namespace httplib;
int main() {
Server svr;
<|fim_middle|> svr.Get("/", [](const Request &, Res<|endoftext|> | fim | yhirose/cpp-httplib | cpp |
<|fim_prefix|>#include "crow_all.h"
class CustomLogger : public crow::ILogHandler {
public:
void log(const std::string &, crow::LogLevel) {}
};
int main() {
CustomLogger logger;
crow::logger::setHandler(&logger);
crow::SimpleApp <|fim_suffix|>TE(app, "/")([]() { return "Hello world!"; });
app.port(8080).m... | fim | yhirose/cpp-httplib | cpp |
<|fim_prefix|>//
// main.cc
//
// Copyright (c) 2026 Yuji Hirose. All rights reserved.
// MIT License
//
#include <atomic>
#include <chrono>
#include <ctime>
#include <format>
#include <iomanip>
#include <iostream>
#include <signal.h>
#include <sstream>
#include <httplib.h>
using namespace httplib;
const auto SE... | fim | yhirose/cpp-httplib | cpp |
<|fim_suffix|> "Model changed to '" + other_value + "'");
}
void test_download_dialog_structure(webdriver::Session &session) {
std::cout << "=== TC8: Download dialog DOM structure\n";
session.navigate(base_url);
ASSERT_ELEMENT_EXISTS(session, "#download-dialog");
ASSERT_ELEMENT_EXISTS(session, "#... | fim | yhirose/cpp-httplib | cpp |
<|fim_prefix|>// webdriver.h — Thin W3C WebDriver client using cpp-httplib + nlohmann/json.
// SPDX-License-Identifier: MIT
//
// Usage:
// webdriver::Session session; // starts headless Firefox via geckodriver
// session.navigate("http://localhost:8080");
// auto el = session.css("h1");
// assert(el.text() ==... | fim | yhirose/cpp-httplib | c |
<|fim_suffix|>header", "text/plain");
return;
}
std::cout << "Client Accept header: " << accept_header << std::endl;
std::cout << "Preferred types in order:" << std::endl;
for (size_t i = 0; i < preferred_types.size(); ++i) {
std::cout << " " << (i + 1) ... | fim | yhirose/cpp-httplib | cpp |
<|fim_suffix|>art_;
auto count = chrono::duration_cast<chrono::milliseconds>(diff).count();
cout << label_ << ": " << count << " millisec." << endl;
}
string label_;
chrono::system_clock::time_point start_;
};
int main(void) {
string body(1024 * 5, 'a');
httplib::Client cli("httpcan.org", 80);
fo... | fim | yhirose/cpp-httplib | cpp |
<|fim_prefix|>//
// client.cc
//
// Copyright (c) 2026 Yuji Hirose. All rights reserved.
// MIT License
//
#include <httplib.h>
#include <iostream>
#define CA_CERT_FILE "./ca-bundle.crt"
using namespace std;
int main(void) {
#ifdef CPPHTTPLIB_OPENSSL_SUPPORT
httplib::SSLClient cli("localhost", 8080);
// http... | fim | yhirose/cpp-httplib | cpp |
<|fim_prefix|>//
// hello.cc
//
// Copyright (c) 2026 Yuji Hirose<|fim_suffix|> res.set_content("Hello World!", "text/plain");
});
svr.listen("0.0.0.0", 8080);
}
<|fim_middle|>. All rights reserved.
// MIT License
//
#include <httplib.h>
using namespace httplib;
int main(void) {
Server svr;
svr.Get("/hi"... | fim | yhirose/cpp-httplib | cpp |
<|fim_suffix|>;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
send_request("2nd");
std::this_thread::sleep_for(std::chrono::milliseconds(100));
send_request("3rd");
std::this_thread::sleep_for(std::chrono::milliseconds(100));
th1.join();
th2.join();
}
<|fim_prefix|>#include <httplib.h>
#... | fim | yhirose/cpp-httplib | cpp |
<|fim_prefix|>//
// redirect.cc
//
// Copyright (c) 2026 Yuji Hirose. All rights reserved.
// MIT License
//
#include <httplib.h>
#define SERVER_CERT_FILE "./cert.pem"
#define SERVER_PRIVATE_KEY_FILE "./key.pem"
using namespace httplib;
int main(void) {
// HTTP server
Server http;
<|fim_suffix|>ndif
httpT... | fim | yhirose/cpp-httplib | cpp |
//
// sample.cc
//
// Copyright (c) 2026 Yuji Hirose. All rights reserved.
// MIT License
//
#include <chrono>
#include <cstdio>
#include <httplib.h>
#define SERVER_CERT_FILE "./cert.pem"
#define SERVER_PRIVATE_KEY_FILE "./key.pem"
using namespace httplib;
std::string dump_headers(const Headers &headers) {
std... | fim | yhirose/cpp-httplib | cpp |
<|fim_prefix|>//
// server_and_client.cc
//
// Copyright (c) 2026 Yuji Hirose. All rights reserved.
// MIT License
//
#include <httplib.h>
#include <iostream>
#include <string>
using namespace httplib;
std::string dump_headers(const Headers &headers) {
std::string s;
char buf[BUFSIZ];
for (auto it = header... | fim | yhirose/cpp-httplib | cpp |
<|fim_suffix|>https://localhost:8080";
#else
auto scheme_host_port = "http://localhost:8080";
#endif
if (auto res = httplib::Client(scheme_host_port).Get("/hi")) {
cout << res->status << endl;
cout << res->get_header_value("Content-Type") << endl;
cout << res->body << endl;
} else {
cout << res.e... | fim | yhirose/cpp-httplib | cpp |
<|fim_prefix|>//
// simplesvr.cc
//
// Copyright (c) 2026 Yuji Hirose. All rights reserved.
// MIT License
//
#include <cstdio>
#include <httplib.h>
#include <iostream>
#define SERVER_CERT_FILE "./cert.pem"
#define SERVER_PRIVATE_KEY_FILE "./key.pem"
using namespace httplib;
using namespace std;
string dump_head... | fim | yhirose/cpp-httplib | cpp |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.