This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use serde_json::Value; | |
use std::collections::HashMap; | |
pub fn expand_json_template(template: &str, tokens: &HashMap<String, String>) -> Option<String> { | |
let substituted = substitute_tokens(template, tokens); | |
match serde_json::from_str::<Value>(&substituted) { | |
Ok(value) => serde_json::to_string_pretty(&value).ok(), | |
Err(e) => { | |
println!("Error parsing JSON after substitution: {}", e); | |
None |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::{ | |
collections::HashMap, | |
sync::{Arc, RwLock, Weak}, | |
}; | |
use std::{ | |
collections::VecDeque, | |
sync::{RwLockReadGuard, RwLockWriteGuard}, | |
}; | |
use uuid::Uuid; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "framegraph-system" | |
version = "0.1.0" | |
edition = "2021" | |
[dependencies] | |
petgraph = "0.6.3" | |
wgpu = "0.15" | |
pollster = "0.3" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [dependencies] | |
// futures = "0.3.30" | |
// petgraph = "0.6.5" | |
// tokio = { version = "1.39.3", features = ["full"] } | |
use futures::future::join_all; | |
use petgraph::graph::{DiGraph, NodeIndex}; | |
use std::{ | |
collections::HashMap, | |
sync::{Arc, Mutex}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define MAX_STEPS 100 | |
#define MAX_DIST 100.0 | |
#define SURF_DIST 0.001 | |
// Camera variables | |
vec3 cameraPos; | |
vec3 cameraTarget; | |
float cameraZoom = 5.0; | |
mat3 getCameraRotation(vec2 angle) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
impl From<serde_json::Error> for Error { | |
fn from(value: serde_json::Error) -> Self { | |
let class = match value.classify() { | |
serde_json::error::Category::Io => "io", | |
serde_json::error::Category::Syntax => "syntax", | |
serde_json::error::Category::Data => "data", | |
serde_json::error::Category::Eof => "eof", | |
}; | |
Error::Deser { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "app" | |
version = "0.1.0" | |
edition = "2021" | |
[lib] | |
crate-type = ["cdylib", "rlib"] | |
path = "src/lib.rs" | |
name = "app_core" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::VecDeque; | |
#[derive(Debug, Clone)] | |
struct Event(u32); | |
struct Context { | |
queued_events: VecDeque<Event>, | |
} | |
impl Context { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::sync::atomic::{AtomicBool, Ordering}; | |
use std::marker::PhantomData; | |
// Simulate hardware-specific types | |
mod hal { | |
pub mod peripherals { | |
pub struct TIMER0; | |
pub struct UART0; | |
pub struct GPIO; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// thiserror = "1.0.63" | |
use std::{ | |
io::{BufRead, BufReader, Write}, | |
process::{Child, Command, Stdio}, | |
sync::{ | |
mpsc::{self, Sender}, | |
Arc, Mutex, | |
}, | |
thread, | |
time::Duration, |