text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>_patterns = eat2 "--trace-patterns"
if wsl && ssh.IsSome then
failwith "--wsl and --ssh cannot be used together."
if nvr.IsSome && (wsl || ssh.IsSome || fvr.IsSome) then
failwith "--nvr cannot be used with --fvr, --wsl or --ssh."
let norc =
args
|> Seq.... | fim | yatli/fvim | fsharp |
<|fim_suffix|>) -> Normal "$"
| Key(HasFlag(KeyModifiers.Shift), Key.D5) -> Normal "%"
| Key(HasFlag(KeyModifiers.Shift), Key.D6) -> Normal "^"
| Key(HasFlag(KeyModifiers.Shift), Key.D7) -> Normal "&"
| Key(HasFlag(KeyModifiers.... | fim | yatli/fvim | fsharp |
<|fim_prefix|>module FVim.log
open getopt
open System.Diagnostics
open FSharp.Control.Reactive
open System.Collections.Generic
let mutable private _filter = fun _ -> true
let private _logsSource = Event<string*strin<|fim_suffix|>
match intent with
| Daemon _ -> "fvim-daemon"
| _ -> "fvim"
... | fim | yatli/fvim | fsharp |
<|fim_suffix|> int) =
nvim.call {method = "nvim_win_close"; parameters = mkparams2 win true}
|> ignore
let EditFiles (files: string seq) =
backgroundTask {
for file in files do
let! _ = nvim.edit file
in ()
} |> ignore
let InsertText text =
let sb = new Text.StringBuilde... | fim | yatli/fvim | fsharp |
<|fim_prefix|>module FVim.msgpack
open common
open System.Buffers
open MessagePack
open MessagePack.Resolvers
open MessagePack.Formatters
type MsgPackMatchState =
| Init = 0
| WaitDict = 1
| GetBinaryData = 2
type MsgPackFormatter(resolver: IFormatterResolver) =
let m_formatter = resolver.GetFormatter<obj>()
l... | fim | yatli/fvim | fsharp |
<|fim_suffix|>tion)
pipe.Connect()
trace "Connected, sending session request..."
let id = fvrConnect pipe pipe verb
if id < 0 then
pipe.Dispose()
getErrorMsg id |> failwith
RemoteSession pipe
| FVimRemote(pipe, Remote(prog,... | fim | yatli/fvim | fsharp |
<|fim_prefix|>#r "packages/FSharp.Data/lib/netstandard2.0/FSharp.Data.dll"
open FSharp.Data
open System
type Emoji = CsvProvider<"emoji.tsv", "\t">
let emoji = Emoji.Load("emoji.tsv")
type EmojiCodepoint =
{
Codepoint: int
Remarks: string
}
let _null = {Codepoint=0x0;Remarks=""}
let getCod... | fim | yatli/fvim | fsharp |
<|fim_prefix|>module FVim.shell
// Provides shell integration for supported platforms
//
open log
open getopt
open common
open System
open System.IO
open System.Reflection
open System.Diagnostics
open System.Runtime.InteropServices
open System.Linq
open Microsoft.Win32
open UACHelper
let inline private trace x = tr... | fim | yatli/fvim | fsharp |
module FVim.states
open common
open def
open SkiaSharp
open Avalonia.Media
open Avalonia.Layout
// channel
let mutable channel_id = 1
// keyboard mapping
let mutable key_disableShiftSpace = false
let mutable key_autoIme = false
let mutable key_altGr = false
// clipboard
let mutable clipboard_lines: string[] = [||]
... | fim | yatli/fvim | fsharp |
<|fim_prefix|>module FVim.svg
open common
open ShimSkiaSharp
open Avalonia.Svg.Commands
open System.Collections.Generic
open System
open Avalonia.Media.Immutable
open Avalonia
open Avalonia.Media
open Avalonia.Svg
let private s_assetLoader = new AvaloniaAssetLoader() :> Svg.Model.IAssetLoader
let private s_factory ... | fim | yatli/fvim | fsharp |
<|fim_suffix|> Some fg
background = Some bg
special = Some sp
reverse = false
italic = false
bold = false
underline = false
undercurl = false
}
}
(*trace "setDefaultColors: %A %A %A" fg bg sp*)
let setOption (opt: UiOp... | fim | yatli/fvim | fsharp |
<|fim_prefix|>module FVim.ui
open common
open def
open wcwidth
open log
open Avalonia
open Avalonia.Input
open Avalonia.Media
open Avalonia.Media.Imaging
open Avalonia.Platform
open Avalonia.Skia
open System
open Avalonia.Media.TextFormatting
open System.Globalization
open SkiaSharp
open Avalonia.Interactivity
#now... | fim | yatli/fvim | fsharp |
<|fim_suffix|>hi Sign Anusvara
(0x110b3u, 0x110b6u) // Kaithi Vowel Sign U ..Kaithi Vowel Sign Ai
(0x110b9u, 0x110bau) // Kaithi Sign Virama ..Kaithi Sign Nukta
(0x11100u, 0x11102u) // Chakma Sign Candrabindu ..Chakma Sign Visarga
(0x11127u, 0x1112bu) // Chakma Vowel Sign A ..Chakma Vow... | fim | yatli/fvim | fsharp |
<|fim_prefix|>#r "nuget: FSharp.Control.Reactive"
#r "nuget: FSharp.Data"
#r "nuget: System.Reactive.Linq"
#r "nuget: Avalonia, 0.10.0-preview6"
#r "nuget: Avalonia.Desktop, 0.10.0-preview6"
#r "nuget: Avalonia.ReactiveUI, 0.10.0-preview6"
#r "nuget: Avalonia.Skia, 0.10.0-preview6"
#load "common.fs"
#load "getopt.fs"
... | fim | yatli/fvim | fsharp |
module FVim.widgets
open common
open def
open theme
open svg
open Avalonia
open Avalonia.Layout
open Avalonia.Media
open Avalonia.Media.Imaging
open System.IO
open System.Text
let mutable guiwidgetNamespace = -1
type SignPlacement =
{
line: int
kind: SignKind
}
type CursorHide =
| NoHide
|... | fim | yatli/fvim | fsharp |
<|fim_prefix|>from typing import Dict, List, Optiona<|fim_suffix|>fo, indent=4))
if __name__ == "__main__":
main()
<|fim_middle|>l
from pathlib import Path
import glob
import os
import json
def find_example_sizes(parent_dir: Path) -> Dict[str, int]:
example_sizes: Dict[str, int] = {}
for example_dist_... | fim | yewstack/yew | python |
<|fim_prefix|>from typing import Dict, List, Optional, Tuple
import os
import json
header = "| Benchmark | Round | Min (ms) | Max (ms) | Mean (ms) | Standard Deviation |"
sep = "| --- | --- | --- | --- | --- | --- |"
def write_benchmark(lines: List[str], c<|fim_suffix|>utput.json") as f:
pr_content = json.... | fim | yewstack/yew | python |
<|fim_prefix|>from typing import Dict, List, Optional, Tuple
import os
import json
header = "| examples | master (KB) | pull request (KB) | diff (KB) | diff (%) |"
sep = "| --- | --- | --- | --- | --- |"
def format_size(size: Optional[int]) -> str:
if size is None:
return "N/A"
if size == 0:
... | fim | yewstack/yew | python |
use actix_ssr_router::{App, AppProps, LINK_ENDPOINT};
fn main() {
#[cfg(target_arch = "wasm32")]
{
let fmt_layer = tracing_subscriber::fmt::layer()
.with_ansi(false) // Only partially supported across browsers
.without_time() // std::time is not available in browsers
... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::collections::HashMap;
use std::io::Result as IoResult;
use std::path::PathBuf;
use actix_cors::Cors;
use actix_files::Files;
use actix_ssr_router::{
LINK_ENDPOINT, LinkedAuthor, LinkedPost, LinkedPostMeta, ServerApp, ServerAppProps,
};
use actix_web::http::Uri;
use actix_web::web::{Data, Que... | fim | yewstack/yew | rust |
<|fim_suffix|> { "It wouldn't be fair " }
<i>{ "(or possible :P)" }</i>
{" to list each and every author in alphabetical order."}
<br />
{ "So instead we chose to put more focus on the individuals by introducing you to two people at a time" ... | fim | yewstack/yew | rust |
<|fim_prefix|>#![cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use actix_ssr_router::{App, AppProps, LINK_ENDPOINT};
use ssr_e2e_harness::{
assert_hydrate_home, assert_ssr_hydration_and_client_navigation, output_element,
};
use wasm_bindgen_test::*;
use y<|fim_suffix|>T).await;
}
#[wasm_bindgen_test]... | fim | yewstack/yew | rust |
<|fim_suffix|>.joke = Some(joke.clone());
// Reset the fun score
self.fun_score = None;
// Send the joke to the background task that computes the fun score.
self.fun_score_channel
.send_now(joke)
.expect("failed to... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::time::Duration;
use chrono::{DateTime, Local};
use futures::{Stream, StreamExt};
use gloo_net::http::Request;
use yew::platform::pinned::mpsc::UnboundedSender;
use yew::platform::spawn_local;
use yew::platform::time::{interval, sleep};
use yew::{AttrValue, Callback};
const ONE_SEC: Duration = D... | fim | yewstack/yew | rust |
<|fim_prefix|>use axum_ssr_router::{App, AppProps, LINK_ENDPOINT};
fn main() {
#[cfg(target_arch = "wasm32")]
{
let fmt_layer = tracing_subscriber::fmt::layer()
.with_ansi(false) // Only partially supported across browsers
.without_time() // std::time is not available in browser... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::collections::HashMap;
use std::convert::Infallible;
use std::net::SocketAddr;
use std::path::PathBuf;
use axum::Router;
use axum::body::Body;
use axum::extract::{Query, Request, State};
use axum::handler::HandlerWithoutStateExt;
use axum::http::Uri;
use axum::response::IntoResponse;
use axum::ro... | fim | yewstack/yew | rust |
<|fim_suffix|> <div class="column">
<ul class="list">
for offset in half..ITEMS_PER_PAGE {
<li class="list-item mb-5">
<Suspense fallback={html! { <div class="card"><div class="card-content">{"Loading..."}</div><... | fim | yewstack/yew | rust |
<|fim_prefix|>#![cfg(all(target_arch = "wasm32", not(target_os = "wasi")))]
use axum_ssr_router::{App, AppProps, LINK_ENDPOINT};
use ssr_e2e_harness::{
assert_hydrate_home, assert_ssr_hydration_and_client_navigation, output_element,
};
use wasm_bindgen_test::*;
use yew::Renderer;
wasm_bindgen_test_configure!(run_... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::iter;
use rand::RngExt;
use crate::math::{self, Mean, Vector2D, WeightedMean};
use crate::settings::Settings;
use crate::simulation::SIZE;
#[derive(Clone, Debug, PartialEq)]
pub struct Boid {
pub position: Vector2D,
pub velocity:<|fim_suffix|>ttings) -> Vector2D {
let accel = b... | fim | yewstack/yew | rust |
<|fim_suffix|>ettings.separation_factor}
/>
<Slider label="Alignment"
max=0.5 percentage=true
onchange={settings_callback!(link, settings; alignment_factor)}
value={settings.alignment_factor}
/>
<... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::f64::consts::{FRAC_PI_3, PI};
use std::iter::Sum;
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign};
// at the time of writing the TAU constant is still unstable
pub const TAU: f64 = 2.0 * PI;
pub const FRAC_TAU_3: f64 = 2.0 * FRAC_PI_3;
/// Get the smaller sig... | fim | yewstack/yew | rust |
<|fim_prefix|>use gloo::storage::{LocalStorage, Storage};
use serde::{Deserialize, Serialize};
#[derive(C<|fim_suffix|> color_adapt_factor: 0.05,
}
}
}
<|fim_middle|>lone, Debug, PartialEq, Deserialize, Serialize)]
pub struct Settings {
/// amount of boids
pub boids: usize,
// time between ea... | fim | yewstack/yew | rust |
<|fim_suffix|>tx.props().generation;
Self {
boids,
interval,
generation,
}
}
fn update(&mut self, ctx: &Context<Self>, msg: Self::Message) -> bool {
match msg {
Msg::Tick => {
let Props {
ref settings,
... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::cell::Cell;
use web_sys::HtmlInputElement;
use yew::events::InputEvent;
use yew::{Callback, Component, Context, Html, Properties, TargetCast, html};
thread_local! {
static SLIDER_ID: Cell<usize> = Cell::default();
}
fn next_slider_id() -> usize {
SLIDER_ID.with(|cell| cell.replace(cell.... | fim | yewstack/yew | rust |
<|fim_suffix|> }
}
}
<|fim_prefix|>use super::*;
/// The `Child` component is the child of the `Parent` component, and will send updates to the
/// parent using a Callback.
pub struct Child;
#[derive(Clone, PartialEq, Properties)]
pub struct ChildProps {
pub name: AttrValue,
pub on_clicked: Callbac... | fim | yewstack/yew | rust |
<|fim_prefix|>use child::Chi<|fim_suffix|>, Html, Properties, html};
mod child;
mod parent;
fn main() {
yew::Renderer::<Parent>::new().render();
}
<|fim_middle|>ld;
use parent::Parent;
use yew::{AttrValue, Callback, Component, Context<|endoftext|> | fim | yewstack/yew | rust |
<|fim_suffix|>ent">
<span>{ "My children have been clicked " }<span>{ self.total_clicks }</span>{ " times." }</span>
<span>{ last_updated_msg }</span>
<div>
<Child name="Alice" on_clicked={on_clicked.clon... | fim | yewstack/yew | rust |
<|fim_prefix|>use super::*;
/// The `Child` component is the child of the `Parent` component, and will send and receive updates
/// to/from the grandparent using the context.
pub struct Chi<|fim_suffix|>of
// context in a functional component, have a look at the `examples/contexts` code.
let (state, _l... | fim | yewstack/yew | rust |
<|fim_prefix|>use super::*;
pub enum Msg {
ButtonClick(AttrValue),
}
/// Our top-level (grandparent) component that holds a reference to the shared state.
pub struct GrandParent {
state: Rc<AppState>,
}
impl Component for GrandParent {
type Message = Msg;
type Properties = ();
fn create(ctx: &Con... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::rc::Rc;
use child::Child;
use grandparent::GrandParent;
use parent::Parent;
mod child;
mod grandparent;
mod parent;
use yew::{
AttrValue, Callback, Component, Context, ContextHandle, ContextProvider, Html, Properties,
function_component, html,
};
/// This is the shared state between t... | fim | yewstack/yew | rust |
<|fim_suffix|>lice" />
<Child name="Bob" />
</div>
</div>
}
}
<|fim_prefix|>use super::*;
/// The `Parent` component is the parent of the `Child` component. It has no logic, and is here to
/// show there is no direct relation between grandchild and grandparent.
#[function_compon... | fim | yewstack/yew | rust |
<|fim_suffix|>
<div class="child-body">
<div class="child-tag">
<span>{ "Child" }</span>
</div>
<div class="child-content">
<span>{ "My grandparent has been clicked " }<span>{ self.state.total_clicks }</span>{ " times." ... | fim | yewstack/yew | rust |
use super::*;
/// Our top-level (grandparent) component that holds a reference to the shared state.
pub struct GrandParent {
state: Rc<AppState>,
}
pub enum Msg {
ButtonClick,
}
impl Component for GrandParent {
type Message = Msg;
type Properties = ();
fn create(_ctx: &Context<Self>) -> Self {
... | fim | yewstack/yew | rust |
<|fim_suffix|>arent>::new().render();
}
<|fim_prefix|>use std::rc::Rc;
use child::Child;
use grandparent::GrandParent;
use parent::Parent;
mod child;
mod grandparent;<|fim_middle|>
mod parent;
use yew::{Component, Context, ContextHandle, ContextProvider, Html, function_component, html};
/// This is the shared state... | fim | yewstack/yew | rust |
<|fim_suffix|>"parent-tag">
<span>{ "Parent" }</span>
</div>
<div class="parent-content">
<Child />
</div>
</div>
}
}
<|fim_prefix|>use super::*;
/// The `Parent` component is the parent of the `Child` component. It has no logic, and is he... | fim | yewstack/yew | rust |
<|fim_prefix|>use super::*;
/// The `Child` component is the child of the `Parent` component, and will receive updates from the
/// parent using properties.
pub struct Child;
#[derive(Clone, Eq, Partia<|fim_suffix|> Self {}
}
fn view(&self, ctx: &Context<Self>) -> Html {
html! {
<div clas... | fim | yewstack/yew | rust |
<|fim_suffix|>use yew::{Component, Context, Html, Properties, html};
mod child;
mod parent;
fn main() {
yew::Renderer::<Parent>::new().render();
}
<|fim_prefix|>use child::Chil<|fim_middle|>d;
use parent::Parent;
<|endoftext|> | fim | yewstack/yew | rust |
use super::*;
/// The `Parent` component holds some state that is passed down to the children.
pub struct Parent {
/// The total number of clicks received
nr_of_clicks: u32,
}
pub enum Msg {
ButtonClick,
}
impl Component for Parent {
type Message = Msg;
type Properties = ();
fn create(_ctx: ... | fim | yewstack/yew | rust |
<|fim_prefix|>mod msg_ctx;
mod producer;
mod struct_component_producer;
mod struct_component_subscriber;
mod subscriber;
use msg_ctx::MessageProvider;
use produc<|fim_suffix|>) -> Html {
html! {
<MessageProvider>
<Producer />
<StructComponentProducer />
<Subscriber />
... | fim | yewstack/yew | rust |
<|fim_suffix|>ialEq)]
pub struct MessageProviderProps {
#[prop_or_default]
pub children: Html,
}
#[function_component]
pub fn MessageProvider(props: &MessageProviderProps) -> Html {
let msg = use_reducer(|| Message {
inner: "No message yet.".to_string(),
});
html! {
<ContextProvide... | fim | yewstack/yew | rust |
<|fim_suffix|> let msg_ctx = use_context::<MessageContext>().unwrap();
html! {
<button onclick={move |_| msg_ctx.dispatch("Message Received.".to_string())}>
{"PRESS ME"}
</button>
}
}
<|fim_prefix|>use yew::prelude::*;
use super::msg_ctx::MessageContext;
#[functi<|fim_middle|>on... | fim | yewstack/yew | rust |
<|fim_suffix|> .link()
.context::<MessageContext>(Callback::noop())
.expect("No Message Context Provided");
html! {
<button onclick={move |_| msg_ctx.dispatch("Other message received.".to_owned())}>
{"OR ME"}
</button>
}
}
}
<|fim_pref... | fim | yewstack/yew | rust |
<|fim_prefix|>use yew::prelude::*;
use super::msg_ctx::MessageContext;
pub enum Msg {
MessageContextUpdated(MessageContext),
}
pub struct StructComponentSubscriber {
message: MessageContext,
_context_listen<|fim_suffix|><|fim_middle|>er: ContextHandle<MessageContext>,
}
impl Component for StructComponen... | fim | yewstack/yew | rust |
<|fim_suffix|>et message = msg_ctx.inner.to_owned();
html! {
<h1>{ message }</h1>
}
}
<|fim_prefix|>use yew::prelude::*;
use super::msg_ctx:<|fim_middle|>:MessageContext;
#[function_component]
pub fn Subscriber() -> Html {
let msg_ctx = use_context::<MessageContext>().unwrap();
l<|endoftext|... | fim | yewstack/yew | rust |
<|fim_suffix|>f>) -> Html {
html! {
<div>
<div class="panel">
// A button to send the Increment message
<button class="button" onclick={ctx.link().callback(|_| Msg::Increment)}>
{ "+1" }
</button>
... | fim | yewstack/yew | rust |
<|fim_suffix|>}
fn main() {
yew::Renderer::<App>::new().render();
}
<|fim_prefix|>use yew::prelude::*;
#[function_component]
fn App() -> Html {
let state = use_state(|| 0);
let incr_counter = {
let state = state.clone();
Callback::from(move |_| state.set(*state + 1))
};
let decr_... | fim | yewstack/yew | rust |
<|fim_suffix|>nter }
{ " ticks" }
</p>
// Add button to send a destroy command to the parent app
<button class="destroy" onclick={Callback::from(move |_| destroy_callback.emit(()))}>
{ "Destroy this app" }
</button>
}
}
fn... | fim | yewstack/yew | rust |
<|fim_suffix|>ontext<Self>) -> Html {
// We will only render once, and then do the rest of the DOM changes
// by mounting/destroying appinstances of CounterModel
html! {
<div class="panel">
// Create button to create a new app
<button
... | fim | yewstack/yew | rust |
<|fim_prefix|>extern crate base64;
use std::collections::HashMap;
use base64::Engine;
use base64::engine::general_purpose::STANDARD;
use gloo::file::callbacks::FileReader;
use web_sys::{DragEvent, Event, HtmlInputElement};
use yew::html::TargetCast;
use yew::{Callback, Component, Context, Html, html};
pub struct File... | fim | yewstack/yew | rust |
<|fim_suffix|> </div>
</div>
}
}
fn main() {
yew::Renderer::<App>::new().render();
}
<|fim_prefix|>use std::time::Duration;
use gloo_timers::callback::Timeout;
use<|fim_middle|> web_sys::HtmlInputElement;
use web_sys::wasm_bindgen::JsCast;
use yew::*;
#[component]
fn App() -> Html {
#[derive(Partia... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::cell::RefCell;
use std::rc::Rc;
use gloo::timers::callback::{Interval, Timeout};
use yew::prelude::*;
use yew::{function_component, html};
use crate::components::chessboard::Chessboard;
use crate<|fim_suffix|>st_score} />
<Chessboard cards={state.cards.clone()} {on_flip} />
... | fim | yewstack/yew | rust |
use yew::prelude::*;
use crate::components::chessboard_card::ChessboardCard;
use crate::state::{Card, RawCard};
#[derive(Properties, Clone, PartialEq)]
pub struct Props {
pub cards: Vec<Card>,
pub on_flip: Callback<RawCard>,
}
#[component]
pub fn Chessboard(props: &Props) -> Html {
html! {
<div cl... | fim | yewstack/yew | rust |
<|fim_prefix|>use web_sys::MouseEvent;
use yew::prelude::*;
use yew::{Html, Properties, function_component, html};
use crate::constant::CardName;
use crate::state::{Card, RawCard};
#[derive(Properties, Clone, PartialEq)]
pub struct Props {
pub card: Card,
pub on_flip: Callback<RawCard>,
}
#[function_componen... | fim | yewstack/yew | rust |
<|fim_suffix|> html! {
<div class="game-status-container">
match props.status {
Status::Ready => <span>{"Ready"}</span>,
Status::Playing => <span>{"Playing"}</span>,
Status::Passed => {
let onclick = props.on_reset.reform(move |e: MouseEvent| {
... | fim | yewstack/yew | rust |
<|fim_suffix|> <GameProgress {unresolved_card_pairs} />
<BestScore {best_score} />
</div>
}
}
<|fim_prefix|>use yew::{Html, Properties, function_component, html};
use crate::components::score_board_best_score::BestScore;
use crate::components::score_board_logo::Logo;
use crate::components::... | fim | yewstack/yew | rust |
<|fim_prefix|>use yew::{Html, Properties, function_component<|fim_suffix|>n BestScore(props: &Props) -> Html {
html! {
<div class="best-score">
<span>{"Highest Record"}</span>
<h2>{ props.best_score }</h2>
</div>
}
}
<|fim_middle|>, html};
#[derive(PartialEq, Eq, Propert... | fim | yewstack/yew | rust |
use yew::{Html, function_component, html};
#[function_component]
pub fn Logo() -> Html {
html! {
<h1 class="logo">
<a href="https://examples.yew.rs/function_memory_game" target="_blank">{"Memory"}</a>
</h1>
}
}
<|endoftext|> | fim | yewstack/yew | rust |
use yew::{Html, Properties, function_component, html};
#[derive(PartialEq, Eq, Properties, Clone)]
pub struct Props {
pub unresolved_card_pairs: u8,
}
#[function_component]
pub fn GameProgress(props: &Props) -> Html {
html! {
<div class="game-progress">
<span>{"Cards not Matched"}</span>
... | fim | yewstack/yew | rust |
<|fim_suffix|> mod score_board_progress;
<|fim_prefix|>pub mod app;
pub mo<|fim_middle|>d chessboard;
pub mod chessboard_card;
pub mod game_status_board;
pub mod score_board;
pub mod score_board_best_score;
pub mod score_board_logo;
pub<|endoftext|> | fim | yewstack/yew | rust |
<|fim_suffix|>ardName::Kronos,
CardName::BakedPotato,
CardName::Dinosaur,
CardName::Rocket,
CardName::SkinnyUnicorn,
CardName::ThatGuy,
CardName::Zeppelin,
];
<|fim_prefix|>use serde::{Deserialize, Serialize};
use strum_macros::{Display, EnumIter};
pub const KEY_BEST_SCORE: &str = "memory.game.... | fim | yewstack/yew | rust |
<|fim_suffix|> flipped: false,
name: p,
})
.collect()
}
<|fim_prefix|>use nanoid::nanoid;
use rand::rng;<|fim_middle|>
use rand::seq::SliceRandom;
use crate::constant::RAW_CARDS;
use crate::state::Card;
pub fn shuffle_cards() -> Vec<Card> {
let mut raw_cards = RAW_CARDS;
raw_... | fim | yewstack/yew | rust |
<|fim_suffix|>fn main() {
yew::Renderer::<App>::new().render();
}
<|fim_prefix|>mod c<|fim_middle|>omponents;
mod constant;
mod helper;
mod state;
use crate::components::app::App;
<|endoftext|> | fim | yewstack/yew | rust |
<|fim_prefix|>use std::rc::Rc;
use gloo::storage::{LocalStorage, Storage};
use serde::{Deserialize, Serialize};
use yew::prelude::*;
use crate::constant::{CardName, KEY_BEST_SCORE, Status};
use crate::helper::shuffle_cards;
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
pub struct RawCard {
pub i... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::collections::HashMap;
use yew::prelude::*;
use yew_router::history::{AnyHistory, History, MemoryHistory};
use yew_router::prelude::*;
use crate::components::nav::Nav;
use crate::pages::author::Author;
use crate::pages::author_list::AuthorList;
use crate::pages::home::Home;
use crate::pages::pag... | fim | yewstack/yew | rust |
<|fim_prefix|>pub use function_router::<|fim_suffix|>;
yew::Renderer::<App>::new().render();
}
<|fim_middle|>*;
fn main() {
wasm_logger::init(wasm_logger::Config::new(log::Level::Trace))<|endoftext|> | fim | yewstack/yew | rust |
use std::rc::Rc;
use yew::prelude::*;
use yew_router::prelude::*;
use crate::Route;
use crate::content::Author;
use crate::generator::Generated;
#[derive(Clone, Debug, PartialEq, Eq, Properties)]
pub struct Props {
pub seed: u32,
}
#[derive(PartialEq, Eq, Debug)]
pub struct AuthorState {
pub inner: Author,
... | fim | yewstack/yew | rust |
<|fim_prefix|>pub mod aut<|fim_suffix|>mod pagination;
pub mod post_card;
pub mod progress_delay;
<|fim_middle|>hor_card;
pub mod nav;
pub <|endoftext|> | fim | yewstack/yew | rust |
<|fim_prefix|>use yew::prelude::*;
use yew_router::prelude::*;
use crate::Route;
#[function_component]
pub fn Nav() -> Html {
let navbar_active = use_state_eq(|| false);
let toggle_navbar = {
let navbar_active = navbar_active.clone();
Callback::from(move |_| {
navbar_active.set(!... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::ops::Range;
use serde::{Deserialize, Serialize};
use yew::prelude::*;
use yew_router::prelude::*;
use crate::Route;
const ELLIPSIS: &str = "\u{02026}";
#[derive(Serialize, Deserialize, PartialEq, Eq, Clone, Debug)]
pub struct PageQuery {
pub page: u32,
}
#[derive(Clone, Debug, PartialEq,... | fim | yewstack/yew | rust |
<|fim_prefix|>use std::rc::Rc;
use yew::prelude::*;
use yew_router::components::Link;
use crate::Route;
use crate::content::PostMeta;
use crate::generator::Generated;
#[derive(Clone, Debug, PartialEq, Eq, Properties)]
pub struct Props {
pub seed: u32,
}
#[derive(PartialEq, Eq, Debug)]
pub struct PostMetaState {... | fim | yewstack/yew | rust |
use std::rc::Rc;
use gloo::timers::callback::Interval;
use instant::Instant;
use yew::prelude::*;
const RESOLUTION: u32 = 500;
const MIN_INTERVAL_MS: u32 = 50;
pub enum ValueAction {
Tick,
Props(Props),
}
#[derive(Clone, PartialEq, Debug)]
pub struct ValueState {
start: Instant,
value: f64,
pr... | fim | yewstack/yew | rust |
<|fim_suffix|>nge(PARAGRAPHS_MIN, PARAGRAPHS_MAX);
let paragraphs = (0..n_paragraphs).map(|_| r#gen.paragraph()).collect();
let image_url = r#gen.image_url((200, 100), &[]);
Self {
title,
paragraphs,
image_url,
}
}
}
#[derive(Clone, Debug, Eq, Pa... | fim | yewstack/yew | rust |
<|fim_suffix|>f.sentence());
}
paragraph
}
}
fn join_words<'a>(words: impl Iterator<Item = &'a str>) -> String {
let mut result = String::new();
for (i, word) in words.enumerate() {
if i > 0 {
result.push(' ');
}
if i == 0 {
result.push_str(&t... | fim | yewstack/yew | rust |
<|fim_suffix|> Generate a procedural image and return it as PNG bytes.
pub fn generate_png(width: u32, height: u32, seed: u32) -> Vec<u8> {
let img = generate_image(width, height, seed);
let mut bytes: Vec<u8> = Vec::new();
img.write_to(&mut Cursor::new(&mut bytes), image::ImageFormat::Png)
.expect(... | fim | yewstack/yew | rust |
// # Implementation Note:
//
// This example is also used to demonstrate SSR hydration.
// It is important to follow the following rules when updating this example:
//
// - Do not use usize for randomised contents.
//
// usize differs in memory size in 32-bit and 64-bit targets (wasm32 is a 32-bit target family.)
// ... | fim | yewstack/yew | rust |
<|fim_suffix|>pan>
}
</div>
</article>
</div>
<div class="tile is-parent">
<figure class="tile is-child image is-square">
<img alt="The author's... | fim | yewstack/yew | rust |
<|fim_prefix|>use rand::{RngExt, distr};
use yew::prelude::*;
use crate::components::author_ca<|fim_suffix|> </div>
</div>
</section>
<p class="section py-0">
{ "It wouldn't be fair " }
<i>{ "(or possible :P)" }</i>
{" to lis... | fim | yewstack/yew | rust |
<|fim_prefix|>use yew::prelude::*;
#[function_component]
fn InfoTiles() -> Html {
html! {
<div class="tile is-parent">
<div class="tile is-child box">
<p class="title">{ "What are yews?" }</p>
<p class="subtitle">{ "Everything you need to know!" }</p>
... | fim | yewstack/yew | rust |
<|fim_prefix|>pub mod aut<|fim_suffix|>post_list;
<|fim_middle|>hor;
pub mod author_list;
pub mod home;
pub mod page_not_found;
pub mod post;
pub mod <|endoftext|> | fim | yewstack/yew | rust |
<|fim_prefix|>use yew::prelude::*;
#[function_component]
pub fn PageNotFound() -> Html {
html! {
<section class="hero is-danger is-bold is-large">
<div class="hero-body">
<div class="container">
<h1 class="title">
{ "Page not found" }
... | fim | yewstack/yew | rust |
<|fim_suffix|>o-background is-transparent" src={post.meta.image_url.clone()} />
<div class="hero-body">
<div class="container">
<h1 class="title">
{ &post.meta.title }
</h1>
<h2 class="subtitle">
... | fim | yewstack/yew | rust |
<|fim_suffix|>i class="list-item mb-5">
<PostCard seed={start_seed + seed_offset} />
</li>
}
</ul>
</div>
</div>
}
};
html! {
<div class="section container">
... | fim | yewstack/yew | rust |
<|fim_prefix|>use web_sys::{HtmlInputElement, MouseEvent};
use yew::events::{Event, FocusEvent, KeyboardEvent};
use yew::prelude::*;
use crate::hooks::use_bool_toggle::use_bool_toggle;
use crate::state::Entry as Item;
#[derive(PartialEq, Properties, Clone)]
pub struct EntryProps {
pub entry: Item,
pub ontoggl... | fim | yewstack/yew | rust |
<|fim_prefix|>use yew::prelude::*;
use crate::state::Filter as FilterEnum;
#[derive(PartialEq, Properties)]
pub struct FilterProps {
pub filter: FilterEnum,
pub selected: bool,
pub onset_filter: Callback<FilterEnum>,
}
#[function_component]
pub fn Filter(props: &FilterProps) -> Html {
let filter = pr... | fim | yewstack/yew | rust |
<|fim_prefix|>use web_sys::HtmlInputElement;
use yew::events::KeyboardEvent;
use yew::prelude::*;
#[derive(PartialEq, Properties, Clone)]
pub struct HeaderInputProps {
pub onadd: Callback<String>,
}
#[function_component(HeaderInpu<|fim_suffix|> let value = input.value();
input.set_value("");... | fim | yewstack/yew | rust |
<|fim_suffix|>" target="_blank">{ "TodoMVC" }</a></p>
</footer>
}
}
<|fim_prefix|>use yew::prelude:<|fim_middle|>:*;
#[function_component(InfoFooter)]
pub fn info_footer() -> Html {
html! {
<footer class="info">
<p>{ "Double-click to edit a todo" }</p>
<p>{ "Written by "... | fim | yewstack/yew | rust |
<|fim_prefix|>p<|fim_suffix|> mod header_input;
pub mod info_footer;
<|fim_middle|>ub mod entry;
pub mod filter;
pub<|endoftext|> | fim | yewstack/yew | rust |
<|fim_prefix|>use std::ops::Deref;
use std::rc::Rc;
use yew::prelude::*;
#[derive(Clone)]
pub struct UseBoolToggleHandle {
value: UseStateHandle<bool>,
toggle: Rc<dyn Fn()>,
}
impl UseBoolToggleHandle {
pub fn toggle(self) {
(self.toggle)()
}
}
impl Deref for UseBoolToggleHandle {
type T... | fim | yewstack/yew | rust |
pub mod use_bool_toggle;
<|endoftext|> | fim | yewstack/yew | rust |
<|fim_prefix|>use gloo::storage::{LocalStorage, Storage};
use state::{Action, Filter, State};
use strum::IntoEnumIterator;
use yew::prelude::*;
mod components;
mod hooks;
mod state;
use components::entry::Entry as EntryItem;
use components::filter::Filter as FilterItem;
use components::header_input::HeaderInput;
use ... | fim | yewstack/yew | rust |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.